This PR will solve the following issues : #811 , #813
If there is an error, the payment provider should raise an exception.
With an exception, the error never silently fails, it can prevent or at least show a bug.
We have implemented a custom exception that will raise when an request fails on the payment provider API side.
The exception is captured when a request failed on the following payment backend methods : create_payment, create_one_click_payment and create_zero_click_payment.
When calling the endpoint submit_installment_payment and an error occurs on the API of the payment provider, a 400 BAD_REQUEST is raised.
I've checked for payplug payment provider, there is already a BadRequest exception raised when failling with a request with the API of Payplug. Only Lyra was missing a custom exception to return a BAD_REQUEST when the request failed.
Proposal
[x] Create custom exception of PaymentProviderAPIException
[x] Add the custom exception into try..except block in the payment provider class.
Purpose
This PR will solve the following issues : #811 , #813
If there is an error, the payment provider should raise an exception.
With an exception, the error never silently fails, it can prevent or at least show a bug.
We have implemented a custom exception that will raise when an request fails on the payment provider API side.
The exception is captured when a request failed on the following payment backend methods :
create_payment
,create_one_click_payment
andcreate_zero_click_payment
.When calling the endpoint
submit_installment_payment
and an error occurs on the API of the payment provider, a400 BAD_REQUEST
is raised.I've checked for payplug payment provider, there is already a BadRequest exception raised when failling with a request with the API of Payplug. Only Lyra was missing a custom exception to return a
BAD_REQUEST
when the request failed.Proposal
PaymentProviderAPIException
try..except
block in the payment provider class.