def test_transaction_find_active_lookup(session): """Invalid lookup..""" payment_account = factory_payment_account() payment_account.save() invoice = factory_invoice(payment_account) invoice.save() invoice_reference = factory_invoice_reference(invoice.id).save() fee_schedule = FeeSchedule.find_by_filing_type_and_corp_type('CP', 'OTANN') line = factory_payment_line_item( invoice.id, fee_schedule_id=fee_schedule.fee_schedule_id) line.save() payment = factory_payment( invoice_number=invoice_reference.invoice_number).save() transaction = factory_payment_transaction(payment.id, TransactionStatus.CREATED.value) transaction.save() transaction = PaymentTransactionService.find_active_by_invoice_id( invoice.id) assert transaction is not None assert transaction.id is not None assert transaction.status_code is not None assert transaction.payment_id is not None assert transaction.client_system_url is not None assert transaction.pay_system_url is not None assert transaction.transaction_start_time is not None assert transaction.status_code == TransactionStatus.CREATED.value
def test_no_existing_transaction(session): """Assert that the payment is saved to the table.""" payment_account = factory_payment_account() payment_account.save() invoice = factory_invoice(payment_account) invoice.save() factory_invoice_reference(invoice.id).save() fee_schedule = FeeSchedule.find_by_filing_type_and_corp_type('CP', 'OTANN') line = factory_payment_line_item( invoice.id, fee_schedule_id=fee_schedule.fee_schedule_id) line.save() transaction = PaymentTransactionService.find_active_by_invoice_id( invoice.id) assert transaction is None
def test_transaction_find_active_none_lookup(session): """Invalid lookup..""" payment_account = factory_payment_account() payment_account.save() invoice = factory_invoice(payment_account) invoice.save() invoice_reference = factory_invoice_reference(invoice.id).save() fee_schedule = FeeSchedule.find_by_filing_type_and_corp_type('CP', 'OTANN') line = factory_payment_line_item( invoice.id, fee_schedule_id=fee_schedule.fee_schedule_id) line.save() payment = factory_payment( invoice_number=invoice_reference.invoice_number).save() transaction = factory_payment_transaction( payment.id, TransactionStatus.COMPLETED.value) transaction.save() transaction = PaymentTransactionService.find_active_by_invoice_id( invoice.id) assert transaction is None