Exemple #1
0
def test_update_transaction_for_direct_pay_with_response_url(session):
    """Assert that the receipt records are created."""
    current_app.config['DIRECT_PAY_ENABLED'] = True
    response_url = 'trnApproved=1&messageText=Approved&trnOrderId=1003598&trnAmount=201.00&paymentMethod=CC' \
                   '&cardType=VI&authCode=TEST&trnDate=2020-08-11&pbcTxnNumber=1'
    valid_hash = f'&hashValue={HashingService.encode(response_url)}'

    payment_account = factory_payment_account(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment = factory_payment(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment_account.save()
    payment.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.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())

    # Update transaction with invalid hash
    transaction = PaymentTransactionService.update_transaction(
        transaction.id, f'{response_url}1234567890')
    assert transaction.status_code == TransactionStatus.FAILED.value

    # Update transaction with valid hash
    transaction = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())
    transaction = PaymentTransactionService.update_transaction(
        transaction.id, f'{response_url}{valid_hash}')
    assert transaction.status_code == TransactionStatus.COMPLETED.value
def test_multiple_transactions_for_single_payment(session):
    """Assert that the payment is saved to the table."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment, 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()

    PaymentTransactionService.create(payment.id,
                                     get_paybc_transaction_request())
    PaymentTransactionService.create(payment.id,
                                     get_paybc_transaction_request())
    transaction = PaymentTransactionService.create(
        payment.id, get_paybc_transaction_request())

    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 == Status.CREATED.value
Exemple #3
0
def test_transaction_for_direct_pay_create_from_new(session):
    """Assert that the payment is saved to the table."""
    current_app.config['DIRECT_PAY_ENABLED'] = True
    payment_account = factory_payment_account(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment = factory_payment(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment, 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.create(
        payment.id, get_paybc_transaction_request())

    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.asdict() is not None
Exemple #4
0
def test_update_transaction_for_direct_pay_without_response_url(session):
    """Assert that the receipt records are created."""
    current_app.config['DIRECT_PAY_ENABLED'] = True

    payment_account = factory_payment_account(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment = factory_payment(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment_account.save()
    payment.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.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())

    # Update transaction without response url, which should update the receipt
    transaction = PaymentTransactionService.update_transaction(
        transaction.id, None)
    assert transaction.status_code == TransactionStatus.COMPLETED.value
def test_transaction_update_with_no_receipt(session, stan_server):
    """Assert that the payment is saved to the table."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment, payment_account)
    invoice.save()
    factory_invoice_reference(invoice.id, invoice_number='').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.create(
        payment.id, get_paybc_transaction_request())
    transaction = PaymentTransactionService.update_transaction(
        payment.id, transaction.id, None)

    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.transaction_end_time is not None
    assert transaction.status_code == Status.FAILED.value
    assert transaction.asdict() is not None
