Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(router): add unified_code, unified_message in payments response (#2918)
Sai Harsha Vardhan39540015fde4
diff --git a/crates/api_models/src/gsm.rs b/crates/api_models/src/gsm.rsindex 254981b1f8..81798d0517 100644--- a/crates/api_models/src/gsm.rs+++ b/crates/api_models/src/gsm.rs@@ -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>,}diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex b479f4442b..9f4f151c22 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -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>,diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rsindex 88fc7b3b52..1b43177feb 100644--- a/crates/data_models/src/payments/payment_attempt.rs+++ b/crates/data_models/src/payments/payment_attempt.rs@@ -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,diff --git a/crates/diesel_models/src/gsm.rs b/crates/diesel_models/src/gsm.rsindex 2e824758aa..39bd880cd6 100644--- a/crates/diesel_models/src/gsm.rs+++ b/crates/diesel_models/src/gsm.rs@@ -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()}}diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex cd976b9e19..bb8f2b60bb 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -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 {diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 190a123185..ce974e409a 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -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>,}}diff --git a/crates/router/src/core/gsm.rs b/crates/router/src/core/gsm.rsindex ed72275a73..611a35d636 100644--- a/crates/router/src/core/gsm.rs+++ b/crates/router/src/core/gsm.rs@@ -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,},).awaitdiff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex fb74006a06..ae729ff8fa 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -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()+}diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rsindex 1cfc37efa4..083d1bb030 100644--- a/crates/router/src/core/payments/operations/payment_response.rs+++ b/crates/router/src/core/payments/operations/payment_response.rs@@ -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 flowif 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_datadiff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rsindex 788e83b05e..3c0106206e 100644--- a/crates/router/src/core/payments/retry.rs+++ b/crates/router/src/core/payments/retry.rs@@ -55,7 +55,7 @@ wheremetrics::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 enabledlet step_up_possible = initial_gsm@@ -99,7 +99,7 @@ where// Use initial_gsm for first time alonelet 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 @@ whereupdated_by: storage_scheme.to_string(),authentication_data,encoded_data,+ unified_code: None,+ unified_message: None,},storage_scheme,)@@ -427,17 +399,20 @@ wherelogger::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,)diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 6c6b4ae933..f395c02312 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -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 @@ whereattempt_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,diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 2b7ea86cf5..b73ba0964f 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -878,6 +878,8 @@ impl ForeignFrom<storage::PaymentAttempt> for api_models::payments::PaymentAttempayment_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::GatewayStatusMappstatus: 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,}}}diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rsindex 00e7357d89..43e327559a 100644--- a/crates/router/src/workflows/payment_sync.rs+++ b/crates/router/src/workflows/payment_sync.rs@@ -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 = dbdiff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rsindex cb2f81daa7..fe244b1032 100644--- a/crates/storage_impl/src/mock_db/payment_attempt.rs+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs@@ -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)diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rsindex 3d00e2f2bf..cb74c981ea 100644--- a/crates/storage_impl/src/payments/payment_attempt.rs+++ b/crates/storage_impl/src/payments/payment_attempt.rs@@ -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,diff --git a/migrations/2023-11-17-061003_add-unified-error-code-mssg-gsm/down.sql b/migrations/2023-11-17-061003_add-unified-error-code-mssg-gsm/down.sqlnew file mode 100644index 0000000000..9561c8509b--- /dev/null+++ b/migrations/2023-11-17-061003_add-unified-error-code-mssg-gsm/down.sql@@ -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;\ No newline at end of filediff --git a/migrations/2023-11-17-061003_add-unified-error-code-mssg-gsm/up.sql b/migrations/2023-11-17-061003_add-unified-error-code-mssg-gsm/up.sqlnew file mode 100644index 0000000000..a4b1250a03--- /dev/null+++ b/migrations/2023-11-17-061003_add-unified-error-code-mssg-gsm/up.sql@@ -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);\ No newline at end of filediff --git a/migrations/2023-11-17-084413_add-unified-error-code-mssg-payment-attempt/down.sql b/migrations/2023-11-17-084413_add-unified-error-code-mssg-payment-attempt/down.sqlnew file mode 100644index 0000000000..83609093e1--- /dev/null+++ b/migrations/2023-11-17-084413_add-unified-error-code-mssg-payment-attempt/down.sql@@ -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;\ No newline at end of filediff --git a/migrations/2023-11-17-084413_add-unified-error-code-mssg-payment-attempt/up.sql b/migrations/2023-11-17-084413_add-unified-error-code-mssg-payment-attempt/up.sqlnew file mode 100644index 0000000000..5e390d51f7--- /dev/null+++ b/migrations/2023-11-17-084413_add-unified-error-code-mssg-payment-attempt/up.sql@@ -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);\ No newline at end of filediff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.jsonindex 7d94f13dd1..65280c1871 100644--- a/openapi/openapi_spec.json+++ b/openapi/openapi_spec.json@@ -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": [{