-
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(core): add columns unified error code and error message in refund table #6933
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ use api_models::{ | |
}; | ||
use common_utils::{ | ||
consts::{DEFAULT_LOCALE, DEFAULT_SESSION_EXPIRY}, | ||
ext_traits::{AsyncExt, OptionExt, ValueExt}, | ||
ext_traits::{OptionExt, ValueExt}, | ||
types::{AmountConvertor, StringMajorUnitForCore}, | ||
}; | ||
use error_stack::{report, ResultExt}; | ||
|
@@ -28,9 +28,8 @@ use crate::{ | |
}, | ||
errors::RouterResponse, | ||
get_payment_link_config_value, get_payment_link_config_value_based_on_priority, | ||
headers::ACCEPT_LANGUAGE, | ||
routes::SessionState, | ||
services::{self, authentication::get_header_value_by_key}, | ||
services, | ||
types::{ | ||
api::payment_link::PaymentLinkResponseExt, | ||
domain, | ||
|
@@ -70,7 +69,6 @@ pub async fn form_payment_link_data( | |
key_store: domain::MerchantKeyStore, | ||
merchant_id: common_utils::id_type::MerchantId, | ||
payment_id: common_utils::id_type::PaymentId, | ||
locale: Option<String>, | ||
) -> RouterResult<(PaymentLink, PaymentLinkData, PaymentLinkConfig)> { | ||
todo!() | ||
} | ||
|
@@ -82,7 +80,6 @@ pub async fn form_payment_link_data( | |
key_store: domain::MerchantKeyStore, | ||
merchant_id: common_utils::id_type::MerchantId, | ||
payment_id: common_utils::id_type::PaymentId, | ||
locale: Option<String>, | ||
) -> RouterResult<(PaymentLink, PaymentLinkData, PaymentLinkConfig)> { | ||
let db = &*state.store; | ||
let key_manager_state = &state.into(); | ||
|
@@ -242,7 +239,7 @@ pub async fn form_payment_link_data( | |
redirect: false, | ||
theme: payment_link_config.theme.clone(), | ||
return_url: return_url.clone(), | ||
locale: locale.clone(), | ||
locale: Some(state.clone().locale), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to |
||
transaction_details: payment_link_config.transaction_details.clone(), | ||
unified_code: payment_attempt.unified_code, | ||
unified_message: payment_attempt.unified_message, | ||
|
@@ -273,7 +270,7 @@ pub async fn form_payment_link_data( | |
display_sdk_only: payment_link_config.display_sdk_only, | ||
hide_card_nickname_field: payment_link_config.hide_card_nickname_field, | ||
show_card_form_by_default: payment_link_config.show_card_form_by_default, | ||
locale, | ||
locale: Some(state.clone().locale), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
transaction_details: payment_link_config.transaction_details.clone(), | ||
background_image: payment_link_config.background_image.clone(), | ||
details_layout: payment_link_config.details_layout, | ||
|
@@ -296,17 +293,9 @@ pub async fn initiate_secure_payment_link_flow( | |
payment_id: common_utils::id_type::PaymentId, | ||
request_headers: &header::HeaderMap, | ||
) -> RouterResponse<services::PaymentLinkFormData> { | ||
let locale = get_header_value_by_key(ACCEPT_LANGUAGE.into(), request_headers)? | ||
.map(|val| val.to_string()); | ||
let (payment_link, payment_link_details, payment_link_config) = form_payment_link_data( | ||
&state, | ||
merchant_account, | ||
key_store, | ||
merchant_id, | ||
payment_id, | ||
locale, | ||
) | ||
.await?; | ||
let (payment_link, payment_link_details, payment_link_config) = | ||
form_payment_link_data(&state, merchant_account, key_store, merchant_id, payment_id) | ||
.await?; | ||
|
||
validator::validate_secure_payment_link_render_request( | ||
request_headers, | ||
|
@@ -396,19 +385,10 @@ pub async fn initiate_payment_link_flow( | |
key_store: domain::MerchantKeyStore, | ||
merchant_id: common_utils::id_type::MerchantId, | ||
payment_id: common_utils::id_type::PaymentId, | ||
request_headers: &header::HeaderMap, | ||
) -> RouterResponse<services::PaymentLinkFormData> { | ||
let locale = get_header_value_by_key(ACCEPT_LANGUAGE.into(), request_headers)? | ||
.map(|val| val.to_string()); | ||
let (_, payment_details, payment_link_config) = form_payment_link_data( | ||
&state, | ||
merchant_account, | ||
key_store, | ||
merchant_id, | ||
payment_id, | ||
locale, | ||
) | ||
.await?; | ||
let (_, payment_details, payment_link_config) = | ||
form_payment_link_data(&state, merchant_account, key_store, merchant_id, payment_id) | ||
.await?; | ||
|
||
let css_script = get_color_scheme_css(&payment_link_config); | ||
let js_script = get_js_script(&payment_details)?; | ||
|
@@ -727,7 +707,6 @@ pub async fn get_payment_link_status( | |
_key_store: domain::MerchantKeyStore, | ||
_merchant_id: common_utils::id_type::MerchantId, | ||
_payment_id: common_utils::id_type::PaymentId, | ||
_request_headers: &header::HeaderMap, | ||
) -> RouterResponse<services::PaymentLinkFormData> { | ||
todo!() | ||
} | ||
|
@@ -739,10 +718,7 @@ pub async fn get_payment_link_status( | |
key_store: domain::MerchantKeyStore, | ||
merchant_id: common_utils::id_type::MerchantId, | ||
payment_id: common_utils::id_type::PaymentId, | ||
request_headers: &header::HeaderMap, | ||
) -> RouterResponse<services::PaymentLinkFormData> { | ||
let locale = get_header_value_by_key(ACCEPT_LANGUAGE.into(), request_headers)? | ||
.map(|val| val.to_string()); | ||
let db = &*state.store; | ||
let key_manager_state = &(&state).into(); | ||
|
||
|
@@ -858,19 +834,14 @@ pub async fn get_payment_link_status( | |
consts::DEFAULT_UNIFIED_ERROR_MESSAGE.to_owned(), | ||
) | ||
}; | ||
let unified_translated_message = locale | ||
.as_ref() | ||
.async_and_then(|locale_str| async { | ||
helpers::get_unified_translation( | ||
&state, | ||
unified_code.to_owned(), | ||
unified_message.to_owned(), | ||
locale_str.to_owned(), | ||
) | ||
.await | ||
}) | ||
.await | ||
.or(Some(unified_message)); | ||
let unified_translated_message = helpers::get_unified_translation( | ||
&state, | ||
unified_code.to_owned(), | ||
unified_message.to_owned(), | ||
state.locale.clone(), | ||
) | ||
.await | ||
.or(Some(unified_message)); | ||
|
||
let payment_details = api_models::payments::PaymentLinkStatusDetails { | ||
amount, | ||
|
@@ -885,7 +856,7 @@ pub async fn get_payment_link_status( | |
redirect: true, | ||
theme: payment_link_config.theme.clone(), | ||
return_url, | ||
locale, | ||
locale: Some(state.locale.clone()), | ||
transaction_details: payment_link_config.transaction_details, | ||
unified_code: Some(unified_code), | ||
unified_message: unified_translated_message, | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Location is not used anywhere, so removing it