def test_transaction_update_completed(session, stan_server, public_user_mock):
    """Assert that the payment is saved to the table."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment, 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.create(
        payment.id, get_paybc_transaction_request())
    transaction = PaymentTransactionService.update_transaction(
        payment.id, transaction.id, '123451')

    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.update_transaction(payment.id,
                                                     transaction.id, '123451')
    assert excinfo.value.status == Error.PAY006.status
    assert excinfo.value.message == Error.PAY006.message
    assert excinfo.value.code == Error.PAY006.name
Exemple #7
0
def test_transaction_create_from_new(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()
    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 = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())

    assert transaction is not None
    assert transaction.id is not None
    assert transaction.status_code is not None
    assert transaction.payment_id == payment.id
    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.asdict() is not None
Exemple #8
0
def test_create_receipt_with_invoice(session, public_user_mock):
    """Try creating a receipt with invoice number."""
    payment_account = factory_payment_account()
    payment_account.save()

    invoice = factory_invoice(payment_account, total=50)
    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()
    payment = factory_payment(invoice_amount=50)
    payment.save()

    transaction = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())
    PaymentTransactionService.update_transaction(transaction.id, '')

    input_data = {
        'corpName': 'Pennsular Coop ',
        'filingDateTime': '1999',
        'fileName': 'coopser'
    }

    response = ReceiptService.create_receipt(invoice.id,
                                             input_data,
                                             skip_auth_check=True)
    assert response is not None
Exemple #9
0
def test_transaction_update(session, stan_server, public_user_mock):
    """Assert that the payment is saved to the table."""
    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()

    factory_payment(invoice_number=invoice_reference.invoice_number).save()

    transaction = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())
    transaction = PaymentTransactionService.update_transaction(
        transaction.id, pay_response_url='receipt_number=123451')

    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.transaction_end_time is not None
    assert transaction.status_code == TransactionStatus.COMPLETED.value
Exemple #10
0
def test_create_transaction_for_completed_nsf_payment(session):
    """Assert that the payment is saved to the table."""
    # Create a FAILED payment (NSF), then clone the payment to create another one for CC payment
    # Create a transaction and assert it's success.
    inv_number_1 = 'REG00001'
    payment_account = factory_payment_account().save()
    invoice_1 = factory_invoice(payment_account, total=100)
    invoice_1.save()
    factory_payment_line_item(invoice_id=invoice_1.id,
                              fee_schedule_id=1).save()
    factory_invoice_reference(invoice_1.id, invoice_number=inv_number_1).save()
    payment_1 = factory_payment(payment_status_code='FAILED',
                                payment_account_id=payment_account.id,
                                invoice_number=inv_number_1,
                                invoice_amount=100,
                                payment_method_code=PaymentMethod.PAD.value)
    payment_1.save()

    # Create payment for NSF payment.
    payment_2 = factory_payment(payment_status_code='COMPLETED',
                                payment_account_id=payment_account.id,
                                invoice_number=inv_number_1,
                                invoice_amount=100,
                                payment_method_code=PaymentMethod.CC.value)
    payment_2.save()

    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.create_transaction_for_payment(
            payment_2.id, get_paybc_transaction_request())

    assert excinfo.value.code == Error.INVALID_PAYMENT_ID.name
Exemple #11
0
def test_event_failed_transactions(session, public_user_mock, stan_server,
                                   monkeypatch):
    """Assert that the transaction status is EVENT_FAILED when Q is not available."""
    # 1. Create payment records
    # 2. Create a transaction
    # 3. Fail the queue publishing which will mark the payment as COMPLETED and transaction as EVENT_FAILED
    # 4. Update the transansaction with queue up which will mark the transaction as COMPLETED
    current_app.config['DIRECT_PAY_ENABLED'] = True
    payment_account = factory_payment_account(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment_account.save()
    fee_schedule = FeeSchedule.find_by_filing_type_and_corp_type('CP', 'OTANN')

    invoice = factory_invoice(payment_account, total=30)
    invoice.save()
    factory_invoice_reference(invoice.id).save()
    line = factory_payment_line_item(
        invoice.id, fee_schedule_id=fee_schedule.fee_schedule_id)
    line.save()

    transaction = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())

    def get_receipt(cls, payment_account, pay_response_url: str,
                    invoice_reference):  # pylint: disable=unused-argument; mocks of library methods
        return '1234567890', datetime.now(), 30.00

    monkeypatch.setattr(
        'pay_api.services.direct_pay_service.DirectPayService.get_receipt',
        get_receipt)

    with patch('pay_api.services.payment_transaction.publish_response',
               side_effect=ConnectionError('mocked error')):
        transaction = PaymentTransactionService.update_transaction(
            transaction.id, pay_response_url='?key=value')

    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.transaction_end_time is not None
    assert transaction.status_code == TransactionStatus.EVENT_FAILED.value

    # Now update the transaction and check the status of the transaction
    transaction = PaymentTransactionService.update_transaction(
        transaction.id, pay_response_url=None)

    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.transaction_end_time is not None
    assert transaction.status_code == TransactionStatus.COMPLETED.value
def test_update_distribution(session, public_user_mock, stan_server,
                             monkeypatch):
    """Assert that the invoice status is updated when the distribution is updated."""
    # 1. Create a distribution code
    # 2. Attach a fee schedule to the distribution
    # 3. Create and complete payment
    # 4. Update the distribution and assert the invoice status is changed.
    distribution_code_svc = services.DistributionCode()
    fee_schedule = FeeSchedule.find_by_filing_type_and_corp_type('CP', 'OTANN')

    # Create a direct pay
    current_app.config['DIRECT_PAY_ENABLED'] = True
    payment_account = factory_payment_account(
        payment_method_code=PaymentMethod.DIRECT_PAY.value)
    payment_account.save()

    invoice = factory_invoice(payment_account, total=30)
    invoice.save()
    invoice_reference = factory_invoice_reference(invoice.id).save()
    line = factory_payment_line_item(
        invoice.id, fee_schedule_id=fee_schedule.fee_schedule_id)
    line.save()

    factory_payment(invoice_number=invoice_reference.invoice_number,
                    payment_method_code=PaymentMethod.DIRECT_PAY.value,
                    invoice_amount=30).save()

    distribution_id = line.fee_distribution_id

    distribution_code = distribution_code_svc.find_by_id(distribution_id)

    transaction = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())

    def get_receipt(cls, payment_account, pay_response_url: str,
                    invoice_reference):  # pylint: disable=unused-argument; mocks of library methods
        return '1234567890', datetime.now(), 30.00

    monkeypatch.setattr(
        'pay_api.services.direct_pay_service.DirectPayService.get_receipt',
        get_receipt)

    # Update transaction without response url, which should update the receipt
    PaymentTransactionService.update_transaction(transaction.id,
                                                 pay_response_url=None)

    invoice = InvoiceModel.find_by_id(invoice.id)
    assert invoice.invoice_status_code == InvoiceStatus.PAID.value

    # Update distribution code
    distribution_code_svc.save_or_update(distribution_code, distribution_id)
    invoice = InvoiceModel.find_by_id(invoice.id)
    assert invoice.invoice_status_code == InvoiceStatus.UPDATE_REVENUE_ACCOUNT.value
Exemple #13
0
def test_patch_transaction_for_nsf_payment(session, monkeypatch):
    """Assert that the payment is saved to the table."""
    # Create a FAILED payment (NSF), then clone the payment to create another one for CC payment
    # Create a transaction and assert it's success.
    # Patch transaction and check the status of records
    inv_number_1 = 'REG00001'
    payment_account = factory_payment_account(
        cfs_account_status=CfsAccountStatus.FREEZE.value,
        payment_method_code='PAD').save()
    invoice_1 = factory_invoice(payment_account, total=100)
    invoice_1.save()
    factory_payment_line_item(invoice_id=invoice_1.id,
                              fee_schedule_id=1).save()
    factory_invoice_reference(invoice_1.id, invoice_number=inv_number_1).save()
    payment_1 = factory_payment(payment_status_code='FAILED',
                                payment_account_id=payment_account.id,
                                invoice_number=inv_number_1,
                                invoice_amount=100,
                                payment_method_code=PaymentMethod.PAD.value)
    payment_1.save()

    # Create payment for NSF payment.
    payment_2 = factory_payment(payment_status_code='CREATED',
                                payment_account_id=payment_account.id,
                                invoice_number=inv_number_1,
                                invoice_amount=100,
                                payment_method_code=PaymentMethod.CC.value)
    payment_2.save()

    def get_receipt(cls, payment_account, pay_response_url: str,
                    invoice_reference):  # pylint: disable=unused-argument; mocks of library methods
        return '1234567890', datetime.now(), 100.00

    monkeypatch.setattr(
        'pay_api.services.paybc_service.PaybcService.get_receipt', get_receipt)

    txn = PaymentTransactionService.create_transaction_for_payment(
        payment_2.id, get_paybc_transaction_request())
    txn = PaymentTransactionService.update_transaction(
        txn.id, pay_response_url='receipt_number=123451')

    assert txn.status_code == 'COMPLETED'
    payment_2 = Payment.find_by_id(payment_2.id)
    assert payment_2.payment_status_code == 'COMPLETED'

    invoice_1: Invoice = Invoice.find_by_id(invoice_1.id)
    assert invoice_1.invoice_status_code == 'PAID'
    cfs_account = CfsAccount.find_effective_by_account_id(payment_account.id)
    assert cfs_account.status == 'ACTIVE'
Exemple #14
0
def test_transaction_create_from_invalid_payment(session):
    """Assert that the payment is saved to the table."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment, 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()

    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.create(999, get_paybc_transaction_request())
    assert excinfo.value.code == Error.INVALID_PAYMENT_ID.name
