From f4665d2f4a46a7beec96183db347ea7265cb881c Mon Sep 17 00:00:00 2001 From: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com> Date: Thu, 4 Jul 2024 18:15:05 +0530 Subject: [PATCH] feat(core): add merchant order reference id (#5197) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- api-reference/openapi_spec.json | 42 +++++++++++++++++++ crates/api_models/src/payments.rs | 20 +++++++++ crates/diesel_models/src/payment_intent.rs | 9 ++++ crates/diesel_models/src/schema.rs | 2 + .../hyperswitch_domain_models/src/payments.rs | 1 + .../src/payments/payment_attempt.rs | 3 ++ .../src/payments/payment_intent.rs | 8 ++++ .../src/router_request_types.rs | 5 +++ .../src/connector/adyen/transformers.rs | 11 +++++ .../src/connector/klarna/transformers.rs | 2 + .../src/connector/paypal/transformers.rs | 2 +- crates/router/src/core/payments/helpers.rs | 3 ++ .../payments/operations/payment_confirm.rs | 1 + .../payments/operations/payment_create.rs | 1 + .../payments/operations/payment_update.rs | 11 +++++ .../router/src/core/payments/transformers.rs | 7 ++++ crates/router/src/types.rs | 1 + .../router/src/types/api/verify_connector.rs | 1 + crates/router/src/utils/user/sample_data.rs | 1 + crates/router/tests/connectors/utils.rs | 1 + .../down.sql | 2 + .../up.sql | 2 + 22 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 migrations/2024-07-03-182616_add_merchant_order_reference_id/down.sql create mode 100644 migrations/2024-07-03-182616_add_merchant_order_reference_id/up.sql diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index cbad4558da..67fc843474 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -15051,6 +15051,13 @@ } ], "nullable": true + }, + "merchant_order_reference_id": { + "type": "string", + "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.", + "example": "Custom_Order_id_123", + "nullable": true, + "maxLength": 255 } } }, @@ -15402,6 +15409,13 @@ } ], "nullable": true + }, + "merchant_order_reference_id": { + "type": "string", + "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.", + "example": "Custom_Order_id_123", + "nullable": true, + "maxLength": 255 } } }, @@ -15921,6 +15935,13 @@ "type": "object", "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. FRM Metadata is useful for storing additional, structured information on an object related to FRM.", "nullable": true + }, + "merchant_order_reference_id": { + "type": "string", + "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.", + "example": "Custom_Order_id_123", + "nullable": true, + "maxLength": 255 } } }, @@ -16447,6 +16468,13 @@ } ], "nullable": true + }, + "merchant_order_reference_id": { + "type": "string", + "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.", + "example": "Custom_Order_id_123", + "nullable": true, + "maxLength": 255 } }, "additionalProperties": false @@ -16985,6 +17013,13 @@ "type": "object", "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. FRM Metadata is useful for storing additional, structured information on an object related to FRM.", "nullable": true + }, + "merchant_order_reference_id": { + "type": "string", + "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.", + "example": "Custom_Order_id_123", + "nullable": true, + "maxLength": 255 } } }, @@ -17455,6 +17490,13 @@ } ], "nullable": true + }, + "merchant_order_reference_id": { + "type": "string", + "description": "Merchant's identifier for the payment/invoice. This will be sent to the connector\nif the connector provides support to accept multiple reference ids.\nIn case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference.", + "example": "Custom_Order_id_123", + "nullable": true, + "maxLength": 255 } } }, diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index d8321524a1..673a5cdae4 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -506,6 +506,16 @@ pub struct PaymentsRequest { /// Fee information to be charged on the payment being collected pub charges: Option, + + /// Merchant's identifier for the payment/invoice. This will be sent to the connector + /// if the connector provides support to accept multiple reference ids. + /// In case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference. + #[schema( + value_type = Option, + max_length = 255, + example = "Custom_Order_id_123" + )] + pub merchant_order_reference_id: Option, } /// Fee information to be charged on the payment being collected @@ -3623,6 +3633,16 @@ pub struct PaymentsResponse { /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. FRM Metadata is useful for storing additional, structured information on an object related to FRM. #[schema(value_type = Option, example = r#"{ "fulfillment_method" : "deliver", "coverage_request" : "fraud" }"#)] pub frm_metadata: Option, + + /// Merchant's identifier for the payment/invoice. This will be sent to the connector + /// if the connector provides support to accept multiple reference ids. + /// In case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference. + #[schema( + value_type = Option, + max_length = 255, + example = "Custom_Order_id_123" + )] + pub merchant_order_reference_id: Option, } /// Fee information to be charged on the payment being collected diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs index fa37eecdbf..bc480c497e 100644 --- a/crates/diesel_models/src/payment_intent.rs +++ b/crates/diesel_models/src/payment_intent.rs @@ -60,6 +60,7 @@ pub struct PaymentIntent { pub charges: Option, pub frm_metadata: Option, pub customer_details: Option, + pub merchant_order_reference_id: Option, } #[derive( @@ -116,6 +117,7 @@ pub struct PaymentIntentNew { pub charges: Option, pub frm_metadata: Option, pub customer_details: Option, + pub merchant_order_reference_id: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -175,6 +177,7 @@ pub enum PaymentIntentUpdate { request_external_three_ds_authentication: Option, frm_metadata: Option, customer_details: Option, + merchant_order_reference_id: Option, }, PaymentAttemptAndAttemptCountUpdate { active_attempt_id: String, @@ -251,6 +254,7 @@ pub struct PaymentIntentUpdateInternal { pub request_external_three_ds_authentication: Option, pub frm_metadata: Option, pub customer_details: Option, + pub merchant_order_reference_id: Option, } impl PaymentIntentUpdate { @@ -287,6 +291,7 @@ impl PaymentIntentUpdate { request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, } = self.into(); PaymentIntent { amount: amount.unwrap_or(source.amount), @@ -325,6 +330,8 @@ impl PaymentIntentUpdate { .or(source.request_external_three_ds_authentication), frm_metadata: frm_metadata.or(source.frm_metadata), customer_details: customer_details.or(source.customer_details), + merchant_order_reference_id: merchant_order_reference_id + .or(source.merchant_order_reference_id), ..source } } @@ -356,6 +363,7 @@ impl From for PaymentIntentUpdateInternal { request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, } => Self { amount: Some(amount), currency: Some(currency), @@ -380,6 +388,7 @@ impl From for PaymentIntentUpdateInternal { request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, ..Default::default() }, PaymentIntentUpdate::MetadataUpdate { diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 98f1b2fbbe..0b00e57a1c 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -890,6 +890,8 @@ diesel::table! { charges -> Nullable, frm_metadata -> Nullable, customer_details -> Nullable, + #[max_length = 255] + merchant_order_reference_id -> Nullable, } } diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs index f6e4f88879..0c22c70bc3 100644 --- a/crates/hyperswitch_domain_models/src/payments.rs +++ b/crates/hyperswitch_domain_models/src/payments.rs @@ -63,4 +63,5 @@ pub struct PaymentIntent { pub charges: Option, pub frm_metadata: Option, pub customer_details: Option>>, + pub merchant_order_reference_id: Option, } diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs index 1dca50e648..0173707661 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs @@ -530,6 +530,7 @@ impl behaviour::Conversion for PaymentIntent { charges: self.charges, frm_metadata: self.frm_metadata, customer_details: self.customer_details.map(Encryption::from), + merchant_order_reference_id: self.merchant_order_reference_id, }) } @@ -591,6 +592,7 @@ impl behaviour::Conversion for PaymentIntent { .customer_details .async_lift(inner_decrypt) .await?, + merchant_order_reference_id: storage_model.merchant_order_reference_id, }) } .await @@ -645,6 +647,7 @@ impl behaviour::Conversion for PaymentIntent { charges: self.charges, frm_metadata: self.frm_metadata, customer_details: self.customer_details.map(Encryption::from), + merchant_order_reference_id: self.merchant_order_reference_id, }) } } diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs index 30fd1061c7..fb824a8079 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs @@ -193,6 +193,7 @@ pub enum PaymentIntentUpdate { session_expiry: Option, request_external_three_ds_authentication: Option, customer_details: Option>>, + merchant_order_reference_id: Option, }, PaymentAttemptAndAttemptCountUpdate { active_attempt_id: String, @@ -270,6 +271,7 @@ pub struct PaymentIntentUpdateInternal { pub request_external_three_ds_authentication: Option, pub frm_metadata: Option, pub customer_details: Option>>, + pub merchant_order_reference_id: Option, } impl From for PaymentIntentUpdateInternal { @@ -298,6 +300,7 @@ impl From for PaymentIntentUpdateInternal { request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, } => Self { amount: Some(amount), currency: Some(currency), @@ -322,6 +325,7 @@ impl From for PaymentIntentUpdateInternal { request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, ..Default::default() }, PaymentIntentUpdate::MetadataUpdate { @@ -562,6 +566,7 @@ impl From for DieselPaymentIntentUpdate { request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, } => Self::Update { amount, currency, @@ -585,6 +590,7 @@ impl From for DieselPaymentIntentUpdate { request_external_three_ds_authentication, frm_metadata, customer_details: customer_details.map(Encryption::from), + merchant_order_reference_id, }, PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate { active_attempt_id, @@ -687,6 +693,7 @@ impl From for diesel_models::PaymentIntentUpdateInt request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, } = value; Self { @@ -721,6 +728,7 @@ impl From for diesel_models::PaymentIntentUpdateInt request_external_three_ds_authentication, frm_metadata, customer_details: customer_details.map(Encryption::from), + merchant_order_reference_id, } } } diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs index 8496827ff2..6d7e42eb1a 100644 --- a/crates/hyperswitch_domain_models/src/router_request_types.rs +++ b/crates/hyperswitch_domain_models/src/router_request_types.rs @@ -62,6 +62,11 @@ pub struct PaymentsAuthorizeData { // New amount for amount frame work pub minor_amount: MinorUnit, + + /// Merchant's identifier for the payment/invoice. This will be sent to the connector + /// if the connector provides support to accept multiple reference ids. + /// In case the connector supports only one reference id, Hyperswitch's Payment ID will be sent as reference. + pub merchant_order_reference_id: Option, pub integrity_object: Option, } diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 9778d6d33a..9a85522396 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -179,6 +179,7 @@ pub struct AdyenPaymentRequest<'a> { line_items: Option>, channel: Option, metadata: Option, + merchant_order_reference: Option, } #[derive(Debug, Serialize)] @@ -2610,6 +2611,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }) } } @@ -2672,6 +2674,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }) } } @@ -2725,6 +2728,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }; Ok(request) } @@ -2779,6 +2783,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }; Ok(request) } @@ -2829,6 +2834,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }; Ok(request) } @@ -2879,6 +2885,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }; Ok(request) } @@ -2939,6 +2946,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }) } } @@ -3034,6 +3042,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }) } } @@ -3109,6 +3118,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }) } } @@ -3167,6 +3177,7 @@ impl<'a> shopper_statement: item.router_data.request.statement_descriptor.clone(), shopper_ip: item.router_data.request.get_ip_address_as_optional(), metadata: item.router_data.request.metadata.clone(), + merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(), }) } } diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rs index ab3463e367..e6f0bab9c2 100644 --- a/crates/router/src/connector/klarna/transformers.rs +++ b/crates/router/src/connector/klarna/transformers.rs @@ -78,6 +78,7 @@ pub struct KlarnaPaymentsRequest { purchase_country: enums::CountryAlpha2, purchase_currency: enums::Currency, merchant_reference1: Option, + merchant_reference2: Option, shipping_address: Option, } @@ -213,6 +214,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsAuthorizeRouterData>> for KlarnaP }) .collect(), merchant_reference1: Some(item.router_data.connector_request_reference_id.clone()), + merchant_reference2: item.router_data.request.merchant_order_reference_id.clone(), auto_capture: request.is_auto_capture()?, shipping_address: get_address_info(item.router_data.get_optional_shipping()) .transpose()?, diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index 39ea808d61..7ec6b1c4af 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -397,7 +397,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP let purchase_units = vec![PurchaseUnitRequest { reference_id: Some(connector_request_reference_id.clone()), - custom_id: Some(connector_request_reference_id.clone()), + custom_id: item.router_data.request.merchant_order_reference_id.clone(), invoice_id: Some(connector_request_reference_id), amount, payee, diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index e59e5e6dd8..b63852e135 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -3136,6 +3136,7 @@ mod tests { charges: None, frm_metadata: None, customer_details: None, + merchant_order_reference_id: None, }; let req_cs = Some("1".to_string()); assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok()); @@ -3196,6 +3197,7 @@ mod tests { charges: None, frm_metadata: None, customer_details: None, + merchant_order_reference_id: None, }; let req_cs = Some("1".to_string()); assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err()) @@ -3255,6 +3257,7 @@ mod tests { charges: None, frm_metadata: None, customer_details: None, + merchant_order_reference_id: None, }; let req_cs = Some("1".to_string()); assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err()) diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs index 99ac4e3e97..003fa7c9d6 100644 --- a/crates/router/src/core/payments/operations/payment_confirm.rs +++ b/crates/router/src/core/payments/operations/payment_confirm.rs @@ -1262,6 +1262,7 @@ impl UpdateTracker, api::PaymentsRequest> for Paymen request_external_three_ds_authentication: None, frm_metadata: m_frm_metadata, customer_details, + merchant_order_reference_id: None, }, &m_key_store, storage_scheme, diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index fc1f53d358..b722fc6c65 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -1117,6 +1117,7 @@ impl PaymentCreate { charges, frm_metadata: request.frm_metadata.clone(), customer_details, + merchant_order_reference_id: request.merchant_order_reference_id.clone(), }) } diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index c9b778fae3..f93231fa05 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -372,6 +372,11 @@ impl GetTracker, api::PaymentsRequest> for Pa .request_external_three_ds_authentication .or(payment_intent.request_external_three_ds_authentication); + payment_intent.merchant_order_reference_id = request + .merchant_order_reference_id + .clone() + .or(payment_intent.merchant_order_reference_id); + Self::populate_payment_attempt_with_request(&mut payment_attempt, request); let creds_identifier = request @@ -707,6 +712,11 @@ impl UpdateTracker, api::PaymentsRequest> for Paymen let metadata = payment_data.payment_intent.metadata.clone(); let frm_metadata = payment_data.payment_intent.frm_metadata.clone(); let session_expiry = payment_data.payment_intent.session_expiry; + let merchant_order_reference_id = payment_data + .payment_intent + .merchant_order_reference_id + .clone(); + payment_data.payment_intent = state .store .update_payment_intent( @@ -736,6 +746,7 @@ impl UpdateTracker, api::PaymentsRequest> for Paymen .request_external_three_ds_authentication, frm_metadata, customer_details, + merchant_order_reference_id, }, key_store, storage_scheme, diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index abcb485971..aaf8e3b3a0 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -880,6 +880,7 @@ where .set_updated(Some(payment_intent.modified_at)) .set_charges(charges_response) .set_frm_metadata(payment_intent.frm_metadata) + .set_merchant_order_reference_id(payment_intent.merchant_order_reference_id) .to_owned(), headers, )) @@ -1305,6 +1306,11 @@ impl TryFrom> for types::PaymentsAuthoriz None => None, }; + let merchant_order_reference_id = payment_data + .payment_intent + .merchant_order_reference_id + .clone(); + Ok(Self { payment_method_data: From::from( payment_method_data.get_required_value("payment_method_data")?, @@ -1350,6 +1356,7 @@ impl TryFrom> for types::PaymentsAuthoriz .transpose()?, customer_acceptance: payment_data.customer_acceptance, charges, + merchant_order_reference_id, integrity_object: None, }) } diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index e6381e84b1..c457ca59df 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -789,6 +789,7 @@ impl ForeignFrom<&SetupMandateRouterData> for PaymentsAuthorizeData { authentication_data: None, customer_acceptance: data.request.customer_acceptance.clone(), charges: None, // TODO: allow charges on mandates? + merchant_order_reference_id: None, integrity_object: None, } } diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs index 60b40e7866..859f02d8fc 100644 --- a/crates/router/src/types/api/verify_connector.rs +++ b/crates/router/src/types/api/verify_connector.rs @@ -55,6 +55,7 @@ impl VerifyConnectorData { authentication_data: None, customer_acceptance: None, charges: None, + merchant_order_reference_id: None, integrity_object: None, } } diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs index 97c063eb3a..28976236df 100644 --- a/crates/router/src/utils/user/sample_data.rs +++ b/crates/router/src/utils/user/sample_data.rs @@ -226,6 +226,7 @@ pub async fn generate_sample_data( charges: None, frm_metadata: Default::default(), customer_details: None, + merchant_order_reference_id: Default::default(), }; let payment_attempt = PaymentAttemptBatchNew { attempt_id: attempt_id.clone(), diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs index 53bbea865c..153134964b 100644 --- a/crates/router/tests/connectors/utils.rs +++ b/crates/router/tests/connectors/utils.rs @@ -937,6 +937,7 @@ impl Default for PaymentAuthorizeType { customer_acceptance: None, charges: None, integrity_object: None, + merchant_order_reference_id: None, }; Self(data) } diff --git a/migrations/2024-07-03-182616_add_merchant_order_reference_id/down.sql b/migrations/2024-07-03-182616_add_merchant_order_reference_id/down.sql new file mode 100644 index 0000000000..bcfedcf6b4 --- /dev/null +++ b/migrations/2024-07-03-182616_add_merchant_order_reference_id/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE payment_intent DROP COLUMN IF EXISTS merchant_order_reference_id; \ No newline at end of file diff --git a/migrations/2024-07-03-182616_add_merchant_order_reference_id/up.sql b/migrations/2024-07-03-182616_add_merchant_order_reference_id/up.sql new file mode 100644 index 0000000000..cd5d2359c5 --- /dev/null +++ b/migrations/2024-07-03-182616_add_merchant_order_reference_id/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS merchant_order_reference_id VARCHAR(255) DEFAULT NULL; \ No newline at end of file