diff --git a/connector-template/transformers.rs b/connector-template/transformers.rs index d86c74856f..af285b6183 100644 --- a/connector-template/transformers.rs +++ b/connector-template/transformers.rs @@ -98,6 +98,7 @@ impl TryFrom)] pub feature_metadata: Option, // This is Value because it is fetched from DB and before putting in DB the type is validated + + /// reference to the payment at connector side + #[schema(value_type = Option, example = "993672945374576J")] + pub reference_id: Option, } #[derive(Clone, Debug, serde::Deserialize, ToSchema)] diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs index b238d26183..06e47a6fe3 100644 --- a/crates/diesel_models/src/payment_attempt.rs +++ b/crates/diesel_models/src/payment_attempt.rs @@ -53,6 +53,8 @@ pub struct PaymentAttempt { // providing a location to store mandate details intermediately for transaction pub mandate_details: Option, pub error_reason: Option, + // reference to the payment at connector side + pub connector_response_reference_id: Option, } #[derive(Clone, Debug, Eq, PartialEq, Queryable, Serialize, Deserialize)] @@ -109,6 +111,7 @@ pub struct PaymentAttemptNew { pub preprocessing_step_id: Option, pub mandate_details: Option, pub error_reason: Option, + pub connector_response_reference_id: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -166,6 +169,7 @@ pub enum PaymentAttemptUpdate { error_code: Option>, error_message: Option>, error_reason: Option>, + connector_response_reference_id: Option, }, UnresolvedResponseUpdate { status: storage_enums::AttemptStatus, @@ -175,6 +179,7 @@ pub enum PaymentAttemptUpdate { error_code: Option>, error_message: Option>, error_reason: Option>, + connector_response_reference_id: Option, }, StatusUpdate { status: storage_enums::AttemptStatus, @@ -192,6 +197,7 @@ pub enum PaymentAttemptUpdate { connector_metadata: Option, preprocessing_step_id: Option, connector_transaction_id: Option, + connector_response_reference_id: Option, }, } @@ -223,6 +229,7 @@ pub struct PaymentAttemptUpdateInternal { preprocessing_step_id: Option, error_reason: Option>, capture_method: Option, + connector_response_reference_id: Option, } impl PaymentAttemptUpdate { @@ -346,6 +353,7 @@ impl From for PaymentAttemptUpdateInternal { error_code, error_message, error_reason, + connector_response_reference_id, } => Self { status: Some(status), connector, @@ -359,6 +367,7 @@ impl From for PaymentAttemptUpdateInternal { error_message, payment_token, error_reason, + connector_response_reference_id, ..Default::default() }, PaymentAttemptUpdate::ErrorUpdate { @@ -398,6 +407,7 @@ impl From for PaymentAttemptUpdateInternal { error_code, error_message, error_reason, + connector_response_reference_id, } => Self { status: Some(status), connector, @@ -407,6 +417,7 @@ impl From for PaymentAttemptUpdateInternal { error_code, error_message, error_reason, + connector_response_reference_id, ..Default::default() }, PaymentAttemptUpdate::PreprocessingUpdate { @@ -415,6 +426,7 @@ impl From for PaymentAttemptUpdateInternal { connector_metadata, preprocessing_step_id, connector_transaction_id, + connector_response_reference_id, } => Self { status: Some(status), payment_method_id, @@ -422,6 +434,7 @@ impl From for PaymentAttemptUpdateInternal { connector_metadata, preprocessing_step_id, connector_transaction_id, + connector_response_reference_id, ..Default::default() }, } diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 2177eb286a..254399ee8c 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -430,6 +430,8 @@ diesel::table! { preprocessing_step_id -> Nullable, mandate_details -> Nullable, error_reason -> Nullable, + #[max_length = 128] + connector_response_reference_id -> Nullable, } } diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs index 3ea0bce92e..2478179bc1 100644 --- a/crates/router/src/connector/aci/transformers.rs +++ b/crates/router/src/connector/aci/transformers.rs @@ -674,6 +674,7 @@ impl mandate_reference, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index f492999089..97fdee30f2 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -1645,6 +1645,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -1697,6 +1698,7 @@ pub fn get_adyen_response( mandate_reference, connector_metadata: None, network_txn_id, + connector_response_reference_id: None, }; Ok((status, error, payments_response_data)) } @@ -1751,6 +1753,7 @@ pub fn get_redirection_response( mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }; Ok((status, error, payments_response_data)) } @@ -1838,6 +1841,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: Some(item.response.amount.value), ..item.data diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rs index 2647cacb11..f05e242a7c 100644 --- a/crates/router/src/connector/airwallex/transformers.rs +++ b/crates/router/src/connector/airwallex/transformers.rs @@ -443,6 +443,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index 9655c5ae43..7e79141a6e 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -483,6 +483,7 @@ impl mandate_reference: None, connector_metadata: metadata, network_txn_id: transaction_response.network_trans_id.clone(), + connector_response_reference_id: None, }), }, ..item.data @@ -546,6 +547,7 @@ impl mandate_reference: None, connector_metadata: metadata, network_txn_id: transaction_response.network_trans_id.clone(), + connector_response_reference_id: None, }), }, ..item.data @@ -831,6 +833,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), status: payment_status, ..item.data diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rs index bd87993046..61e3366c3d 100644 --- a/crates/router/src/connector/bambora/transformers.rs +++ b/crates/router/src/connector/bambora/transformers.rs @@ -212,6 +212,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }), @@ -235,6 +236,7 @@ impl .change_context(errors::ConnectorError::ResponseHandlingFailed)?, ), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/bitpay/transformers.rs b/crates/router/src/connector/bitpay/transformers.rs index 2d420cbd28..febafdf430 100644 --- a/crates/router/src/connector/bitpay/transformers.rs +++ b/crates/router/src/connector/bitpay/transformers.rs @@ -138,6 +138,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rs index bfaa56e7a3..2e87e37daf 100644 --- a/crates/router/src/connector/bluesnap.rs +++ b/crates/router/src/connector/bluesnap.rs @@ -677,6 +677,7 @@ impl ConnectorIntegration ))?, response: Ok(types::PaymentsResponseData::TransactionResponse { resource_id: types::ResponseId::ConnectorTransactionId( - item.response.transaction_id, + item.response.transaction_id.clone(), ), redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: Some(item.response.transaction_id), }), ..item.data }) diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs index ce1fa2262a..57d8755b2d 100644 --- a/crates/router/src/connector/braintree/transformers.rs +++ b/crates/router/src/connector/braintree/transformers.rs @@ -220,6 +220,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/cashtocode/transformers.rs b/crates/router/src/connector/cashtocode/transformers.rs index 30795ca5fb..e8bfe75224 100644 --- a/crates/router/src/connector/cashtocode/transformers.rs +++ b/crates/router/src/connector/cashtocode/transformers.rs @@ -160,6 +160,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -195,6 +196,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs index a8909cca66..1f246d2657 100644 --- a/crates/router/src/connector/checkout/transformers.rs +++ b/crates/router/src/connector/checkout/transformers.rs @@ -352,6 +352,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -380,6 +381,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -423,6 +425,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), status: response.into(), ..item.data @@ -495,6 +498,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), status, amount_captured, diff --git a/crates/router/src/connector/coinbase/transformers.rs b/crates/router/src/connector/coinbase/transformers.rs index 9f81dd5254..c13a0b1782 100644 --- a/crates/router/src/connector/coinbase/transformers.rs +++ b/crates/router/src/connector/coinbase/transformers.rs @@ -145,6 +145,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), |context| { Ok(types::PaymentsResponseData::TransactionUnresolvedResponse{ @@ -153,7 +154,8 @@ impl code: context.to_string(), message: "Please check the transaction in coinbase dashboard and resolve manually" .to_string(), - }) + }), + connector_response_reference_id: None, }) }, ); diff --git a/crates/router/src/connector/cryptopay/transformers.rs b/crates/router/src/connector/cryptopay/transformers.rs index 25bcdfdc31..a998b9c04a 100644 --- a/crates/router/src/connector/cryptopay/transformers.rs +++ b/crates/router/src/connector/cryptopay/transformers.rs @@ -114,6 +114,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index adf80f5773..48b2c98c48 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -318,6 +318,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), }, ..item.data @@ -382,6 +383,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/dlocal/transformers.rs b/crates/router/src/connector/dlocal/transformers.rs index 19cd3844e9..e49307fb1b 100644 --- a/crates/router/src/connector/dlocal/transformers.rs +++ b/crates/router/src/connector/dlocal/transformers.rs @@ -274,6 +274,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }; Ok(Self { status: enums::AttemptStatus::from(item.response.status), @@ -311,6 +312,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -345,6 +347,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -378,6 +381,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/dummyconnector/transformers.rs b/crates/router/src/connector/dummyconnector/transformers.rs index fb9a8491ce..a99a046773 100644 --- a/crates/router/src/connector/dummyconnector/transformers.rs +++ b/crates/router/src/connector/dummyconnector/transformers.rs @@ -116,6 +116,7 @@ impl TryFrom mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -349,6 +350,7 @@ impl TryFrom auth_id: item.response.authorization_code, })), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -307,6 +308,7 @@ impl auth_id: item.response.authorization_code, })), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -374,6 +376,7 @@ impl TryFrom> auth_id: item.response.authorization_code, })), network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: None, ..item.data @@ -440,6 +443,7 @@ impl auth_id: item.response.authorization_code, })), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/globalpay/transformers.rs b/crates/router/src/connector/globalpay/transformers.rs index 1bbe8deb18..48c6d9c7cc 100644 --- a/crates/router/src/connector/globalpay/transformers.rs +++ b/crates/router/src/connector/globalpay/transformers.rs @@ -220,6 +220,7 @@ fn get_payment_response( mandate_reference, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), } } diff --git a/crates/router/src/connector/globepay/transformers.rs b/crates/router/src/connector/globepay/transformers.rs index ac615bb5a9..eb7f4ed372 100644 --- a/crates/router/src/connector/globepay/transformers.rs +++ b/crates/router/src/connector/globepay/transformers.rs @@ -108,6 +108,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs index 2a9361e579..80d7d8f0f6 100644 --- a/crates/router/src/connector/iatapay/transformers.rs +++ b/crates/router/src/connector/iatapay/transformers.rs @@ -216,6 +216,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), |checkout_methods| { Ok(types::PaymentsResponseData::TransactionResponse { @@ -228,6 +229,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }) }, ), diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rs index 3e4f3869e7..01fe952f8f 100644 --- a/crates/router/src/connector/klarna/transformers.rs +++ b/crates/router/src/connector/klarna/transformers.rs @@ -127,6 +127,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), status: item.response.fraud_status.into(), ..item.data diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs index f8f8e51002..8213b2729d 100644 --- a/crates/router/src/connector/mollie/transformers.rs +++ b/crates/router/src/connector/mollie/transformers.rs @@ -377,6 +377,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs index 4043064ba9..44598d0024 100644 --- a/crates/router/src/connector/multisafepay/transformers.rs +++ b/crates/router/src/connector/multisafepay/transformers.rs @@ -533,6 +533,7 @@ impl }), connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/nexinets/transformers.rs b/crates/router/src/connector/nexinets/transformers.rs index c26df486cc..e4e74a2dc4 100644 --- a/crates/router/src/connector/nexinets/transformers.rs +++ b/crates/router/src/connector/nexinets/transformers.rs @@ -364,6 +364,7 @@ impl mandate_reference, connector_metadata: Some(connector_metadata), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -446,6 +447,7 @@ impl mandate_reference: None, connector_metadata: Some(connector_metadata), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs index 645057b27e..65e299cbed 100644 --- a/crates/router/src/connector/nmi/transformers.rs +++ b/crates/router/src/connector/nmi/transformers.rs @@ -248,6 +248,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), enums::AttemptStatus::CaptureInitiated, ), @@ -335,6 +336,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), enums::AttemptStatus::Charged, ), @@ -387,6 +389,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), if let Some(diesel_models::enums::CaptureMethod::Automatic) = item.data.request.capture_method @@ -435,6 +438,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), enums::AttemptStatus::VoidInitiated, ), @@ -485,6 +489,7 @@ impl TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index d9e6ce5b63..9cb7cfdabb 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -342,6 +342,7 @@ impl mandate_reference, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), }, ..item.data diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs index 5b97a522e7..b6f89bb1db 100644 --- a/crates/router/src/connector/nuvei/transformers.rs +++ b/crates/router/src/connector/nuvei/transformers.rs @@ -1249,6 +1249,7 @@ where None }, network_txn_id: None, + connector_response_reference_id: None, }) }, ..item.data diff --git a/crates/router/src/connector/opayo/transformers.rs b/crates/router/src/connector/opayo/transformers.rs index b5613619c1..1dd06b46d3 100644 --- a/crates/router/src/connector/opayo/transformers.rs +++ b/crates/router/src/connector/opayo/transformers.rs @@ -104,6 +104,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/opennode/transformers.rs b/crates/router/src/connector/opennode/transformers.rs index d398022a63..8885b85cae 100644 --- a/crates/router/src/connector/opennode/transformers.rs +++ b/crates/router/src/connector/opennode/transformers.rs @@ -113,6 +113,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }) } else { Ok(types::PaymentsResponseData::TransactionUnresolvedResponse { @@ -123,6 +124,7 @@ impl "Please check the transaction in opennode dashboard and resolve manually" .to_string(), }), + connector_response_reference_id: None, }) }; Ok(Self { diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs index 91faf5b53c..3db71421fc 100644 --- a/crates/router/src/connector/payeezy/transformers.rs +++ b/crates/router/src/connector/payeezy/transformers.rs @@ -361,6 +361,7 @@ impl mandate_reference, connector_metadata: metadata, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs index e7078dea62..5f87af07c8 100644 --- a/crates/router/src/connector/payme/transformers.rs +++ b/crates/router/src/connector/payme/transformers.rs @@ -90,6 +90,7 @@ impl .change_context(errors::ConnectorError::ResponseHandlingFailed)?, ), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -328,6 +329,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index 8ae25f13be..2639b04e49 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -389,6 +389,7 @@ impl mandate_reference: None, connector_metadata: Some(connector_meta), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -438,6 +439,7 @@ impl mandate_reference: None, connector_metadata: Some(connector_meta), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -466,6 +468,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -554,6 +557,7 @@ impl TryFrom> psync_flow: PaypalPaymentIntent::Capture })), network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: Some(amount_captured), ..item.data @@ -600,6 +604,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/payu/transformers.rs b/crates/router/src/connector/payu/transformers.rs index d141a01843..8308985ea7 100644 --- a/crates/router/src/connector/payu/transformers.rs +++ b/crates/router/src/connector/payu/transformers.rs @@ -199,6 +199,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: None, ..item.data @@ -250,6 +251,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: None, ..item.data @@ -329,6 +331,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: None, ..item.data @@ -458,6 +461,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), amount_captured: Some( order diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rs index 379e7aa157..6ce06d446b 100644 --- a/crates/router/src/connector/powertranz/transformers.rs +++ b/crates/router/src/connector/powertranz/transformers.rs @@ -114,6 +114,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/router/src/connector/rapyd/transformers.rs index 7982340ed8..04264266c2 100644 --- a/crates/router/src/connector/rapyd/transformers.rs +++ b/crates/router/src/connector/rapyd/transformers.rs @@ -443,6 +443,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ) } diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rs index 8c29cff241..39d9ddb49d 100644 --- a/crates/router/src/connector/shift4/transformers.rs +++ b/crates/router/src/connector/shift4/transformers.rs @@ -479,6 +479,7 @@ impl .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, ), network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) @@ -518,6 +519,7 @@ impl mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index 2aa16c2d10..845f3b4c35 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -1692,6 +1692,7 @@ impl mandate_reference, connector_metadata, network_txn_id, + connector_response_reference_id: None, }), amount_captured: item.response.amount_received, ..item.data @@ -1795,6 +1796,7 @@ impl mandate_reference, connector_metadata, network_txn_id: None, + connector_response_reference_id: None, }), Err, ); @@ -1835,6 +1837,7 @@ impl mandate_reference, connector_metadata: None, network_txn_id: Option::foreign_from(item.response.latest_attempt), + connector_response_reference_id: None, }), ..item.data }) @@ -2271,6 +2274,7 @@ impl ), connector_metadata: Some(connector_metadata), session_token: None, + connector_response_reference_id: None, }), status, ..item.data @@ -2312,6 +2316,7 @@ impl TryFrom( }, }, ))), + connector_response_reference_id: None, }), // We don't get status from TrustPay but status should be pending by default for session response status: diesel_models::enums::AttemptStatus::Pending, @@ -1089,6 +1095,7 @@ pub fn get_google_pay_session( }, ), ))), + connector_response_reference_id: None, }), // We don't get status from TrustPay but status should be pending by default for session response status: diesel_models::enums::AttemptStatus::Pending, diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs index 93a9ae8b3b..a347537b23 100644 --- a/crates/router/src/connector/worldline/transformers.rs +++ b/crates/router/src/connector/worldline/transformers.rs @@ -506,6 +506,7 @@ impl TryFrom TryFrom> mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }), ..item.data }) diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs index d288405d38..8bb8156a93 100644 --- a/crates/router/src/connector/zen/transformers.rs +++ b/crates/router/src/connector/zen/transformers.rs @@ -587,6 +587,7 @@ impl TryFrom TryFrom( types::PaymentsResponseData::PreProcessingResponse { pre_processing_id, connector_metadata, + connector_response_reference_id, .. } => { let connector_transaction_id = match pre_processing_id.to_owned() { @@ -335,6 +336,7 @@ async fn payment_response_update_tracker( connector_metadata, preprocessing_step_id, connector_transaction_id, + connector_response_reference_id, }; (Some(payment_attempt_update), None) @@ -343,6 +345,7 @@ async fn payment_response_update_tracker( resource_id, redirection_data, connector_metadata, + connector_response_reference_id, .. } => { let connector_transaction_id = match resource_id { @@ -386,6 +389,7 @@ async fn payment_response_update_tracker( error_code: error_status.clone(), error_message: error_status.clone(), error_reason: error_status, + connector_response_reference_id, }; let connector_response_update = storage::ConnectorResponseUpdate::ResponseUpdate { @@ -403,6 +407,7 @@ async fn payment_response_update_tracker( types::PaymentsResponseData::TransactionUnresolvedResponse { resource_id, reason, + connector_response_reference_id, } => { let connector_transaction_id = match resource_id { types::ResponseId::NoResponseId => None, @@ -418,6 +423,7 @@ async fn payment_response_update_tracker( error_code: Some(reason.clone().map(|cd| cd.code)), error_message: Some(reason.clone().map(|cd| cd.message)), error_reason: Some(reason.map(|cd| cd.message)), + connector_response_reference_id, }), None, ) diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 76294a90b0..04acb811e4 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -85,6 +85,7 @@ where mandate_reference: None, connector_metadata: None, network_txn_id: None, + connector_response_reference_id: None, }); let additional_data = PaymentAdditionalData { @@ -471,6 +472,7 @@ where .set_connector_transaction_id(payment_attempt.connector_transaction_id) .set_feature_metadata(payment_intent.feature_metadata) .set_connector_metadata(payment_intent.connector_metadata) + .set_reference_id(payment_attempt.connector_response_reference_id) .to_owned(), ) } @@ -522,6 +524,7 @@ where feature_metadata: payment_intent.feature_metadata, connector_metadata: payment_intent.connector_metadata, allowed_payment_method_types: payment_intent.allowed_payment_method_types, + reference_id: payment_attempt.connector_response_reference_id, ..Default::default() }), }); diff --git a/crates/router/src/db/payment_attempt.rs b/crates/router/src/db/payment_attempt.rs index 33df772862..cf66c6da30 100644 --- a/crates/router/src/db/payment_attempt.rs +++ b/crates/router/src/db/payment_attempt.rs @@ -335,6 +335,7 @@ impl PaymentAttemptInterface for MockDb { mandate_details: payment_attempt.mandate_details, preprocessing_step_id: payment_attempt.preprocessing_step_id, error_reason: payment_attempt.error_reason, + connector_response_reference_id: None, }; payment_attempts.push(payment_attempt.clone()); Ok(payment_attempt) @@ -473,6 +474,7 @@ mod storage { mandate_details: payment_attempt.mandate_details.clone(), preprocessing_step_id: payment_attempt.preprocessing_step_id.clone(), error_reason: payment_attempt.error_reason.clone(), + connector_response_reference_id: None, }; let field = format!("pa_{}", created_attempt.attempt_id); diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index 6658de93cb..c4c29c95d1 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -408,6 +408,7 @@ pub enum PaymentsResponseData { mandate_reference: Option, connector_metadata: Option, network_txn_id: Option, + connector_response_reference_id: Option, }, SessionResponse { session_token: api::SessionToken, @@ -419,6 +420,7 @@ pub enum PaymentsResponseData { resource_id: ResponseId, //to add more info on cypto response, like `unresolved` reason(overpaid, underpaid, delayed) reason: Option, + connector_response_reference_id: Option, }, TokenizationResponse { token: String, @@ -436,6 +438,7 @@ pub enum PaymentsResponseData { pre_processing_id: PreprocessingResponseId, connector_metadata: Option, session_token: Option, + connector_response_reference_id: Option, }, } diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs index e02dab5c62..43b43e4ee4 100644 --- a/crates/router/tests/connectors/utils.rs +++ b/crates/router/tests/connectors/utils.rs @@ -630,6 +630,7 @@ pub fn get_connector_metadata( mandate_reference: _, connector_metadata, network_txn_id: _, + connector_response_reference_id: _, }) => connector_metadata, _ => None, } diff --git a/migrations/2023-07-08-134807_add_connector_response_reference_id_in_payment_intent/down.sql b/migrations/2023-07-08-134807_add_connector_response_reference_id_in_payment_intent/down.sql new file mode 100644 index 0000000000..6d3f3204af --- /dev/null +++ b/migrations/2023-07-08-134807_add_connector_response_reference_id_in_payment_intent/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE payment_attempt DROP COLUMN IF EXISTS connector_response_reference_id; diff --git a/migrations/2023-07-08-134807_add_connector_response_reference_id_in_payment_intent/up.sql b/migrations/2023-07-08-134807_add_connector_response_reference_id_in_payment_intent/up.sql new file mode 100644 index 0000000000..47ce7722eb --- /dev/null +++ b/migrations/2023-07-08-134807_add_connector_response_reference_id_in_payment_intent/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS connector_response_reference_id VARCHAR(128); \ No newline at end of file diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 7ce3fe1dfd..1aba2fd9b3 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -7643,6 +7643,12 @@ } ], "nullable": true + }, + "reference_id": { + "type": "string", + "description": "reference to the payment at connector side", + "example": "993672945374576J", + "nullable": true } } },