Exemple #15
0
def test_transaction_update_on_paybc_connection_error(session, stan_server):
    """Assert that the payment is saved to the table."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment, 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.create(
        payment.id, get_paybc_transaction_request())

    from unittest.mock import patch
    from requests.exceptions import ConnectTimeout, ConnectionError

    # Mock here that the invoice update fails here to test the rollback scenario
    with patch('pay_api.services.oauth_service.requests.post',
               side_effect=ConnectionError('mocked error')):
        transaction = PaymentTransactionService.update_transaction(
            payment.id,
            transaction.id,
            pay_response_url='receipt_number=123451')
        assert transaction.pay_system_reason_code == 'SERVICE_UNAVAILABLE'
    with patch('pay_api.services.oauth_service.requests.post',
               side_effect=ConnectTimeout('mocked error')):
        transaction = PaymentTransactionService.update_transaction(
            payment.id,
            transaction.id,
            pay_response_url='receipt_number=123451')
        assert transaction.pay_system_reason_code == 'SERVICE_UNAVAILABLE'

    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.transaction_end_time is not None
    assert transaction.status_code == TransactionStatus.FAILED.value
Exemple #16
0
def test_transaction_create_new_on_completed_payment(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()
    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()

    factory_payment(invoice_number=invoice_reference.invoice_number,
                    payment_status_code=PaymentStatus.COMPLETED.value).save()

    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.create_transaction_for_invoice(
            invoice.id, get_paybc_transaction_request())
    assert excinfo.value.code == Error.COMPLETED_PAYMENT.name
Exemple #17
0
def test_transaction_update_completed(session, stan_server, public_user_mock):
    """Assert that the payment is saved to the table."""
    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()

    factory_payment(invoice_number=invoice_reference.invoice_number).save()

    transaction = PaymentTransactionService.create_transaction_for_invoice(
        invoice.id, get_paybc_transaction_request())
    transaction = PaymentTransactionService.update_transaction(
        transaction.id, pay_response_url='receipt_number=123451')

    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.update_transaction(
            transaction.id, pay_response_url='receipt_number=123451')
    assert excinfo.value.code == Error.INVALID_TRANSACTION.name
Exemple #18
0
def test_create_transaction_for_nsf_payment(session):
    """Assert that the payment is saved to the table."""
    # Create a FAILED payment (NSF), then clone the payment to create another one for CC payment
    # Create a transaction and assert it's success.
    inv_number_1 = 'REG00001'
    payment_account = factory_payment_account().save()
    invoice_1 = factory_invoice(payment_account, total=100)
    invoice_1.save()
    factory_payment_line_item(invoice_id=invoice_1.id,
                              fee_schedule_id=1).save()
    factory_invoice_reference(invoice_1.id, invoice_number=inv_number_1).save()
    payment_1 = factory_payment(payment_status_code='FAILED',
                                payment_account_id=payment_account.id,
                                invoice_number=inv_number_1,
                                invoice_amount=100,
                                payment_method_code=PaymentMethod.PAD.value)
    payment_1.save()

    # Create payment for NSF payment.
    payment_2 = factory_payment(payment_account_id=payment_account.id,
                                invoice_number=inv_number_1,
                                invoice_amount=100,
                                payment_method_code=PaymentMethod.CC.value)
    payment_2.save()

    transaction = PaymentTransactionService.create_transaction_for_payment(
        payment_2.id, get_paybc_transaction_request())

    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.asdict() is not None