def test_patch_online_banking_payment_to_cc(session, public_user_mock): """Assert that the payment records are created.""" payment_account = factory_payment_account( payment_method_code=PaymentMethod.ONLINE_BANKING.value).save() payment_account.save() # payment.save() payment_response = PaymentService.create_invoice( get_payment_request_with_service_fees(business_identifier='CP0002000'), get_auth_premium_user()) invoice_id = payment_response.get('id') factory_invoice_reference(invoice_id).save() request = {'paymentInfo': {'methodOfPayment': PaymentMethod.CC.value}} invoice_response = PaymentService.update_invoice(invoice_id, request) assert invoice_response.get('payment_method') == PaymentMethod.CC.value
def test_patch_online_banking_payment_to_direct_pay(session, public_user_mock): """Assert that the payment records are created.""" factory_payment_account( payment_method_code=PaymentMethod.ONLINE_BANKING.value).save() payment_response = PaymentService.create_invoice( get_payment_request_with_service_fees(business_identifier='CP0002000'), get_auth_premium_user()) assert payment_response is not None assert payment_response.get('payment_method') == 'ONLINE_BANKING' assert payment_response.get('status_code') == 'CREATED' invoice_id = payment_response.get('id') request = {'paymentInfo': {'methodOfPayment': PaymentMethod.CC.value}} invoice_response = PaymentService.update_invoice(invoice_id, request) assert invoice_response.get( 'payment_method') == PaymentMethod.DIRECT_PAY.value