-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(router): add integrity check for refund refund sync and capture flow with stripe as connector #5187
feat(router): add integrity check for refund refund sync and capture flow with stripe as connector #5187
Conversation
…m/juspay/hyperswitch into change_core_amount_to_domain_type
…m/juspay/hyperswitch into change_core_amount_to_domain_type
…m/juspay/hyperswitch into change_core_amount_to_domain_type
…m/juspay/hyperswitch into change_core_amount_to_domain_type
…m/juspay/hyperswitch into change_core_amount_to_domain_type
let currency_enum = enums::Currency::from_str(currency.to_uppercase().as_str()) | ||
.change_context(errors::ConnectorError::ParsingFailed)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this check fails we will throw internal_server_error
, and we won't be able to recover the payment without directly altering the DB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, but this parsing failure should only happen if the currency is not supported by our application and we get that in response, Yes! we wont be able to recover this payment since its a data mismatched issue at connector end! it should be 5xx since if the issue is in hyperswitch end then we shouldn't have let the payment go through in the beginning of the request.
): added capture amount to sync data
0e0444e
…d-refund-sync-and-capture-flow
…d-refund-sync-and-capture-flow
…d-refund-sync-and-capture-flow
Type of Change
Description
With this Pr we are creating integrity check for
Refund
,Refund Sync
andCapture
flowsMotivation and Context
This Pr holds the payment in a non-terminal state incase there is any data discrepancy in the above flows.
How did you test it?
Since it is a black box scenario it cannot is tested in sbx, until and unless we have a way to configure dummy connector to send mismatched data.
Local testing are as follows:
Capture Flow integrity checks
[Scenario 1] : Automatic capture
Steps:
Do payment create
have hardcoded the capture amount internally to fail
Now do Sync to
normal sync, to check status and error message at our end.
Status should be processing and error message should state the kind of error
Response
check if the connector has fixed the data using force sync
if the connector has fixed it then it goes to success
[Scenario 2] : Manual capture
Do payment create
Try doing manual capture, have hardcoded it to fail
Now, do sync and lets say connector has fixed the data mismatched,
Sync
Refunds
Do payment create
Status should be 200, with succeeded
Now, do refund
The status code should be 200, with status as manual review along with error message
Now, lets say the merchant tries refund again, but since the refunds was already initiated, we shall get 400 bad request
Now, we do a sync checking if the connector as fixed the data
Checklist
cargo +nightly fmt --all
cargo clippy