Ejemplo n.º 1
0
def test_create_receipt_with_no_receipt(session, public_user_mock):
    """Try creating a receipt with invoice number."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment.id, payment_account.id)
    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()

    PaymentService.update_payment(payment.id, get_payment_request())
    input_data = {
        'corpName': 'Pennsular Coop ',
        'filingDateTime': '1999',
        'fileName': 'coopser'
    }

    with pytest.raises(BusinessException) as excinfo:
        ReceiptService.create_receipt(payment.id,
                                      '',
                                      input_data,
                                      skip_auth_check=True)
    assert excinfo.type == BusinessException
Ejemplo n.º 2
0
def test_create_receipt_without_invoice(session, public_user_mock):
    """Try creating a receipt without invoice number."""
    payment_account = factory_payment_account()
    payment = factory_payment()
    payment_account.save()
    payment.save()
    invoice = factory_invoice(payment.id, payment_account.id)
    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 = factory_payment_transaction(payment.id)
    transaction.save()

    PaymentService.update_payment(payment.id, get_payment_request())
    input_data = {
        'corpName': 'Pennsular Coop ',
        'filingDateTime': '1999',
        'fileName': 'coopser'
    }
    response = ReceiptService.create_receipt(payment.id,
                                             '',
                                             input_data,
                                             skip_auth_check=True)
    assert response is not None