def test_transaction_invalid_lookup(session):
    """Invalid lookup.."""
    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.find_by_id(1, uuid.uuid4())
    assert excinfo.value.status == Error.PAY008.status
    assert excinfo.value.message == Error.PAY008.message
    assert excinfo.value.code == Error.PAY008.name
def test_transaction_saved_from_new(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.id, payment_account.id)
    invoice.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_transaction = PaymentTransactionService()
    payment_transaction.status_code = 'DRAFT'
    payment_transaction.transaction_end_time = datetime.now()
    payment_transaction.transaction_start_time = datetime.now()
    payment_transaction.pay_system_url = 'http://google.com'
    payment_transaction.client_system_url = 'http://google.com'
    payment_transaction.payment_id = payment.id
    payment_transaction = payment_transaction.save()

    transaction = PaymentTransactionService.find_by_id(payment.id,
                                                       payment_transaction.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.transaction_end_time is not None
Ejemplo n.º 3
0
def test_transaction_invalid_lookup(session):
    """Invalid lookup.."""
    with pytest.raises(BusinessException) as excinfo:
        PaymentTransactionService.find_by_id(uuid.uuid4())
    assert excinfo.value.code == Error.INVALID_TRANSACTION_ID.name