-
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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, | ||
|
@@ -296,15 +295,13 @@ 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, | ||
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. We need not pass locale here since |
||
) | ||
.await?; | ||
|
||
|
@@ -396,17 +393,15 @@ 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, | ||
_request_headers: &header::HeaderMap, | ||
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. We can remove the unused |
||
) -> 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, | ||
Some(state.clone().locale), | ||
) | ||
.await?; | ||
|
||
|
@@ -739,10 +734,8 @@ 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, | ||
_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 +851,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 +873,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, | ||
|
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