mirror of
https://github.com/juspay/hyperswitch.git
synced 2026-03-13 09:02:06 +08:00
feat(router): add unified_code, unified_message in payments response (#2918)
This commit is contained in:
committed by
GitHub
parent
efeebc0f23
commit
39540015fd
@@ -13,6 +13,8 @@ pub struct GsmCreateRequest {
|
||||
pub router_error: Option<String>,
|
||||
pub decision: GsmDecision,
|
||||
pub step_up_possible: bool,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
@@ -57,6 +59,8 @@ pub struct GsmUpdateRequest {
|
||||
pub router_error: Option<String>,
|
||||
pub decision: Option<GsmDecision>,
|
||||
pub step_up_possible: Option<bool>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
@@ -88,4 +92,6 @@ pub struct GsmResponse {
|
||||
pub router_error: Option<String>,
|
||||
pub decision: String,
|
||||
pub step_up_possible: bool,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
@@ -391,6 +391,10 @@ pub struct PaymentAttemptResponse {
|
||||
/// reference to the payment at connector side
|
||||
#[schema(value_type = Option<String>, example = "993672945374576J")]
|
||||
pub reference_id: Option<String>,
|
||||
/// error code unified across the connectors is received here if there was an error while calling connector
|
||||
pub unified_code: Option<String>,
|
||||
/// error message unified across the connectors is received here if there was an error while calling connector
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@@ -2089,6 +2093,12 @@ pub struct PaymentsResponse {
|
||||
#[schema(example = "Failed while verifying the card")]
|
||||
pub error_message: Option<String>,
|
||||
|
||||
/// error code unified across the connectors is received here if there was an error while calling connector
|
||||
pub unified_code: Option<String>,
|
||||
|
||||
/// error message unified across the connectors is received here if there was an error while calling connector
|
||||
pub unified_message: Option<String>,
|
||||
|
||||
/// Payment Experience for the current payment
|
||||
#[schema(value_type = Option<PaymentExperience>, example = "redirect_to_url")]
|
||||
pub payment_experience: Option<api_enums::PaymentExperience>,
|
||||
|
||||
@@ -145,6 +145,8 @@ pub struct PaymentAttempt {
|
||||
pub authentication_data: Option<serde_json::Value>,
|
||||
pub encoded_data: Option<String>,
|
||||
pub merchant_connector_id: Option<String>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
@@ -207,6 +209,8 @@ pub struct PaymentAttemptNew {
|
||||
pub authentication_data: Option<serde_json::Value>,
|
||||
pub encoded_data: Option<String>,
|
||||
pub merchant_connector_id: Option<String>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -292,6 +296,8 @@ pub enum PaymentAttemptUpdate {
|
||||
updated_by: String,
|
||||
authentication_data: Option<serde_json::Value>,
|
||||
encoded_data: Option<String>,
|
||||
unified_code: Option<Option<String>>,
|
||||
unified_message: Option<Option<String>>,
|
||||
},
|
||||
UnresolvedResponseUpdate {
|
||||
status: storage_enums::AttemptStatus,
|
||||
@@ -316,6 +322,8 @@ pub enum PaymentAttemptUpdate {
|
||||
error_reason: Option<Option<String>>,
|
||||
amount_capturable: Option<i64>,
|
||||
updated_by: String,
|
||||
unified_code: Option<Option<String>>,
|
||||
unified_message: Option<Option<String>>,
|
||||
},
|
||||
MultipleCaptureCountUpdate {
|
||||
multiple_capture_count: i16,
|
||||
|
||||
@@ -34,6 +34,8 @@ pub struct GatewayStatusMap {
|
||||
#[serde(with = "custom_serde::iso8601")]
|
||||
pub last_modified: PrimitiveDateTime,
|
||||
pub step_up_possible: bool,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Insertable)]
|
||||
@@ -48,6 +50,8 @@ pub struct GatewayStatusMappingNew {
|
||||
pub router_error: Option<String>,
|
||||
pub decision: String,
|
||||
pub step_up_possible: bool,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@@ -71,6 +75,8 @@ pub struct GatewayStatusMapperUpdateInternal {
|
||||
pub router_error: Option<Option<String>>,
|
||||
pub decision: Option<String>,
|
||||
pub step_up_possible: Option<bool>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -79,6 +85,8 @@ pub struct GatewayStatusMappingUpdate {
|
||||
pub router_error: Option<Option<String>>,
|
||||
pub decision: Option<String>,
|
||||
pub step_up_possible: Option<bool>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
impl From<GatewayStatusMappingUpdate> for GatewayStatusMapperUpdateInternal {
|
||||
@@ -88,12 +96,16 @@ impl From<GatewayStatusMappingUpdate> for GatewayStatusMapperUpdateInternal {
|
||||
status,
|
||||
router_error,
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} = value;
|
||||
Self {
|
||||
status,
|
||||
router_error,
|
||||
decision,
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ pub struct PaymentAttempt {
|
||||
pub merchant_connector_id: Option<String>,
|
||||
pub authentication_data: Option<serde_json::Value>,
|
||||
pub encoded_data: Option<String>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Queryable, Serialize, Deserialize)]
|
||||
@@ -124,6 +126,8 @@ pub struct PaymentAttemptNew {
|
||||
pub merchant_connector_id: Option<String>,
|
||||
pub authentication_data: Option<serde_json::Value>,
|
||||
pub encoded_data: Option<String>,
|
||||
pub unified_code: Option<String>,
|
||||
pub unified_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -209,6 +213,8 @@ pub enum PaymentAttemptUpdate {
|
||||
updated_by: String,
|
||||
authentication_data: Option<serde_json::Value>,
|
||||
encoded_data: Option<String>,
|
||||
unified_code: Option<Option<String>>,
|
||||
unified_message: Option<Option<String>>,
|
||||
},
|
||||
UnresolvedResponseUpdate {
|
||||
status: storage_enums::AttemptStatus,
|
||||
@@ -233,6 +239,8 @@ pub enum PaymentAttemptUpdate {
|
||||
error_reason: Option<Option<String>>,
|
||||
amount_capturable: Option<i64>,
|
||||
updated_by: String,
|
||||
unified_code: Option<Option<String>>,
|
||||
unified_message: Option<Option<String>>,
|
||||
},
|
||||
MultipleCaptureCountUpdate {
|
||||
multiple_capture_count: i16,
|
||||
@@ -298,6 +306,8 @@ pub struct PaymentAttemptUpdateInternal {
|
||||
merchant_connector_id: Option<String>,
|
||||
authentication_data: Option<serde_json::Value>,
|
||||
encoded_data: Option<String>,
|
||||
unified_code: Option<Option<String>>,
|
||||
unified_message: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl PaymentAttemptUpdate {
|
||||
@@ -352,6 +362,8 @@ impl PaymentAttemptUpdate {
|
||||
merchant_connector_id: pa_update.merchant_connector_id,
|
||||
authentication_data: pa_update.authentication_data.or(source.authentication_data),
|
||||
encoded_data: pa_update.encoded_data.or(source.encoded_data),
|
||||
unified_code: pa_update.unified_code.unwrap_or(source.unified_code),
|
||||
unified_message: pa_update.unified_message.unwrap_or(source.unified_message),
|
||||
..source
|
||||
}
|
||||
}
|
||||
@@ -488,6 +500,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
updated_by,
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} => Self {
|
||||
status: Some(status),
|
||||
connector,
|
||||
@@ -508,6 +522,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
tax_amount,
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code,
|
||||
unified_message,
|
||||
..Default::default()
|
||||
},
|
||||
PaymentAttemptUpdate::ErrorUpdate {
|
||||
@@ -518,6 +534,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} => Self {
|
||||
connector,
|
||||
status: Some(status),
|
||||
@@ -527,6 +545,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
unified_code,
|
||||
unified_message,
|
||||
..Default::default()
|
||||
},
|
||||
PaymentAttemptUpdate::StatusUpdate { status, updated_by } => Self {
|
||||
|
||||
@@ -331,6 +331,10 @@ diesel::table! {
|
||||
created_at -> Timestamp,
|
||||
last_modified -> Timestamp,
|
||||
step_up_possible -> Bool,
|
||||
#[max_length = 255]
|
||||
unified_code -> Nullable<Varchar>,
|
||||
#[max_length = 1024]
|
||||
unified_message -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,6 +589,10 @@ diesel::table! {
|
||||
merchant_connector_id -> Nullable<Varchar>,
|
||||
authentication_data -> Nullable<Json>,
|
||||
encoded_data -> Nullable<Text>,
|
||||
#[max_length = 255]
|
||||
unified_code -> Nullable<Varchar>,
|
||||
#[max_length = 1024]
|
||||
unified_message -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ pub async fn update_gsm_rule(
|
||||
status,
|
||||
router_error,
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} = gsm_request;
|
||||
GsmInterface::update_gsm_rule(
|
||||
db,
|
||||
@@ -78,6 +80,8 @@ pub async fn update_gsm_rule(
|
||||
status,
|
||||
router_error: Some(router_error),
|
||||
step_up_possible,
|
||||
unified_code,
|
||||
unified_message,
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -3026,6 +3026,8 @@ impl AttemptType {
|
||||
authentication_data: None,
|
||||
encoded_data: None,
|
||||
merchant_connector_id: None,
|
||||
unified_code: None,
|
||||
unified_message: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3516,3 +3518,46 @@ pub fn validate_payment_link_request(
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_gsm_record(
|
||||
state: &AppState,
|
||||
error_code: Option<String>,
|
||||
error_message: Option<String>,
|
||||
connector_name: String,
|
||||
flow: String,
|
||||
) -> Option<storage::gsm::GatewayStatusMap> {
|
||||
let get_gsm = || async {
|
||||
state.store.find_gsm_rule(
|
||||
connector_name.clone(),
|
||||
flow.clone(),
|
||||
"sub_flow".to_string(),
|
||||
error_code.clone().unwrap_or_default(), // TODO: make changes in connector to get a mandatory code in case of success or error response
|
||||
error_message.clone().unwrap_or_default(),
|
||||
)
|
||||
.await
|
||||
.map_err(|err| {
|
||||
if err.current_context().is_db_not_found() {
|
||||
logger::warn!(
|
||||
"GSM miss for connector - {}, flow - {}, error_code - {:?}, error_message - {:?}",
|
||||
connector_name,
|
||||
flow,
|
||||
error_code,
|
||||
error_message
|
||||
);
|
||||
metrics::AUTO_RETRY_GSM_MISS_COUNT.add(&metrics::CONTEXT, 1, &[]);
|
||||
} else {
|
||||
metrics::AUTO_RETRY_GSM_FETCH_FAILURE_COUNT.add(&metrics::CONTEXT, 1, &[]);
|
||||
};
|
||||
err.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("failed to fetch decision from gsm")
|
||||
})
|
||||
};
|
||||
get_gsm()
|
||||
.await
|
||||
.map_err(|err| {
|
||||
// warn log should suffice here because we are not propagating this error
|
||||
logger::warn!(get_gsm_decision_fetch_error=?err, "error fetching gsm decision");
|
||||
err
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::{
|
||||
errors::{self, RouterResult, StorageErrorExt},
|
||||
mandate,
|
||||
payment_methods::PaymentMethodRetrieve,
|
||||
payments::{types::MultipleCaptureData, PaymentData},
|
||||
payments::{helpers as payments_helpers, types::MultipleCaptureData, PaymentData},
|
||||
utils as core_utils,
|
||||
},
|
||||
routes::{metrics, AppState},
|
||||
@@ -331,7 +331,16 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
|
||||
(Some((multiple_capture_data, capture_update_list)), None)
|
||||
}
|
||||
None => {
|
||||
let connector_name = router_data.connector.to_string();
|
||||
let flow_name = core_utils::get_flow_name::<F>()?;
|
||||
let option_gsm = payments_helpers::get_gsm_record(
|
||||
state,
|
||||
Some(err.code.clone()),
|
||||
Some(err.message.clone()),
|
||||
connector_name,
|
||||
flow_name.clone(),
|
||||
)
|
||||
.await;
|
||||
let status =
|
||||
// mark previous attempt status for technical failures in PSync flow
|
||||
if flow_name == "PSync" {
|
||||
@@ -364,6 +373,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
|
||||
None
|
||||
},
|
||||
updated_by: storage_scheme.to_string(),
|
||||
unified_code: option_gsm.clone().map(|gsm| gsm.unified_code),
|
||||
unified_message: option_gsm.map(|gsm| gsm.unified_message),
|
||||
}),
|
||||
)
|
||||
}
|
||||
@@ -470,7 +481,9 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
|
||||
payment_token: None,
|
||||
error_code: error_status.clone(),
|
||||
error_message: error_status.clone(),
|
||||
error_reason: error_status,
|
||||
error_reason: error_status.clone(),
|
||||
unified_code: error_status.clone(),
|
||||
unified_message: error_status,
|
||||
connector_response_reference_id,
|
||||
amount_capturable: if router_data.status.is_terminal_status()
|
||||
|| router_data
|
||||
|
||||
@@ -55,7 +55,7 @@ where
|
||||
|
||||
metrics::AUTO_RETRY_ELIGIBLE_REQUEST_COUNT.add(&metrics::CONTEXT, 1, &[]);
|
||||
|
||||
let mut initial_gsm = get_gsm(state, &router_data).await;
|
||||
let mut initial_gsm = get_gsm(state, &router_data).await?;
|
||||
|
||||
//Check if step-up to threeDS is possible and merchant has enabled
|
||||
let step_up_possible = initial_gsm
|
||||
@@ -99,7 +99,7 @@ where
|
||||
// Use initial_gsm for first time alone
|
||||
let gsm = match initial_gsm.as_ref() {
|
||||
Some(gsm) => Some(gsm.clone()),
|
||||
None => get_gsm(state, &router_data).await,
|
||||
None => get_gsm(state, &router_data).await?,
|
||||
};
|
||||
|
||||
match get_gsm_decision(gsm) {
|
||||
@@ -214,46 +214,16 @@ pub async fn get_retries(
|
||||
pub async fn get_gsm<F, FData>(
|
||||
state: &app::AppState,
|
||||
router_data: &types::RouterData<F, FData, types::PaymentsResponseData>,
|
||||
) -> Option<storage::gsm::GatewayStatusMap> {
|
||||
) -> RouterResult<Option<storage::gsm::GatewayStatusMap>> {
|
||||
let error_response = router_data.response.as_ref().err();
|
||||
let error_code = error_response.map(|err| err.code.to_owned());
|
||||
let error_message = error_response.map(|err| err.message.to_owned());
|
||||
let get_gsm = || async {
|
||||
let connector_name = router_data.connector.to_string();
|
||||
let flow = get_flow_name::<F>()?;
|
||||
state.store.find_gsm_rule(
|
||||
connector_name.clone(),
|
||||
flow.clone(),
|
||||
"sub_flow".to_string(),
|
||||
error_code.clone().unwrap_or_default(), // TODO: make changes in connector to get a mandatory code in case of success or error response
|
||||
error_message.clone().unwrap_or_default(),
|
||||
)
|
||||
.await
|
||||
.map_err(|err| {
|
||||
if err.current_context().is_db_not_found() {
|
||||
logger::warn!(
|
||||
"GSM miss for connector - {}, flow - {}, error_code - {:?}, error_message - {:?}",
|
||||
connector_name,
|
||||
flow,
|
||||
error_code,
|
||||
error_message
|
||||
);
|
||||
metrics::AUTO_RETRY_GSM_MISS_COUNT.add(&metrics::CONTEXT, 1, &[]);
|
||||
} else {
|
||||
metrics::AUTO_RETRY_GSM_FETCH_FAILURE_COUNT.add(&metrics::CONTEXT, 1, &[]);
|
||||
};
|
||||
err.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("failed to fetch decision from gsm")
|
||||
})
|
||||
};
|
||||
get_gsm()
|
||||
.await
|
||||
.map_err(|err| {
|
||||
// warn log should suffice here because we are not propagating this error
|
||||
logger::warn!(get_gsm_decision_fetch_error=?err, "error fetching gsm decision");
|
||||
err
|
||||
})
|
||||
.ok()
|
||||
let connector_name = router_data.connector.to_string();
|
||||
let flow = get_flow_name::<F>()?;
|
||||
Ok(
|
||||
payments::helpers::get_gsm_record(state, error_code, error_message, connector_name, flow)
|
||||
.await,
|
||||
)
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
@@ -417,6 +387,8 @@ where
|
||||
updated_by: storage_scheme.to_string(),
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code: None,
|
||||
unified_message: None,
|
||||
},
|
||||
storage_scheme,
|
||||
)
|
||||
@@ -427,17 +399,20 @@ where
|
||||
logger::error!("unexpected response: this response was not expected in Retry flow");
|
||||
return Ok(());
|
||||
}
|
||||
Err(error_response) => {
|
||||
Err(ref error_response) => {
|
||||
let option_gsm = get_gsm(state, &router_data).await?;
|
||||
db.update_payment_attempt_with_attempt_id(
|
||||
payment_data.payment_attempt.clone(),
|
||||
storage::PaymentAttemptUpdate::ErrorUpdate {
|
||||
connector: None,
|
||||
error_code: Some(Some(error_response.code)),
|
||||
error_message: Some(Some(error_response.message)),
|
||||
error_code: Some(Some(error_response.code.clone())),
|
||||
error_message: Some(Some(error_response.message.clone())),
|
||||
status: storage_enums::AttemptStatus::Failure,
|
||||
error_reason: Some(error_response.reason),
|
||||
error_reason: Some(error_response.reason.clone()),
|
||||
amount_capturable: Some(0),
|
||||
updated_by: storage_scheme.to_string(),
|
||||
unified_code: option_gsm.clone().map(|gsm| gsm.unified_code),
|
||||
unified_message: option_gsm.map(|gsm| gsm.unified_message),
|
||||
},
|
||||
storage_scheme,
|
||||
)
|
||||
|
||||
@@ -685,6 +685,8 @@ where
|
||||
.set_profile_id(payment_intent.profile_id)
|
||||
.set_attempt_count(payment_intent.attempt_count)
|
||||
.set_merchant_connector_id(payment_attempt.merchant_connector_id)
|
||||
.set_unified_code(payment_attempt.unified_code)
|
||||
.set_unified_message(payment_attempt.unified_message)
|
||||
.to_owned(),
|
||||
headers,
|
||||
))
|
||||
@@ -745,6 +747,8 @@ where
|
||||
attempt_count: payment_intent.attempt_count,
|
||||
payment_link: payment_link_data,
|
||||
surcharge_details,
|
||||
unified_code: payment_attempt.unified_code,
|
||||
unified_message: payment_attempt.unified_message,
|
||||
..Default::default()
|
||||
},
|
||||
headers,
|
||||
|
||||
@@ -878,6 +878,8 @@ impl ForeignFrom<storage::PaymentAttempt> for api_models::payments::PaymentAttem
|
||||
payment_experience: payment_attempt.payment_experience,
|
||||
payment_method_type: payment_attempt.payment_method_type,
|
||||
reference_id: payment_attempt.connector_response_reference_id,
|
||||
unified_code: payment_attempt.unified_code,
|
||||
unified_message: payment_attempt.unified_message,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1055,6 +1057,8 @@ impl ForeignFrom<gsm_api_types::GsmCreateRequest> for storage::GatewayStatusMapp
|
||||
status: value.status,
|
||||
router_error: value.router_error,
|
||||
step_up_possible: value.step_up_possible,
|
||||
unified_code: value.unified_code,
|
||||
unified_message: value.unified_message,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1071,6 +1075,8 @@ impl ForeignFrom<storage::GatewayStatusMap> for gsm_api_types::GsmResponse {
|
||||
status: value.status,
|
||||
router_error: value.router_error,
|
||||
step_up_possible: value.step_up_possible,
|
||||
unified_code: value.unified_code,
|
||||
unified_message: value.unified_message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,8 @@ impl ProcessTrackerWorkflow<AppState> for PaymentsSyncWorkflow {
|
||||
)),
|
||||
amount_capturable: Some(0),
|
||||
updated_by: merchant_account.storage_scheme.to_string(),
|
||||
unified_code: None,
|
||||
unified_message: None,
|
||||
};
|
||||
|
||||
payment_data.payment_attempt = db
|
||||
|
||||
@@ -144,6 +144,8 @@ impl PaymentAttemptInterface for MockDb {
|
||||
authentication_data: payment_attempt.authentication_data,
|
||||
encoded_data: payment_attempt.encoded_data,
|
||||
merchant_connector_id: payment_attempt.merchant_connector_id,
|
||||
unified_code: payment_attempt.unified_code,
|
||||
unified_message: payment_attempt.unified_message,
|
||||
};
|
||||
payment_attempts.push(payment_attempt.clone());
|
||||
Ok(payment_attempt)
|
||||
|
||||
@@ -364,6 +364,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
|
||||
authentication_data: payment_attempt.authentication_data.clone(),
|
||||
encoded_data: payment_attempt.encoded_data.clone(),
|
||||
merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
|
||||
unified_code: payment_attempt.unified_code.clone(),
|
||||
unified_message: payment_attempt.unified_message.clone(),
|
||||
};
|
||||
|
||||
let field = format!("pa_{}", created_attempt.attempt_id);
|
||||
@@ -966,6 +968,8 @@ impl DataModelExt for PaymentAttempt {
|
||||
authentication_data: self.authentication_data,
|
||||
encoded_data: self.encoded_data,
|
||||
merchant_connector_id: self.merchant_connector_id,
|
||||
unified_code: self.unified_code,
|
||||
unified_message: self.unified_message,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1018,6 +1022,8 @@ impl DataModelExt for PaymentAttempt {
|
||||
authentication_data: storage_model.authentication_data,
|
||||
encoded_data: storage_model.encoded_data,
|
||||
merchant_connector_id: storage_model.merchant_connector_id,
|
||||
unified_code: storage_model.unified_code,
|
||||
unified_message: storage_model.unified_message,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1070,6 +1076,8 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
authentication_data: self.authentication_data,
|
||||
encoded_data: self.encoded_data,
|
||||
merchant_connector_id: self.merchant_connector_id,
|
||||
unified_code: self.unified_code,
|
||||
unified_message: self.unified_message,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1120,6 +1128,8 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
authentication_data: storage_model.authentication_data,
|
||||
encoded_data: storage_model.encoded_data,
|
||||
merchant_connector_id: storage_model.merchant_connector_id,
|
||||
unified_code: storage_model.unified_code,
|
||||
unified_message: storage_model.unified_message,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1255,6 +1265,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
tax_amount,
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} => DieselPaymentAttemptUpdate::ResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@@ -1274,6 +1286,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
tax_amount,
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code,
|
||||
unified_message,
|
||||
},
|
||||
Self::UnresolvedResponseUpdate {
|
||||
status,
|
||||
@@ -1307,6 +1321,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} => DieselPaymentAttemptUpdate::ErrorUpdate {
|
||||
connector,
|
||||
status,
|
||||
@@ -1315,6 +1331,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
unified_code,
|
||||
unified_message,
|
||||
},
|
||||
Self::MultipleCaptureCountUpdate {
|
||||
multiple_capture_count,
|
||||
@@ -1504,6 +1522,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
tax_amount,
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} => Self::ResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@@ -1523,6 +1543,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
tax_amount,
|
||||
authentication_data,
|
||||
encoded_data,
|
||||
unified_code,
|
||||
unified_message,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::UnresolvedResponseUpdate {
|
||||
status,
|
||||
@@ -1556,6 +1578,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
unified_code,
|
||||
unified_message,
|
||||
} => Self::ErrorUpdate {
|
||||
connector,
|
||||
status,
|
||||
@@ -1564,6 +1588,8 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
unified_code,
|
||||
unified_message,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::MultipleCaptureCountUpdate {
|
||||
multiple_capture_count,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE gateway_status_map DROP COLUMN IF EXISTS unified_code;
|
||||
ALTER TABLE gateway_status_map DROP COLUMN IF EXISTS unified_message;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE gateway_status_map ADD COLUMN IF NOT EXISTS unified_code VARCHAR(255);
|
||||
ALTER TABLE gateway_status_map ADD COLUMN IF NOT EXISTS unified_message VARCHAR(1024);
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS unified_code;
|
||||
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS unified_message;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS unified_code VARCHAR(255);
|
||||
ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS unified_message VARCHAR(1024);
|
||||
@@ -5934,6 +5934,14 @@
|
||||
},
|
||||
"step_up_possible": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"unified_code": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_message": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -6039,6 +6047,14 @@
|
||||
},
|
||||
"step_up_possible": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"unified_code": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_message": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -6113,6 +6129,14 @@
|
||||
"step_up_possible": {
|
||||
"type": "boolean",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_code": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_message": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -8155,6 +8179,16 @@
|
||||
"description": "reference to the payment at connector side",
|
||||
"example": "993672945374576J",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_code": {
|
||||
"type": "string",
|
||||
"description": "error code unified across the connectors is received here if there was an error while calling connector",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_message": {
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors is received here if there was an error while calling connector",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -10041,6 +10075,16 @@
|
||||
"example": "Failed while verifying the card",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_code": {
|
||||
"type": "string",
|
||||
"description": "error code unified across the connectors is received here if there was an error while calling connector",
|
||||
"nullable": true
|
||||
},
|
||||
"unified_message": {
|
||||
"type": "string",
|
||||
"description": "error message unified across the connectors is received here if there was an error while calling connector",
|
||||
"nullable": true
|
||||
},
|
||||
"payment_experience": {
|
||||
"allOf": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user