diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index 4e88d5c0fd..0377a3e818 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -1420,7 +1420,7 @@ crate::impl_to_sql_from_sql_json!(BrowserInformation); /// In case connector's use an identifier whose length exceeds 128 characters, /// the hash value of such identifiers will be stored as connector_transaction_id. /// The actual connector's identifier will be stored in a separate column - -/// connector_transaction_data or something with a similar name. +/// processor_transaction_data or something with a similar name. #[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, AsExpression)] #[diesel(sql_type = sql_types::Text)] pub enum ConnectorTransactionId { @@ -1438,7 +1438,7 @@ impl ConnectorTransactionId { } } - /// Implementation for forming ConnectorTransactionId and an optional string to be used for connector_transaction_id and connector_transaction_data + /// Implementation for forming ConnectorTransactionId and an optional string to be used for connector_transaction_id and processor_transaction_data pub fn form_id_and_data(src: String) -> (Self, Option) { let txn_id = Self::from(src.clone()); match txn_id { @@ -1456,10 +1456,10 @@ impl ConnectorTransactionId { (Self::TxnId(id), _) => Ok(id), (Self::HashedData(_), Some(id)) => Ok(id), (Self::HashedData(id), None) => Err(report!(ValidationError::InvalidValue { - message: "connector_transaction_data is empty for HashedData variant".to_string(), + message: "processor_transaction_data is empty for HashedData variant".to_string(), }) .attach_printable(format!( - "connector_transaction_data is empty for connector_transaction_id {}", + "processor_transaction_data is empty for connector_transaction_id {}", id ))), } diff --git a/crates/diesel_models/src/capture.rs b/crates/diesel_models/src/capture.rs index d6272c3406..367382b98b 100644 --- a/crates/diesel_models/src/capture.rs +++ b/crates/diesel_models/src/capture.rs @@ -30,7 +30,9 @@ pub struct Capture { pub capture_sequence: i16, // reference to the capture at connector side pub connector_response_reference_id: Option, + /// INFO: This field is deprecated and replaced by processor_capture_data pub connector_capture_data: Option, + pub processor_capture_data: Option, } #[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize)] @@ -55,7 +57,9 @@ pub struct CaptureNew { pub connector_capture_id: Option, pub capture_sequence: i16, pub connector_response_reference_id: Option, + /// INFO: This field is deprecated and replaced by processor_capture_data pub connector_capture_data: Option, + pub processor_capture_data: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -64,7 +68,7 @@ pub enum CaptureUpdate { status: storage_enums::CaptureStatus, connector_capture_id: Option, connector_response_reference_id: Option, - connector_capture_data: Option, + processor_capture_data: Option, }, ErrorUpdate { status: storage_enums::CaptureStatus, @@ -84,7 +88,7 @@ pub struct CaptureUpdateInternal { pub modified_at: Option, pub connector_capture_id: Option, pub connector_response_reference_id: Option, - pub connector_capture_data: Option, + pub processor_capture_data: Option, } impl CaptureUpdate { @@ -97,7 +101,7 @@ impl CaptureUpdate { modified_at: _, connector_capture_id, connector_response_reference_id, - connector_capture_data, + processor_capture_data, } = self.into(); Capture { status: status.unwrap_or(source.status), @@ -108,7 +112,7 @@ impl CaptureUpdate { connector_capture_id: connector_capture_id.or(source.connector_capture_id), connector_response_reference_id: connector_response_reference_id .or(source.connector_response_reference_id), - connector_capture_data: connector_capture_data.or(source.connector_capture_data), + processor_capture_data: processor_capture_data.or(source.processor_capture_data), ..source } } @@ -122,13 +126,13 @@ impl From for CaptureUpdateInternal { status, connector_capture_id: connector_transaction_id, connector_response_reference_id, - connector_capture_data, + processor_capture_data, } => Self { status: Some(status), connector_capture_id: connector_transaction_id, modified_at: now, connector_response_reference_id, - connector_capture_data, + processor_capture_data, ..Self::default() }, CaptureUpdate::ErrorUpdate { diff --git a/crates/diesel_models/src/kv.rs b/crates/diesel_models/src/kv.rs index 94dcf00f75..54e6089153 100644 --- a/crates/diesel_models/src/kv.rs +++ b/crates/diesel_models/src/kv.rs @@ -227,7 +227,7 @@ pub enum Insertable { pub enum Updateable { PaymentIntentUpdate(Box), PaymentAttemptUpdate(Box), - RefundUpdate(RefundUpdateMems), + RefundUpdate(Box), CustomerUpdate(CustomerUpdateMems), AddressUpdate(Box), PayoutsUpdate(PayoutsUpdateMems), diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs index eab95f8131..b3b3f44f3c 100644 --- a/crates/diesel_models/src/payment_attempt.rs +++ b/crates/diesel_models/src/payment_attempt.rs @@ -171,8 +171,10 @@ pub struct PaymentAttempt { pub card_network: Option, pub shipping_cost: Option, pub order_tax_amount: Option, + /// INFO: This field is deprecated and replaced by processor_transaction_data pub connector_transaction_data: Option, pub connector_mandate_detail: Option, + pub processor_transaction_data: Option, pub card_discovery: Option, pub charges: Option, } @@ -183,7 +185,7 @@ impl ConnectorTransactionIdTrait for PaymentAttempt { match self .connector_transaction_id .as_ref() - .map(|txn_id| txn_id.get_txn_id(self.connector_transaction_data.as_ref())) + .map(|txn_id| txn_id.get_txn_id(self.processor_transaction_data.as_ref())) .transpose() { Ok(txn_id) => txn_id, @@ -871,8 +873,8 @@ pub struct PaymentAttemptUpdateInternal { pub card_network: Option, pub shipping_cost: Option, pub order_tax_amount: Option, - pub connector_transaction_data: Option, pub connector_mandate_detail: Option, + pub processor_transaction_data: Option, pub card_discovery: Option, pub charges: Option, } @@ -1055,7 +1057,7 @@ impl PaymentAttemptUpdate { card_network, shipping_cost, order_tax_amount, - connector_transaction_data, + processor_transaction_data, connector_mandate_detail, card_discovery, charges, @@ -1113,8 +1115,8 @@ impl PaymentAttemptUpdate { card_network: card_network.or(source.card_network), shipping_cost: shipping_cost.or(source.shipping_cost), order_tax_amount: order_tax_amount.or(source.order_tax_amount), - connector_transaction_data: connector_transaction_data - .or(source.connector_transaction_data), + processor_transaction_data: processor_transaction_data + .or(source.processor_transaction_data), connector_mandate_detail: connector_mandate_detail.or(source.connector_mandate_detail), card_discovery: card_discovery.or(source.card_discovery), charges: charges.or(source.charges), @@ -1483,7 +1485,7 @@ impl From for PaymentAttemptUpdateInternal { // card_network: None, // shipping_cost: None, // order_tax_amount: None, - // connector_transaction_data: None, + // processor_transaction_data: None, // connector_mandate_detail, // }, // PaymentAttemptUpdate::ConnectorMandateDetailUpdate { @@ -2167,7 +2169,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2224,7 +2226,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2313,7 +2315,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost, order_tax_amount, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail, card_discovery, charges: None, @@ -2371,7 +2373,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2430,7 +2432,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2489,7 +2491,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2546,7 +2548,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail, card_discovery: None, charges: None, @@ -2603,7 +2605,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2631,7 +2633,7 @@ impl From for PaymentAttemptUpdateInternal { connector_mandate_detail, charges, } => { - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -2657,7 +2659,9 @@ impl From for PaymentAttemptUpdateInternal { unified_code, unified_message, payment_method_data, - connector_transaction_data, + processor_transaction_data, + connector_mandate_detail, + charges, amount: None, net_amount: None, currency: None, @@ -2686,9 +2690,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_mandate_detail, card_discovery: None, - charges, } } PaymentAttemptUpdate::ErrorUpdate { @@ -2705,7 +2707,7 @@ impl From for PaymentAttemptUpdateInternal { payment_method_data, authentication_type, } => { - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -2724,7 +2726,7 @@ impl From for PaymentAttemptUpdateInternal { connector_transaction_id, payment_method_data, authentication_type, - connector_transaction_data, + processor_transaction_data, amount: None, net_amount: None, currency: None, @@ -2814,7 +2816,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2877,7 +2879,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -2893,7 +2895,7 @@ impl From for PaymentAttemptUpdateInternal { connector_response_reference_id, updated_by, } => { - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -2909,7 +2911,7 @@ impl From for PaymentAttemptUpdateInternal { error_reason, connector_response_reference_id, updated_by, - connector_transaction_data, + processor_transaction_data, amount: None, net_amount: None, currency: None, @@ -2962,7 +2964,7 @@ impl From for PaymentAttemptUpdateInternal { connector_response_reference_id, updated_by, } => { - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -2976,7 +2978,7 @@ impl From for PaymentAttemptUpdateInternal { connector_transaction_id, connector_response_reference_id, updated_by, - connector_transaction_data, + processor_transaction_data, amount: None, net_amount: None, currency: None, @@ -3075,7 +3077,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -3133,7 +3135,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -3146,7 +3148,7 @@ impl From for PaymentAttemptUpdateInternal { updated_by, charges, } => { - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -3158,7 +3160,8 @@ impl From for PaymentAttemptUpdateInternal { connector: connector.map(Some), modified_at: common_utils::date_time::now(), updated_by, - connector_transaction_data, + processor_transaction_data, + charges, amount: None, net_amount: None, currency: None, @@ -3203,7 +3206,6 @@ impl From for PaymentAttemptUpdateInternal { order_tax_amount: None, connector_mandate_detail: None, card_discovery: None, - charges, } } PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate { @@ -3258,7 +3260,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -3318,7 +3320,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, @@ -3333,7 +3335,7 @@ impl From for PaymentAttemptUpdateInternal { unified_message, connector_transaction_id, } => { - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -3348,7 +3350,7 @@ impl From for PaymentAttemptUpdateInternal { unified_code: unified_code.map(Some), unified_message: unified_message.map(Some), connector_transaction_id, - connector_transaction_data, + processor_transaction_data, amount: None, net_amount: None, currency: None, @@ -3445,7 +3447,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail: None, card_discovery: None, charges: None, diff --git a/crates/diesel_models/src/query/capture.rs b/crates/diesel_models/src/query/capture.rs index 7a32e41096..3f02948d2a 100644 --- a/crates/diesel_models/src/query/capture.rs +++ b/crates/diesel_models/src/query/capture.rs @@ -74,7 +74,7 @@ impl ConnectorTransactionIdTrait for Capture { match self .connector_capture_id .as_ref() - .map(|capture_id| capture_id.get_txn_id(self.connector_capture_data.as_ref())) + .map(|capture_id| capture_id.get_txn_id(self.processor_capture_data.as_ref())) .transpose() { Ok(capture_id) => capture_id, diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs index b929481d64..f19c3252c6 100644 --- a/crates/diesel_models/src/refund.rs +++ b/crates/diesel_models/src/refund.rs @@ -51,11 +51,15 @@ pub struct Refund { pub merchant_connector_id: Option, pub charges: Option, pub organization_id: common_utils::id_type::OrganizationId, + /// INFO: This field is deprecated and replaced by processor_refund_data pub connector_refund_data: Option, + /// INFO: This field is deprecated and replaced by processor_transaction_data pub connector_transaction_data: Option, pub split_refunds: Option, pub unified_code: Option, pub unified_message: Option, + pub processor_refund_data: Option, + pub processor_transaction_data: Option, } #[derive( @@ -99,9 +103,9 @@ pub struct RefundNew { pub merchant_connector_id: Option, pub charges: Option, pub organization_id: common_utils::id_type::OrganizationId, - pub connector_refund_data: Option, - pub connector_transaction_data: Option, pub split_refunds: Option, + pub processor_refund_data: Option, + pub processor_transaction_data: Option, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] @@ -113,7 +117,7 @@ pub enum RefundUpdate { refund_error_message: Option, refund_arn: String, updated_by: String, - connector_refund_data: Option, + processor_refund_data: Option, }, MetadataAndReasonUpdate { metadata: Option, @@ -125,7 +129,7 @@ pub enum RefundUpdate { sent_to_gateway: bool, refund_status: storage_enums::RefundStatus, updated_by: String, - connector_refund_data: Option, + processor_refund_data: Option, }, ErrorUpdate { refund_status: Option, @@ -133,7 +137,7 @@ pub enum RefundUpdate { refund_error_code: Option, updated_by: String, connector_refund_id: Option, - connector_refund_data: Option, + processor_refund_data: Option, unified_code: Option, unified_message: Option, }, @@ -158,7 +162,7 @@ pub struct RefundUpdateInternal { refund_error_code: Option, updated_by: String, modified_at: PrimitiveDateTime, - connector_refund_data: Option, + processor_refund_data: Option, unified_code: Option, unified_message: Option, } @@ -176,7 +180,7 @@ impl RefundUpdateInternal { refund_error_code: self.refund_error_code, updated_by: self.updated_by, modified_at: self.modified_at, - connector_refund_data: self.connector_refund_data, + processor_refund_data: self.processor_refund_data, unified_code: self.unified_code, unified_message: self.unified_message, ..source @@ -194,7 +198,7 @@ impl From for RefundUpdateInternal { refund_error_message, refund_arn, updated_by, - connector_refund_data, + processor_refund_data, } => Self { connector_refund_id: Some(connector_refund_id), refund_status: Some(refund_status), @@ -202,7 +206,7 @@ impl From for RefundUpdateInternal { refund_error_message, refund_arn: Some(refund_arn), updated_by, - connector_refund_data, + processor_refund_data, metadata: None, refund_reason: None, refund_error_code: None, @@ -225,7 +229,7 @@ impl From for RefundUpdateInternal { refund_arn: None, refund_error_code: None, modified_at: common_utils::date_time::now(), - connector_refund_data: None, + processor_refund_data: None, unified_code: None, unified_message: None, }, @@ -234,13 +238,13 @@ impl From for RefundUpdateInternal { sent_to_gateway, refund_status, updated_by, - connector_refund_data, + processor_refund_data, } => Self { connector_refund_id, sent_to_gateway: Some(sent_to_gateway), refund_status: Some(refund_status), updated_by, - connector_refund_data, + processor_refund_data, refund_error_message: None, refund_arn: None, metadata: None, @@ -258,14 +262,14 @@ impl From for RefundUpdateInternal { unified_message, updated_by, connector_refund_id, - connector_refund_data, + processor_refund_data, } => Self { refund_status, refund_error_message, refund_error_code, updated_by, connector_refund_id, - connector_refund_data, + processor_refund_data, sent_to_gateway: None, refund_arn: None, metadata: None, @@ -290,7 +294,7 @@ impl From for RefundUpdateInternal { metadata: None, refund_reason: None, modified_at: common_utils::date_time::now(), - connector_refund_data: None, + processor_refund_data: None, unified_code: None, unified_message: None, }, @@ -311,7 +315,7 @@ impl RefundUpdate { refund_error_code, updated_by, modified_at: _, - connector_refund_data, + processor_refund_data, unified_code, unified_message, } = self.into(); @@ -326,7 +330,7 @@ impl RefundUpdate { refund_reason: refund_reason.or(source.refund_reason), updated_by, modified_at: common_utils::date_time::now(), - connector_refund_data: connector_refund_data.or(source.connector_refund_data), + processor_refund_data: processor_refund_data.or(source.processor_refund_data), unified_code: unified_code.or(source.unified_code), unified_message: unified_message.or(source.unified_message), ..source @@ -340,7 +344,7 @@ pub struct RefundCoreWorkflow { pub connector_transaction_id: ConnectorTransactionId, pub merchant_id: common_utils::id_type::MerchantId, pub payment_id: common_utils::id_type::PaymentId, - pub connector_transaction_data: Option, + pub processor_transaction_data: Option, } #[cfg(feature = "v1")] @@ -358,7 +362,7 @@ impl ConnectorTransactionIdTrait for Refund { match self .connector_refund_id .as_ref() - .map(|refund_id| refund_id.get_txn_id(self.connector_refund_data.as_ref())) + .map(|refund_id| refund_id.get_txn_id(self.processor_refund_data.as_ref())) .transpose() { Ok(refund_id) => refund_id, @@ -374,7 +378,7 @@ impl ConnectorTransactionIdTrait for Refund { fn get_connector_transaction_id(&self) -> &String { match self .connector_transaction_id - .get_txn_id(self.connector_transaction_data.as_ref()) + .get_txn_id(self.processor_transaction_data.as_ref()) { Ok(txn_id) => txn_id, @@ -418,6 +422,7 @@ mod tests { "connector_transaction_data": null "unified_code": null, "unified_message": null, + "processor_transaction_data": null, }"#; let deserialized = serde_json::from_str::(serialized_refund); diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index bbde92ea04..2e8219c5ab 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -271,6 +271,7 @@ diesel::table! { connector_response_reference_id -> Nullable, #[max_length = 512] connector_capture_data -> Nullable, + processor_capture_data -> Nullable, } } @@ -909,6 +910,7 @@ diesel::table! { #[max_length = 512] connector_transaction_data -> Nullable, connector_mandate_detail -> Nullable, + processor_transaction_data -> Nullable, card_discovery -> Nullable, charges -> Nullable, } @@ -1261,6 +1263,8 @@ diesel::table! { unified_code -> Nullable, #[max_length = 1024] unified_message -> Nullable, + processor_refund_data -> Nullable, + processor_transaction_data -> Nullable, } } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index d17d4f8478..ab2195526f 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -278,8 +278,7 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 512] - connector_capture_data -> Nullable, + processor_capture_data -> Nullable, } } @@ -872,8 +871,7 @@ diesel::table! { tax_on_surcharge -> Nullable, payment_method_billing_address -> Nullable, redirection_data -> Nullable, - #[max_length = 512] - connector_payment_data -> Nullable, + connector_payment_data -> Nullable, connector_token_details -> Nullable, #[max_length = 64] id -> Varchar, @@ -1198,15 +1196,13 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 512] - connector_refund_data -> Nullable, - #[max_length = 512] - connector_transaction_data -> Nullable, split_refunds -> Nullable, #[max_length = 255] unified_code -> Nullable, #[max_length = 1024] unified_message -> Nullable, + processor_refund_data -> Nullable, + processor_transaction_data -> Nullable, } } diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs index c063545d81..2708542408 100644 --- a/crates/diesel_models/src/user/sample_data.rs +++ b/crates/diesel_models/src/user/sample_data.rs @@ -201,7 +201,7 @@ pub struct PaymentAttemptBatchNew { pub organization_id: common_utils::id_type::OrganizationId, pub shipping_cost: Option, pub order_tax_amount: Option, - pub connector_transaction_data: Option, + pub processor_transaction_data: Option, pub connector_mandate_detail: Option, pub card_discovery: Option, } diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs index 6e19c20eda..a43ffb7cfa 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs @@ -149,14 +149,12 @@ pub struct ExpiryDate { #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct BillingAddress { - #[serde(skip_serializing_if = "Option::is_none")] - pub address1: Option>, + pub address1: Secret, #[serde(skip_serializing_if = "Option::is_none")] pub address2: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub address3: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option, + pub city: String, #[serde(skip_serializing_if = "Option::is_none")] pub state: Option>, pub postal_code: Secret, diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs index 28cbca418a..65c884601d 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs @@ -90,10 +90,16 @@ fn fetch_payment_instrument( billing_address.and_then(|addr| addr.address.clone()) { Some(BillingAddress { - address1: address.line1, + address1: address.line1.get_required_value("line1").change_context( + errors::ConnectorError::MissingRequiredField { + field_name: "line1", + }, + )?, address2: address.line2, address3: address.line3, - city: address.city, + city: address.city.get_required_value("city").change_context( + errors::ConnectorError::MissingRequiredField { field_name: "city" }, + )?, state: address.state, postal_code: address.zip.get_required_value("zip").change_context( errors::ConnectorError::MissingRequiredField { field_name: "zip" }, diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs index e641ee63d2..133d04ceb6 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs @@ -1512,7 +1512,7 @@ impl behaviour::Conversion for PaymentAttempt { .and_then(|card| card.get("card_network")) .and_then(|network| network.as_str()) .map(|network| network.to_string()); - let (connector_transaction_id, connector_transaction_data) = self + let (connector_transaction_id, processor_transaction_data) = self .connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -1579,12 +1579,14 @@ impl behaviour::Conversion for PaymentAttempt { profile_id: self.profile_id, organization_id: self.organization_id, card_network, - connector_transaction_data, order_tax_amount: self.net_amount.get_order_tax_amount(), shipping_cost: self.net_amount.get_shipping_cost(), connector_mandate_detail: self.connector_mandate_detail, + processor_transaction_data, card_discovery: self.card_discovery, charges: self.charges, + // Below fields are deprecated. Please add any new fields above this line. + connector_transaction_data: None, }) } diff --git a/crates/router/src/configs/defaults/payment_connector_required_fields.rs b/crates/router/src/configs/defaults/payment_connector_required_fields.rs index c5b9b9a043..a9f5ae5949 100644 --- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs +++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs @@ -13514,5 +13514,14 @@ pub fn get_worldpay_billing_required_fields() -> HashMap( .multiple_capture_data { Some(multiple_capture_data) => { - let (connector_capture_id, connector_capture_data) = + let (connector_capture_id, processor_capture_data) = match resource_id { types::ResponseId::NoResponseId => (None, None), types::ResponseId::ConnectorTransactionId(id) @@ -1679,7 +1679,7 @@ async fn payment_response_update_tracker( )?, connector_capture_id: connector_capture_id.clone(), connector_response_reference_id, - connector_capture_data: connector_capture_data.clone(), + processor_capture_data: processor_capture_data.clone(), }; let capture_update_list = vec![( multiple_capture_data.get_latest_capture().clone(), diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 1f6e03a0de..ebf837792d 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -3847,7 +3847,7 @@ impl ForeignTryFrom for storage::CaptureUpdate { connector_response_reference_id, .. } => { - let (connector_capture_id, connector_capture_data) = match resource_id { + let (connector_capture_id, processor_capture_data) = match resource_id { types::ResponseId::EncodedData(_) | types::ResponseId::NoResponseId => { (None, None) } @@ -3861,7 +3861,7 @@ impl ForeignTryFrom for storage::CaptureUpdate { status: enums::CaptureStatus::foreign_try_from(status)?, connector_capture_id, connector_response_reference_id, - connector_capture_data, + processor_capture_data, }) } types::CaptureSyncResponse::Error { diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs index 4d8cc19569..938bf1a836 100644 --- a/crates/router/src/core/refunds.rs +++ b/crates/router/src/core/refunds.rs @@ -235,7 +235,7 @@ pub async fn trigger_refund_to_gateway( refund_error_code: Some("NOT_IMPLEMENTED".to_string()), updated_by: storage_scheme.to_string(), connector_refund_id: None, - connector_refund_data: None, + processor_refund_data: None, unified_code: None, unified_message: None, }) @@ -249,7 +249,7 @@ pub async fn trigger_refund_to_gateway( refund_error_code: Some("NOT_SUPPORTED".to_string()), updated_by: storage_scheme.to_string(), connector_refund_id: None, - connector_refund_data: None, + processor_refund_data: None, unified_code: None, unified_message: None, }) @@ -332,7 +332,7 @@ pub async fn trigger_refund_to_gateway( refund_error_code: Some(err.code), updated_by: storage_scheme.to_string(), connector_refund_id: None, - connector_refund_data: None, + processor_refund_data: None, unified_code: Some(unified_code), unified_message: Some(unified_message), } @@ -341,7 +341,7 @@ pub async fn trigger_refund_to_gateway( // match on connector integrity checks match router_data_res.integrity_check.clone() { Err(err) => { - let (refund_connector_transaction_id, connector_refund_data) = + let (refund_connector_transaction_id, processor_refund_data) = err.connector_transaction_id.map_or((None, None), |txn_id| { let (refund_id, refund_data) = ConnectorTransactionId::form_id_and_data(txn_id); @@ -363,7 +363,7 @@ pub async fn trigger_refund_to_gateway( refund_error_code: Some("IE".to_string()), updated_by: storage_scheme.to_string(), connector_refund_id: refund_connector_transaction_id, - connector_refund_data, + processor_refund_data, unified_code: None, unified_message: None, } @@ -378,7 +378,7 @@ pub async fn trigger_refund_to_gateway( )), ) } - let (connector_refund_id, connector_refund_data) = + let (connector_refund_id, processor_refund_data) = ConnectorTransactionId::form_id_and_data(response.connector_refund_id); storage::RefundUpdate::Update { connector_refund_id, @@ -387,7 +387,7 @@ pub async fn trigger_refund_to_gateway( refund_error_message: None, refund_arn: "".to_string(), updated_by: storage_scheme.to_string(), - connector_refund_data, + processor_refund_data, } } } @@ -677,7 +677,7 @@ pub async fn sync_refund_with_gateway( refund_error_code: Some(error_message.code), updated_by: storage_scheme.to_string(), connector_refund_id: None, - connector_refund_data: None, + processor_refund_data: None, unified_code: None, unified_message: None, } @@ -691,7 +691,7 @@ pub async fn sync_refund_with_gateway( ("merchant_id", merchant_account.get_id().clone()), ), ); - let (refund_connector_transaction_id, connector_refund_data) = err + let (refund_connector_transaction_id, processor_refund_data) = err .connector_transaction_id .map_or((None, None), |refund_id| { let (refund_id, refund_data) = @@ -707,13 +707,13 @@ pub async fn sync_refund_with_gateway( refund_error_code: Some("IE".to_string()), updated_by: storage_scheme.to_string(), connector_refund_id: refund_connector_transaction_id, - connector_refund_data, + processor_refund_data, unified_code: None, unified_message: None, } } Ok(()) => { - let (connector_refund_id, connector_refund_data) = + let (connector_refund_id, processor_refund_data) = ConnectorTransactionId::form_id_and_data(response.connector_refund_id); storage::RefundUpdate::Update { connector_refund_id, @@ -722,7 +722,7 @@ pub async fn sync_refund_with_gateway( refund_error_message: None, refund_arn: "".to_string(), updated_by: storage_scheme.to_string(), - connector_refund_data, + processor_refund_data, } } }, @@ -882,7 +882,7 @@ pub async fn validate_and_create_refund( .clone() .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable("No connector populated in payment attempt")?; - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = ConnectorTransactionId::form_id_and_data(connector_transaction_id); let refund_create_req = storage::RefundNew { refund_id: refund_id.to_string(), @@ -912,8 +912,8 @@ pub async fn validate_and_create_refund( refund_arn: None, updated_by: Default::default(), organization_id: merchant_account.organization_id.clone(), - connector_refund_data: None, - connector_transaction_data, + processor_transaction_data, + processor_refund_data: None, }; let refund = match db @@ -1584,7 +1584,7 @@ pub fn refund_to_refund_core_workflow_model( connector_transaction_id: refund.connector_transaction_id.clone(), merchant_id: refund.merchant_id.clone(), payment_id: refund.payment_id.clone(), - connector_transaction_data: refund.connector_transaction_data.clone(), + processor_transaction_data: refund.processor_transaction_data.clone(), } } diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs index 2c0d9b5b5c..8b56297880 100644 --- a/crates/router/src/core/webhooks/incoming.rs +++ b/crates/router/src/core/webhooks/incoming.rs @@ -1023,7 +1023,7 @@ async fn refunds_incoming_webhook_flow( .change_context(errors::ApiErrorResponse::WebhookProcessingFailure) .attach_printable("failed refund status mapping from event type")?, updated_by: merchant_account.storage_scheme.to_string(), - connector_refund_data: None, + processor_refund_data: None, }; db.update_refund( refund.to_owned(), diff --git a/crates/router/src/db/capture.rs b/crates/router/src/db/capture.rs index cbc27f918d..a2e4a90d66 100644 --- a/crates/router/src/db/capture.rs +++ b/crates/router/src/db/capture.rs @@ -198,7 +198,9 @@ impl CaptureInterface for MockDb { capture_sequence: capture.capture_sequence, connector_capture_id: capture.connector_capture_id, connector_response_reference_id: capture.connector_response_reference_id, - connector_capture_data: capture.connector_capture_data, + processor_capture_data: capture.processor_capture_data, + // Below fields are deprecated. Please add any new fields above this line. + connector_capture_data: None, }; captures.push(capture.clone()); Ok(capture) diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs index e07821cd9a..07bdfa3f77 100644 --- a/crates/router/src/db/refund.rs +++ b/crates/router/src/db/refund.rs @@ -435,10 +435,13 @@ mod storage { charges: new.charges.clone(), split_refunds: new.split_refunds.clone(), organization_id: new.organization_id.clone(), - connector_refund_data: new.connector_refund_data.clone(), - connector_transaction_data: new.connector_transaction_data.clone(), unified_code: None, unified_message: None, + processor_refund_data: new.processor_refund_data.clone(), + processor_transaction_data: new.processor_transaction_data.clone(), + // Below fields are deprecated. Please add any new fields above this line. + connector_refund_data: None, + connector_transaction_data: None, }; let field = format!( @@ -620,12 +623,12 @@ mod storage { let redis_entry = kv::TypedSql { op: kv::DBOperation::Update { - updatable: Box::new(kv::Updateable::RefundUpdate( + updatable: Box::new(kv::Updateable::RefundUpdate(Box::new( kv::RefundUpdateMems { orig: this, update_data: refund, }, - )), + ))), }, }; @@ -932,10 +935,13 @@ impl RefundInterface for MockDb { charges: new.charges, split_refunds: new.split_refunds, organization_id: new.organization_id, - connector_refund_data: new.connector_refund_data, - connector_transaction_data: new.connector_transaction_data, unified_code: None, unified_message: None, + processor_refund_data: new.processor_refund_data.clone(), + processor_transaction_data: new.processor_transaction_data.clone(), + // Below fields are deprecated. Please add any new fields above this line. + connector_refund_data: None, + connector_transaction_data: None, }; refunds.push(refund.clone()); Ok(refund) diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs index 1773d7f3a1..c82a921fe1 100644 --- a/crates/router/src/types/storage/payment_attempt.rs +++ b/crates/router/src/types/storage/payment_attempt.rs @@ -63,6 +63,8 @@ impl PaymentAttemptExt for PaymentAttempt { capture_sequence, connector_capture_id: None, connector_response_reference_id: None, + processor_capture_data: None, + // Below fields are deprecated. Please add any new fields above this line. connector_capture_data: None, }) } diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs index c5652e6cbf..e189deb948 100644 --- a/crates/router/src/utils/user/sample_data.rs +++ b/crates/router/src/utils/user/sample_data.rs @@ -277,7 +277,7 @@ pub async fn generate_sample_data( psd2_sca_exemption_type: None, platform_merchant_id: None, }; - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = ConnectorTransactionId::form_id_and_data(attempt_id.clone()); let payment_attempt = PaymentAttemptBatchNew { attempt_id: attempt_id.clone(), @@ -359,14 +359,14 @@ pub async fn generate_sample_data( organization_id: org_id.clone(), shipping_cost: None, order_tax_amount: None, - connector_transaction_data, + processor_transaction_data, connector_mandate_detail: None, card_discovery: None, }; let refund = if refunds_count < number_of_refunds && !is_failed_payment { refunds_count += 1; - let (connector_transaction_id, connector_transaction_data) = + let (connector_transaction_id, processor_transaction_data) = ConnectorTransactionId::form_id_and_data(attempt_id.clone()); Some(RefundNew { refund_id: common_utils::generate_id_with_default_len("test"), @@ -401,8 +401,8 @@ pub async fn generate_sample_data( charges: None, split_refunds: None, organization_id: org_id.clone(), - connector_refund_data: None, - connector_transaction_data, + processor_refund_data: None, + processor_transaction_data, }) } else { None diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs index 0c8b969e16..5b5f50f5aa 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -1490,7 +1490,7 @@ impl DataModelExt for PaymentAttempt { type StorageModel = DieselPaymentAttempt; fn to_storage_model(self) -> Self::StorageModel { - let (connector_transaction_id, connector_transaction_data) = self + let (connector_transaction_id, processor_transaction_data) = self .connector_transaction_id .map(ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) @@ -1565,12 +1565,14 @@ impl DataModelExt for PaymentAttempt { customer_acceptance: self.customer_acceptance, organization_id: self.organization_id, profile_id: self.profile_id, - connector_transaction_data, shipping_cost: self.net_amount.get_shipping_cost(), order_tax_amount: self.net_amount.get_order_tax_amount(), connector_mandate_detail: self.connector_mandate_detail, + processor_transaction_data, card_discovery: self.card_discovery, charges: self.charges, + // Below fields are deprecated. Please add any new fields above this line. + connector_transaction_data: None, } } diff --git a/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js index 06c5c79915..7b78384768 100644 --- a/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js +++ b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js @@ -695,4 +695,804 @@ export const connectorDetails = { }, }, }, + pm_list: { + PmListResponse: { + pmListDynamicFieldWithoutBilling: { + payment_methods: [ + { + payment_method: "card", + payment_method_types: [ + { + payment_method_type: "credit", + card_networks: [{ eligible_connectors: ["worldpay"] }], + required_fields: { + "payment_method_data.card.card_number": { + required_field: "payment_method_data.card.card_number", + display_name: "card_number", + field_type: "user_card_number", + value: null, + }, + "payment_method_data.card.card_exp_month": { + required_field: "payment_method_data.card.card_exp_month", + display_name: "card_exp_month", + field_type: "user_card_expiry_month", + value: null, + }, + "payment_method_data.card.card_exp_year": { + required_field: "payment_method_data.card.card_exp_year", + display_name: "card_exp_year", + field_type: "user_card_expiry_year", + value: null, + }, + "billing.address.line1": { + required_field: "payment_method_data.billing.address.line1", + display_name: "line1", + field_type: "user_address_line1", + value: null, + }, + "billing.address.country": { + required_field: + "payment_method_data.billing.address.country", + display_name: "country", + field_type: { + user_address_country: { + options: [ + "AF", + "AU", + "AW", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BZ", + "BM", + "BT", + "BO", + "BA", + "BW", + "BR", + "BN", + "BG", + "BI", + "KH", + "CA", + "CV", + "KY", + "CL", + "CO", + "KM", + "CD", + "CR", + "CZ", + "DZ", + "DK", + "DJ", + "ST", + "DO", + "EC", + "EG", + "SV", + "ER", + "ET", + "FK", + "FJ", + "GM", + "GE", + "GH", + "GI", + "GT", + "GN", + "GY", + "HT", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IL", + "IT", + "JM", + "JP", + "JO", + "KZ", + "KE", + "KW", + "LA", + "LB", + "LS", + "LR", + "LY", + "LT", + "MO", + "MK", + "MG", + "MW", + "MY", + "MV", + "MR", + "MU", + "MX", + "MD", + "MN", + "MA", + "MZ", + "MM", + "NA", + "NZ", + "NI", + "NG", + "KP", + "NO", + "AR", + "PK", + "PG", + "PY", + "PE", + "UY", + "PH", + "PL", + "GB", + "QA", + "OM", + "RO", + "RU", + "RW", + "WS", + "SG", + "ST", + "ZA", + "KR", + "LK", + "SH", + "SD", + "SR", + "SZ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TT", + "TN", + "TR", + "UG", + "UA", + "US", + "UZ", + "VU", + "VE", + "VN", + "ZM", + "ZW", + ], + }, + }, + value: null, + }, + "billing.address.city": { + required_field: "payment_method_data.billing.address.city", + display_name: "city", + field_type: "user_address_city", + value: null, + }, + "billing.address.zip": { + required_field: "payment_method_data.billing.address.zip", + display_name: "zip", + field_type: "user_address_pincode", + value: null, + }, + }, + }, + ], + }, + ], + }, + pmListDynamicFieldWithBilling: { + payment_methods: [ + { + payment_method: "card", + payment_method_types: [ + { + payment_method_type: "credit", + card_networks: [{ eligible_connectors: ["worldpay"] }], + required_fields: { + "payment_method_data.card.card_number": { + required_field: "payment_method_data.card.card_number", + display_name: "card_number", + field_type: "user_card_number", + value: null, + }, + "payment_method_data.card.card_exp_month": { + required_field: "payment_method_data.card.card_exp_month", + display_name: "card_exp_month", + field_type: "user_card_expiry_month", + value: null, + }, + "payment_method_data.card.card_exp_year": { + required_field: "payment_method_data.card.card_exp_year", + display_name: "card_exp_year", + field_type: "user_card_expiry_year", + value: null, + }, + "billing.address.line1": { + required_field: "payment_method_data.billing.address.line1", + display_name: "line1", + field_type: "user_address_line1", + value: "1467", + }, + "billing.address.country": { + required_field: + "payment_method_data.billing.address.country", + display_name: "country", + field_type: { + user_address_country: { + options: [ + "AF", + "AU", + "AW", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BZ", + "BM", + "BT", + "BO", + "BA", + "BW", + "BR", + "BN", + "BG", + "BI", + "KH", + "CA", + "CV", + "KY", + "CL", + "CO", + "KM", + "CD", + "CR", + "CZ", + "DZ", + "DK", + "DJ", + "ST", + "DO", + "EC", + "EG", + "SV", + "ER", + "ET", + "FK", + "FJ", + "GM", + "GE", + "GH", + "GI", + "GT", + "GN", + "GY", + "HT", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IL", + "IT", + "JM", + "JP", + "JO", + "KZ", + "KE", + "KW", + "LA", + "LB", + "LS", + "LR", + "LY", + "LT", + "MO", + "MK", + "MG", + "MW", + "MY", + "MV", + "MR", + "MU", + "MX", + "MD", + "MN", + "MA", + "MZ", + "MM", + "NA", + "NZ", + "NI", + "NG", + "KP", + "NO", + "AR", + "PK", + "PG", + "PY", + "PE", + "UY", + "PH", + "PL", + "GB", + "QA", + "OM", + "RO", + "RU", + "RW", + "WS", + "SG", + "ST", + "ZA", + "KR", + "LK", + "SH", + "SD", + "SR", + "SZ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TT", + "TN", + "TR", + "UG", + "UA", + "US", + "UZ", + "VU", + "VE", + "VN", + "ZM", + "ZW", + ], + }, + }, + value: "PL", + }, + "billing.address.city": { + required_field: "payment_method_data.billing.address.city", + display_name: "city", + field_type: "user_address_city", + value: "San Fransico", + }, + "billing.address.zip": { + required_field: "payment_method_data.billing.address.zip", + display_name: "zip", + field_type: "user_address_pincode", + value: "94122", + }, + }, + }, + ], + }, + ], + }, + pmListDynamicFieldWithNames: { + payment_methods: [ + { + payment_method: "card", + payment_method_types: [ + { + payment_method_type: "credit", + card_networks: [ + { + eligible_connectors: ["worldpay"], + }, + ], + required_fields: { + "billing.address.country": { + required_field: + "payment_method_data.billing.address.country", + display_name: "country", + field_type: { + user_address_country: { + options: [ + "AF", + "AU", + "AW", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BZ", + "BM", + "BT", + "BO", + "BA", + "BW", + "BR", + "BN", + "BG", + "BI", + "KH", + "CA", + "CV", + "KY", + "CL", + "CO", + "KM", + "CD", + "CR", + "CZ", + "DZ", + "DK", + "DJ", + "ST", + "DO", + "EC", + "EG", + "SV", + "ER", + "ET", + "FK", + "FJ", + "GM", + "GE", + "GH", + "GI", + "GT", + "GN", + "GY", + "HT", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IL", + "IT", + "JM", + "JP", + "JO", + "KZ", + "KE", + "KW", + "LA", + "LB", + "LS", + "LR", + "LY", + "LT", + "MO", + "MK", + "MG", + "MW", + "MY", + "MV", + "MR", + "MU", + "MX", + "MD", + "MN", + "MA", + "MZ", + "MM", + "NA", + "NZ", + "NI", + "NG", + "KP", + "NO", + "AR", + "PK", + "PG", + "PY", + "PE", + "UY", + "PH", + "PL", + "GB", + "QA", + "OM", + "RO", + "RU", + "RW", + "WS", + "SG", + "ST", + "ZA", + "KR", + "LK", + "SH", + "SD", + "SR", + "SZ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TT", + "TN", + "TR", + "UG", + "UA", + "US", + "UZ", + "VU", + "VE", + "VN", + "ZM", + "ZW", + ], + }, + }, + value: null, + }, + "billing.address.zip": { + required_field: "payment_method_data.billing.address.zip", + display_name: "zip", + field_type: "user_address_pincode", + value: null, + }, + "billing.address.city": { + required_field: "payment_method_data.billing.address.city", + display_name: "city", + field_type: "user_address_city", + value: null, + }, + "billing.address.line1": { + required_field: "payment_method_data.billing.address.line1", + display_name: "line1", + field_type: "user_address_line1", + value: null, + }, + "payment_method_data.card.card_exp_year": { + required_field: "payment_method_data.card.card_exp_year", + display_name: "card_exp_year", + field_type: "user_card_expiry_year", + value: null, + }, + "payment_method_data.card.card_number": { + required_field: "payment_method_data.card.card_number", + display_name: "card_number", + field_type: "user_card_number", + value: null, + }, + "payment_method_data.card.card_exp_month": { + required_field: "payment_method_data.card.card_exp_month", + display_name: "card_exp_month", + field_type: "user_card_expiry_month", + value: null, + }, + }, + }, + ], + }, + ], + }, + pmListDynamicFieldWithEmail: { + payment_methods: [ + { + payment_method: "card", + payment_method_types: [ + { + payment_method_type: "credit", + card_networks: [ + { + eligible_connectors: ["worldpay"], + }, + ], + required_fields: { + "payment_method_data.card.card_exp_year": { + required_field: "payment_method_data.card.card_exp_year", + display_name: "card_exp_year", + field_type: "user_card_expiry_year", + value: null, + }, + "payment_method_data.card.card_number": { + required_field: "payment_method_data.card.card_number", + display_name: "card_number", + field_type: "user_card_number", + value: null, + }, + "payment_method_data.card.card_exp_month": { + required_field: "payment_method_data.card.card_exp_month", + display_name: "card_exp_month", + field_type: "user_card_expiry_month", + value: null, + }, + "billing.address.zip": { + required_field: "payment_method_data.billing.address.zip", + display_name: "zip", + field_type: "user_address_pincode", + value: null, + }, + "billing.address.city": { + required_field: "payment_method_data.billing.address.city", + display_name: "city", + field_type: "user_address_city", + value: null, + }, + "billing.address.line1": { + required_field: "payment_method_data.billing.address.line1", + display_name: "line1", + field_type: "user_address_line1", + value: null, + }, + "billing.address.country": { + required_field: + "payment_method_data.billing.address.country", + display_name: "country", + field_type: { + user_address_country: { + options: [ + "AF", + "AU", + "AW", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BZ", + "BM", + "BT", + "BO", + "BA", + "BW", + "BR", + "BN", + "BG", + "BI", + "KH", + "CA", + "CV", + "KY", + "CL", + "CO", + "KM", + "CD", + "CR", + "CZ", + "DZ", + "DK", + "DJ", + "ST", + "DO", + "EC", + "EG", + "SV", + "ER", + "ET", + "FK", + "FJ", + "GM", + "GE", + "GH", + "GI", + "GT", + "GN", + "GY", + "HT", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IL", + "IT", + "JM", + "JP", + "JO", + "KZ", + "KE", + "KW", + "LA", + "LB", + "LS", + "LR", + "LY", + "LT", + "MO", + "MK", + "MG", + "MW", + "MY", + "MV", + "MR", + "MU", + "MX", + "MD", + "MN", + "MA", + "MZ", + "MM", + "NA", + "NZ", + "NI", + "NG", + "KP", + "NO", + "AR", + "PK", + "PG", + "PY", + "PE", + "UY", + "PH", + "PL", + "GB", + "QA", + "OM", + "RO", + "RU", + "RW", + "WS", + "SG", + "ST", + "ZA", + "KR", + "LK", + "SH", + "SD", + "SR", + "SZ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TT", + "TN", + "TR", + "UG", + "UA", + "US", + "UZ", + "VU", + "VE", + "VN", + "ZM", + "ZW", + ], + }, + }, + value: null, + }, + }, + }, + ], + }, + ], + }, + }, + }, }; diff --git a/migrations/2025-01-09-135057_add_processor_transaction_data/down.sql b/migrations/2025-01-09-135057_add_processor_transaction_data/down.sql new file mode 100644 index 0000000000..bbba634e6e --- /dev/null +++ b/migrations/2025-01-09-135057_add_processor_transaction_data/down.sql @@ -0,0 +1,8 @@ +ALTER TABLE payment_attempt +DROP COLUMN IF EXISTS processor_transaction_data; + +ALTER TABLE refund DROP COLUMN IF EXISTS processor_refund_data; + +ALTER TABLE refund DROP COLUMN IF EXISTS processor_transaction_data; + +ALTER TABLE captures DROP COLUMN IF EXISTS processor_capture_data; \ No newline at end of file diff --git a/migrations/2025-01-09-135057_add_processor_transaction_data/up.sql b/migrations/2025-01-09-135057_add_processor_transaction_data/up.sql new file mode 100644 index 0000000000..81e9cdcd07 --- /dev/null +++ b/migrations/2025-01-09-135057_add_processor_transaction_data/up.sql @@ -0,0 +1,11 @@ +ALTER TABLE payment_attempt +ADD COLUMN IF NOT EXISTS processor_transaction_data TEXT; + +ALTER TABLE refund +ADD COLUMN IF NOT EXISTS processor_refund_data TEXT; + +ALTER TABLE refund +ADD COLUMN IF NOT EXISTS processor_transaction_data TEXT; + +ALTER TABLE captures +ADD COLUMN IF NOT EXISTS processor_capture_data TEXT; \ No newline at end of file diff --git a/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql b/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql index 3926a02afa..0305998587 100644 --- a/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql +++ b/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql @@ -51,7 +51,7 @@ ADD COLUMN payment_method_type_v2 VARCHAR, ADD COLUMN tax_on_surcharge BIGINT, ADD COLUMN payment_method_billing_address BYTEA, ADD COLUMN redirection_data JSONB, - ADD COLUMN connector_payment_data VARCHAR(512), + ADD COLUMN connector_payment_data TEXT, ADD COLUMN connector_token_details JSONB; -- Change the type of the column from JSON to JSONB diff --git a/v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql b/v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql similarity index 98% rename from v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql rename to v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql index f67b9b2e7a..8d0fedce08 100644 --- a/v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql +++ b/v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql @@ -76,7 +76,7 @@ ADD COLUMN IF NOT EXISTS attempt_id VARCHAR(64) NOT NULL, ADD COLUMN offer_amount bigint, ADD COLUMN payment_method VARCHAR, ADD COLUMN connector_transaction_id VARCHAR(64), - ADD COLUMN connector_transaction_data VARCHAR(512), + ADD COLUMN connector_transaction_data TEXT, ADD COLUMN capture_method "CaptureMethod", ADD COLUMN capture_on TIMESTAMP, ADD COLUMN mandate_id VARCHAR(64), diff --git a/v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql similarity index 92% rename from v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql rename to v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql index e19f8631f6..caac00abd0 100644 --- a/v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql +++ b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql @@ -75,6 +75,7 @@ ALTER TABLE payment_attempt DROP COLUMN attempt_id, DROP COLUMN payment_method, DROP COLUMN connector_transaction_id, DROP COLUMN connector_transaction_data, + DROP COLUMN processor_transaction_data, DROP COLUMN capture_method, DROP COLUMN capture_on, DROP COLUMN mandate_id, @@ -89,3 +90,10 @@ ALTER TABLE payment_attempt DROP COLUMN attempt_id, DROP COLUMN payment_method_billing_address_id, DROP COLUMN connector_mandate_detail, DROP COLUMN charge_id; + +-- Run below queries only when V1 is deprecated +ALTER TABLE refund DROP COLUMN connector_refund_data, + DROP COLUMN connector_transaction_data; + +-- Run below queries only when V1 is deprecated +ALTER TABLE captures DROP COLUMN connector_capture_data;