-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(core): Add Authorize flow as fallback flow while fetching GSM for refund errors #7129
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changed Files
|
sahkal
reviewed
Jan 28, 2025
Comment on lines
+303
to
+314
let option_gsm = if option_gsm.is_none() { | ||
helpers::get_gsm_record( | ||
state, | ||
Some(err.code.clone()), | ||
Some(err.message.clone()), | ||
connector.connector_name.to_string(), | ||
consts::AUTHORIZE_FLOW_STR.to_string(), | ||
) | ||
.await | ||
} else { | ||
option_gsm | ||
}; |
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.
nit:
Suggested change
let option_gsm = if option_gsm.is_none() { | |
helpers::get_gsm_record( | |
state, | |
Some(err.code.clone()), | |
Some(err.message.clone()), | |
connector.connector_name.to_string(), | |
consts::AUTHORIZE_FLOW_STR.to_string(), | |
) | |
.await | |
} else { | |
option_gsm | |
}; | |
let option_gsm = option_gsm.or_else(|| { | |
helpers::get_gsm_record( | |
state, | |
Some(err.code.clone()), | |
Some(err.message.clone()), | |
connector.connector_name.to_string(), | |
consts::AUTHORIZE_FLOW_STR.to_string(), | |
) | |
.await | |
}); |
sahkal
approved these changes
Jan 28, 2025
kashif-m
approved these changes
Jan 29, 2025
mrudulvajpayee4935
approved these changes
Jan 29, 2025
SanchithHegde
approved these changes
Jan 29, 2025
Narayanbhat166
pushed a commit
that referenced
this pull request
Feb 6, 2025
…r refund errors (#7129)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ated errors
Type of Change
Description
Some connectors like Novalnet do not have a separate list of refund errors, they only have a single list for all the possible connector error codes.
In such cases, the error codes and messages are stored under "Authorize" flow in GSM table.
During refund related error when we fetch GSM in code, we will have to fetch the GSM using Authorize flow in case GSM is not found using "refund_flow".
[ Enhancement for this PR ]
Additional Changes
Motivation and Context
How did you test it?
Steps:
1) Make card payment via Fiuu
cURL
curl --location --request POST 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: dev_k6hN6WS14LcwHh4Q7bKCcTDRBwPRUnfQpraO5c7dW6oWiAFOmK8pdWfHlmg6adrt' \ --data-raw '{ "amount":1000, "currency": "MYR", "confirm": true, "payment_link" : false, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": 1000, "customer_id": "exampel3rewfdsvc2", "phone": "999999999", "phone_country_code": "+1", "description": "Its my first payment request", "authentication_type": "three_ds", "return_url": "https://google.com", "payment_method": "card", "payment_method_type": "credit", "payment_method_data": { "card": { "card_number": "5105105105105100", "card_exp_month": "12", "card_exp_year": "2030", "card_holder_name": "Max Mustermann", "card_cvc": "444" } }, "browser_info": { "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,\/;q=0.8", "language": "nl-NL", "color_depth": 24, "ip_address": "103.77.139.95", "screen_height": 723, "screen_width": 1536, "time_zone": 0, "java_enabled": true, "java_script_enabled": true }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } }'
Response

2)Update DB with following commands to make captured amount greater than the real captured amount
3)Update gateway_status_map (with "Authorize flow") and unified_translations table
4)a) Make refunds call with locale "zh-Hant"
cURL
Response

Checklist
cargo +nightly fmt --all
cargo clippy