From 79799866ffac330034ab129ca8178341df9a7662 Mon Sep 17 00:00:00 2001 From: Kashif Date: Thu, 9 Jan 2025 19:27:58 +0530 Subject: [PATCH 1/9] refactor(schema): alter type of connector_transaction_data and connector_refund_data columns to 1024 chars --- .../defaults/payment_connector_required_fields.rs | 9 +++++++++ .../down.sql | 4 ++++ .../up.sql | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql create mode 100644 migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql 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 4f6327d74b7a..33734267f9a2 100644 --- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs +++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs @@ -13003,5 +13003,14 @@ pub fn get_worldpay_billing_required_fields() -> HashMap Date: Fri, 10 Jan 2025 13:24:58 +0530 Subject: [PATCH 2/9] chore: update sql queries for v2 and run migrations --- crates/diesel_models/src/schema.rs | 8 +-- crates/diesel_models/src/schema_v2.rs | 8 +-- .../up.sql | 55 +++++++++++++++++-- .../2024-08-28-081721_add_v2_columns/up.sql | 2 +- .../down.sql | 2 +- 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 6e8bdb5ec26b..374197d1041b 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -251,7 +251,7 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_capture_data -> Nullable, } } @@ -886,7 +886,7 @@ diesel::table! { card_network -> Nullable, shipping_cost -> Nullable, order_tax_amount -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_transaction_data -> Nullable, connector_mandate_detail -> Nullable, } @@ -1230,9 +1230,9 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 512] + #[max_length = 1024] connector_refund_data -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_transaction_data -> Nullable, split_refunds -> Nullable, #[max_length = 255] diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index d38f684a44d2..c1a22f4cd58b 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -259,7 +259,7 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_capture_data -> Nullable, } } @@ -852,7 +852,7 @@ diesel::table! { tax_on_surcharge -> Nullable, payment_method_billing_address -> Nullable, redirection_data -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_payment_data -> Nullable, #[max_length = 64] id -> Varchar, @@ -1176,9 +1176,9 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 512] + #[max_length = 1024] connector_refund_data -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_transaction_data -> Nullable, split_refunds -> Nullable, #[max_length = 255] diff --git a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql index a0068b16a36d..20f783dac794 100644 --- a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql +++ b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql @@ -1,4 +1,51 @@ -ALTER TABLE payment_attempt ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); -ALTER TABLE refund ALTER COLUMN connector_refund_data TYPE VARCHAR(1024); -ALTER TABLE refund ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); -ALTER TABLE captures ALTER COLUMN connector_capture_data TYPE VARCHAR(1024); \ No newline at end of file +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'payment_attempt' + AND column_name = 'connector_transaction_data' + ) THEN + ALTER TABLE payment_attempt + ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'refund' + AND column_name = 'connector_refund_data' + ) THEN + ALTER TABLE refund + ALTER COLUMN connector_refund_data TYPE VARCHAR(1024); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'refund' + AND column_name = 'connector_transaction_data' + ) THEN + ALTER TABLE refund + ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'captures' + AND column_name = 'connector_capture_data' + ) THEN + ALTER TABLE captures + ALTER COLUMN connector_capture_data TYPE VARCHAR(1024); + END IF; +END $$; \ 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 faebb36cdf9d..4609991ee56d 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 VARCHAR(1024); -- Change the type of the column from JSON to JSONB ALTER TABLE merchant_connector_account diff --git a/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql b/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql index 64cbd2233eac..e06dc3666c64 100644 --- a/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql +++ b/v2_migrations/2024-10-08-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 VARCHAR(1024), ADD COLUMN capture_method "CaptureMethod", ADD COLUMN capture_on TIMESTAMP, ADD COLUMN mandate_id VARCHAR(64), From 3b6364d8591f8114d263411846353ef43b2a5af0 Mon Sep 17 00:00:00 2001 From: Kashif Date: Fri, 10 Jan 2025 13:26:26 +0530 Subject: [PATCH 3/9] chore: update down query --- .../down.sql | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql index 72dd806ea5e4..62d7e2dce485 100644 --- a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql +++ b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql @@ -1,4 +1,51 @@ -ALTER TABLE payment_attempt ALTER COLUMN connector_transaction_data TYPE VARCHAR(512); -ALTER TABLE refund ALTER COLUMN connector_refund_data TYPE VARCHAR(512); -ALTER TABLE refund ALTER COLUMN connector_transaction_data TYPE VARCHAR(512); -ALTER TABLE captures ALTER COLUMN connector_capture_data TYPE VARCHAR(512); \ No newline at end of file +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'payment_attempt' + AND column_name = 'connector_transaction_data' + ) THEN + ALTER TABLE payment_attempt + ALTER COLUMN connector_transaction_data TYPE VARCHAR(512); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'refund' + AND column_name = 'connector_refund_data' + ) THEN + ALTER TABLE refund + ALTER COLUMN connector_refund_data TYPE VARCHAR(512); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'refund' + AND column_name = 'connector_transaction_data' + ) THEN + ALTER TABLE refund + ALTER COLUMN connector_transaction_data TYPE VARCHAR(512); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'captures' + AND column_name = 'connector_capture_data' + ) THEN + ALTER TABLE captures + ALTER COLUMN connector_capture_data TYPE VARCHAR(512); + END IF; +END $$; \ No newline at end of file From faf1faaaece20ca296399a8c8e867c6903b90e34 Mon Sep 17 00:00:00 2001 From: Kashif Date: Fri, 10 Jan 2025 14:57:32 +0530 Subject: [PATCH 4/9] chore: add dynamic field test for Worldpay --- .../cypress/e2e/PaymentUtils/WorldPay.js | 301 ++++++++++++++++++ 1 file changed, 301 insertions(+) diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js b/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js index a58bbb22f81d..e246fa26ddcf 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js @@ -638,4 +638,305 @@ 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, + }, + } + } + ] + } + ] + }, + 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.line1": { + required_field: + "payment_method_data.billing.address.line1", + display_name: "line1", + field_type: "user_address_line1", + value: null, + }, + "billing.address.city": { + required_field: + "payment_method_data.billing.address.city", + display_name: "city", + field_type: "user_address_city", + value: null, + }, + }, + }, + ], + }, + ], + }, + pmListDynamicFieldWithEmail: { + payment_methods: [ + { + payment_method: "card", + payment_method_types: [ + { + payment_method_type: "credit", + card_networks: [ + { + eligible_connectors: ["worldpay"], + }, + ], + required_fields: { + "billing.address.line1": { + required_field: + "payment_method_data.billing.address.line1", + display_name: "line1", + field_type: "user_address_line1", + value: null, + }, + "billing.address.city": { + required_field: + "payment_method_data.billing.address.city", + display_name: "city", + field_type: "user_address_city", + value: null, + }, + }, + }, + ], + }, + ], + } + } + } }; From 8bb45c9faf93473191bcb494a0f10bf3dd1f5b76 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 09:28:27 +0000 Subject: [PATCH 5/9] chore(cypress): run formatter and address lints --- .../cypress/e2e/PaymentUtils/WorldPay.js | 57 +++++++++---------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js b/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js index e246fa26ddcf..c4b38004ac9a 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js @@ -647,9 +647,7 @@ export const connectorDetails = { payment_method_types: [ { payment_method_type: "credit", - card_networks: [ - { eligible_connectors: ["worldpay"] }, - ], + card_networks: [{ eligible_connectors: ["worldpay"] }], required_fields: { "payment_method_data.card.card_number": { required_field: "payment_method_data.card.card_number", @@ -669,11 +667,11 @@ export const connectorDetails = { field_type: "user_card_expiry_year", value: null, }, - } - } - ] - } - ] + }, + }, + ], + }, + ], }, pmListDynamicFieldWithBilling: { payment_methods: [ @@ -682,9 +680,7 @@ export const connectorDetails = { payment_method_types: [ { payment_method_type: "credit", - card_networks: [ - { eligible_connectors: ["worldpay"] }, - ], + card_networks: [{ eligible_connectors: ["worldpay"] }], required_fields: { "payment_method_data.card.card_number": { required_field: "payment_method_data.card.card_number", @@ -711,11 +707,13 @@ export const connectorDetails = { value: "1467", }, "billing.address.country": { - required_field: "payment_method_data.billing.address.country", + required_field: + "payment_method_data.billing.address.country", display_name: "country", field_type: { user_address_country: { - options: ["AF", + options: [ + "AF", "AU", "AW", "AZ", @@ -848,8 +846,9 @@ export const connectorDetails = { "VE", "VN", "ZM", - "ZW",] - } + "ZW", + ], + }, }, value: "PL", }, @@ -865,11 +864,11 @@ export const connectorDetails = { field_type: "user_address_pincode", value: "94122", }, - } - } - ] - } - ] + }, + }, + ], + }, + ], }, pmListDynamicFieldWithNames: { payment_methods: [ @@ -885,15 +884,13 @@ export const connectorDetails = { ], required_fields: { "billing.address.line1": { - required_field: - "payment_method_data.billing.address.line1", + required_field: "payment_method_data.billing.address.line1", display_name: "line1", field_type: "user_address_line1", value: null, }, "billing.address.city": { - required_field: - "payment_method_data.billing.address.city", + required_field: "payment_method_data.billing.address.city", display_name: "city", field_type: "user_address_city", value: null, @@ -918,15 +915,13 @@ export const connectorDetails = { ], required_fields: { "billing.address.line1": { - required_field: - "payment_method_data.billing.address.line1", + required_field: "payment_method_data.billing.address.line1", display_name: "line1", field_type: "user_address_line1", value: null, }, "billing.address.city": { - required_field: - "payment_method_data.billing.address.city", + required_field: "payment_method_data.billing.address.city", display_name: "city", field_type: "user_address_city", value: null, @@ -936,7 +931,7 @@ export const connectorDetails = { ], }, ], - } - } - } + }, + }, + }, }; From cac56697f4e8c35824e21e07288c5813f28f5e97 Mon Sep 17 00:00:00 2001 From: Kashif Date: Mon, 13 Jan 2025 13:18:57 +0530 Subject: [PATCH 6/9] chore: migrate to text based columns for storing JWE based connector_transaction_id --- crates/common_utils/src/types.rs | 8 +-- crates/diesel_models/Cargo.toml | 2 +- crates/diesel_models/src/capture.rs | 16 +++-- crates/diesel_models/src/payment_attempt.rs | 68 ++++++++++--------- crates/diesel_models/src/query/capture.rs | 2 +- crates/diesel_models/src/refund.rs | 45 ++++++------ crates/diesel_models/src/schema.rs | 12 ++-- crates/diesel_models/src/schema_v2.rs | 12 ++-- crates/diesel_models/src/user/sample_data.rs | 2 +- .../src/payments/payment_attempt.rs | 6 +- .../payments/operations/payment_response.rs | 4 +- .../router/src/core/payments/transformers.rs | 4 +- crates/router/src/core/refunds.rs | 32 ++++----- crates/router/src/core/webhooks/incoming.rs | 2 +- crates/router/src/db/capture.rs | 4 +- crates/router/src/db/refund.rs | 14 ++-- .../src/types/storage/payment_attempt.rs | 2 + crates/router/src/utils/user/sample_data.rs | 10 +-- .../src/payments/payment_attempt.rs | 6 +- .../down.sql | 8 +++ .../up.sql | 11 +++ .../down.sql | 51 -------------- .../up.sql | 51 -------------- .../2024-08-28-081721_add_v2_columns/down.sql | 2 +- .../2024-08-28-081721_add_v2_columns/up.sql | 2 +- .../down.sql | 2 +- .../up.sql | 8 +++ 27 files changed, 168 insertions(+), 218 deletions(-) create mode 100644 migrations/2025-01-09-135057_add_processor_transaction_data/down.sql create mode 100644 migrations/2025-01-09-135057_add_processor_transaction_data/up.sql delete mode 100644 migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql delete mode 100644 migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql rename v2_migrations/{2024-10-08-081847_drop_v1_columns => 2025-01-13-081847_drop_v1_columns}/down.sql (98%) rename v2_migrations/{2024-10-08-081847_drop_v1_columns => 2025-01-13-081847_drop_v1_columns}/up.sql (92%) diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index 9e71ca76733f..01feac586666 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -1417,7 +1417,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 { @@ -1435,7 +1435,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 { @@ -1453,10 +1453,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/Cargo.toml b/crates/diesel_models/Cargo.toml index 5da67eb30759..4f02cc4aea87 100644 --- a/crates/diesel_models/Cargo.toml +++ b/crates/diesel_models/Cargo.toml @@ -17,7 +17,7 @@ payment_methods_v2 = [] [dependencies] async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" } -diesel = { version = "2.2.3", features = ["postgres", "serde_json", "time", "64-column-tables"] } +diesel = { version = "2.2.3", features = ["postgres", "serde_json", "time", "128-column-tables"] } error-stack = "0.4.1" rustc-hash = "1.1.0" serde = { version = "1.0.197", features = ["derive"] } diff --git a/crates/diesel_models/src/capture.rs b/crates/diesel_models/src/capture.rs index d6272c34060b..367382b98bf3 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/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs index 03facc2ebab4..734c835b3158 100644 --- a/crates/diesel_models/src/payment_attempt.rs +++ b/crates/diesel_models/src/payment_attempt.rs @@ -170,8 +170,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, } #[cfg(feature = "v1")] @@ -180,7 +182,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, @@ -846,8 +848,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, } #[cfg(feature = "v1")] @@ -1029,7 +1031,7 @@ impl PaymentAttemptUpdate { card_network, shipping_cost, order_tax_amount, - connector_transaction_data, + processor_transaction_data, connector_mandate_detail, } = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source); PaymentAttempt { @@ -1086,8 +1088,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), ..source } @@ -1454,7 +1456,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 { @@ -2139,7 +2141,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, }, PaymentAttemptUpdate::AuthenticationTypeUpdate { @@ -2195,7 +2197,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, }, PaymentAttemptUpdate::ConfirmUpdate { @@ -2282,7 +2284,7 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost, order_tax_amount, - connector_transaction_data: None, + processor_transaction_data: None, connector_mandate_detail, }, PaymentAttemptUpdate::VoidUpdate { @@ -2339,7 +2341,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, }, PaymentAttemptUpdate::RejectUpdate { @@ -2397,7 +2399,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, }, PaymentAttemptUpdate::BlocklistUpdate { @@ -2455,7 +2457,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, }, PaymentAttemptUpdate::ConnectorMandateDetailUpdate { @@ -2511,7 +2513,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::PaymentMethodDetailsUpdate { @@ -2567,7 +2569,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, }, PaymentAttemptUpdate::ResponseUpdate { @@ -2593,7 +2595,7 @@ impl From for PaymentAttemptUpdateInternal { charge_id, connector_mandate_detail, } => { - 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)) @@ -2620,7 +2622,7 @@ impl From for PaymentAttemptUpdateInternal { unified_message, payment_method_data, charge_id, - connector_transaction_data, + processor_transaction_data, amount: None, net_amount: None, currency: None, @@ -2666,7 +2668,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)) @@ -2685,7 +2687,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, @@ -2775,7 +2777,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, }, PaymentAttemptUpdate::UpdateTrackers { @@ -2837,7 +2839,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, }, PaymentAttemptUpdate::UnresolvedResponseUpdate { @@ -2851,7 +2853,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)) @@ -2867,7 +2869,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, @@ -2919,7 +2921,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)) @@ -2933,7 +2935,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, @@ -3032,7 +3034,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, }, PaymentAttemptUpdate::AmountToCaptureUpdate { @@ -3089,7 +3091,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, }, PaymentAttemptUpdate::ConnectorResponse { @@ -3100,7 +3102,7 @@ impl From for PaymentAttemptUpdateInternal { updated_by, charge_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)) @@ -3113,7 +3115,7 @@ impl From for PaymentAttemptUpdateInternal { modified_at: common_utils::date_time::now(), updated_by, charge_id, - connector_transaction_data, + processor_transaction_data, amount: None, net_amount: None, currency: None, @@ -3212,7 +3214,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, }, PaymentAttemptUpdate::AuthenticationUpdate { @@ -3271,7 +3273,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, }, PaymentAttemptUpdate::ManualUpdate { @@ -3284,7 +3286,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)) @@ -3299,7 +3301,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, @@ -3396,7 +3398,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, }, } diff --git a/crates/diesel_models/src/query/capture.rs b/crates/diesel_models/src/query/capture.rs index 7a32e4109617..3f02948d2a42 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 b929481d64d5..f19c3252c609 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 374197d1041b..47eeb3604d00 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -251,8 +251,9 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 1024] + #[max_length = 512] connector_capture_data -> Nullable, + processor_capture_data -> Nullable, } } @@ -886,9 +887,10 @@ diesel::table! { card_network -> Nullable, shipping_cost -> Nullable, order_tax_amount -> Nullable, - #[max_length = 1024] + #[max_length = 512] connector_transaction_data -> Nullable, connector_mandate_detail -> Nullable, + processor_transaction_data -> Nullable, } } @@ -1230,15 +1232,17 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 1024] + #[max_length = 512] connector_refund_data -> Nullable, - #[max_length = 1024] + #[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/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index c1a22f4cd58b..d99ea2497067 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -259,8 +259,7 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 1024] - connector_capture_data -> Nullable, + processor_capture_data -> Nullable, } } @@ -852,8 +851,7 @@ diesel::table! { tax_on_surcharge -> Nullable, payment_method_billing_address -> Nullable, redirection_data -> Nullable, - #[max_length = 1024] - connector_payment_data -> Nullable, + processor_payment_data -> Nullable, #[max_length = 64] id -> Varchar, shipping_cost -> Nullable, @@ -1176,15 +1174,13 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 1024] - connector_refund_data -> Nullable, - #[max_length = 1024] - 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 cfc9e1c4c8ed..7b5bd5161ec6 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, } diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs index 0a7ada39ecdb..841d217809fd 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs @@ -1480,7 +1480,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)) @@ -1547,10 +1547,12 @@ 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, + // Below fields are deprecated. Please add any new fields above this line. + connector_transaction_data: None, }) } diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs index fbc2d2ee4610..555f85ffbde2 100644 --- a/crates/router/src/core/payments/operations/payment_response.rs +++ b/crates/router/src/core/payments/operations/payment_response.rs @@ -1674,7 +1674,7 @@ async fn payment_response_update_tracker( .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) @@ -1690,7 +1690,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 c6686912193a..9ea4311824c1 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -3630,7 +3630,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) } @@ -3644,7 +3644,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 e78c9471e61e..a95d9a4b6ea3 100644 --- a/crates/router/src/core/refunds.rs +++ b/crates/router/src/core/refunds.rs @@ -236,7 +236,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, }) @@ -250,7 +250,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, }) @@ -318,7 +318,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), } @@ -327,7 +327,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); @@ -349,7 +349,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, } @@ -364,7 +364,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, @@ -373,7 +373,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, } } } @@ -669,7 +669,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, } @@ -683,7 +683,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) = @@ -699,13 +699,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, @@ -714,7 +714,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, } } }, @@ -894,7 +894,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(), @@ -924,8 +924,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 @@ -1620,7 +1620,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 474a0c628e29..e77b79981fb2 100644 --- a/crates/router/src/core/webhooks/incoming.rs +++ b/crates/router/src/core/webhooks/incoming.rs @@ -885,7 +885,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 cbc27f918d40..a2e4a90d66db 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 88962f73233a..cfdb9637d2ab 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!( @@ -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 0291374d54f6..62805ab830e8 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 bf84dd568a2a..85ebd1d541b6 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,13 +359,13 @@ 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, }; 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"), @@ -400,8 +400,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 06c7fefe85fa..409a6de0aa6f 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -1432,7 +1432,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)) @@ -1507,10 +1507,12 @@ 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, + // Below fields are deprecated. Please add any new fields above this line. + connector_transaction_data: None, } } 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 000000000000..bbba634e6e27 --- /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 000000000000..81e9cdcd0748 --- /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/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql deleted file mode 100644 index 62d7e2dce485..000000000000 --- a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/down.sql +++ /dev/null @@ -1,51 +0,0 @@ -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'payment_attempt' - AND column_name = 'connector_transaction_data' - ) THEN - ALTER TABLE payment_attempt - ALTER COLUMN connector_transaction_data TYPE VARCHAR(512); - END IF; -END $$; - -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'refund' - AND column_name = 'connector_refund_data' - ) THEN - ALTER TABLE refund - ALTER COLUMN connector_refund_data TYPE VARCHAR(512); - END IF; -END $$; - -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'refund' - AND column_name = 'connector_transaction_data' - ) THEN - ALTER TABLE refund - ALTER COLUMN connector_transaction_data TYPE VARCHAR(512); - END IF; -END $$; - -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'captures' - AND column_name = 'connector_capture_data' - ) THEN - ALTER TABLE captures - ALTER COLUMN connector_capture_data TYPE VARCHAR(512); - END IF; -END $$; \ No newline at end of file diff --git a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql deleted file mode 100644 index 20f783dac794..000000000000 --- a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql +++ /dev/null @@ -1,51 +0,0 @@ -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'payment_attempt' - AND column_name = 'connector_transaction_data' - ) THEN - ALTER TABLE payment_attempt - ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); - END IF; -END $$; - -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'refund' - AND column_name = 'connector_refund_data' - ) THEN - ALTER TABLE refund - ALTER COLUMN connector_refund_data TYPE VARCHAR(1024); - END IF; -END $$; - -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'refund' - AND column_name = 'connector_transaction_data' - ) THEN - ALTER TABLE refund - ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); - END IF; -END $$; - -DO $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM information_schema.columns - WHERE table_name = 'captures' - AND column_name = 'connector_capture_data' - ) THEN - ALTER TABLE captures - ALTER COLUMN connector_capture_data TYPE VARCHAR(1024); - END IF; -END $$; \ No newline at end of file diff --git a/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql b/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql index a4616016abfc..58fe9918df7c 100644 --- a/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql +++ b/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql @@ -42,7 +42,7 @@ ALTER TABLE payment_attempt DROP COLUMN payment_method_type_v2, DROP COLUMN tax_on_surcharge, DROP COLUMN payment_method_billing_address, DROP COLUMN redirection_data, - DROP COLUMN connector_payment_data; + DROP COLUMN processor_payment_data; ALTER TABLE merchant_connector_account ALTER COLUMN payment_methods_enabled TYPE JSON [ ]; 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 4609991ee56d..bf2f04c057d1 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(1024); + ADD COLUMN processor_payment_data TEXT; -- Change the type of the column from JSON to JSONB ALTER TABLE merchant_connector_account diff --git a/v2_migrations/2024-10-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-10-08-081847_drop_v1_columns/down.sql rename to v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql index e06dc3666c64..7ca19fe8e806 100644 --- a/v2_migrations/2024-10-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(1024), + 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-10-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-10-08-081847_drop_v1_columns/up.sql rename to v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql index 276bea10bd51..d7dcaaa2b711 100644 --- a/v2_migrations/2024-10-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, @@ -87,3 +88,10 @@ ALTER TABLE payment_attempt DROP COLUMN attempt_id, DROP COLUMN confirm, DROP COLUMN authentication_data, DROP COLUMN payment_method_billing_address_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; \ No newline at end of file From 63bdc50d9ed1ac5c410b60ebe9c938c51f12786b Mon Sep 17 00:00:00 2001 From: Kashif Date: Mon, 13 Jan 2025 13:56:40 +0530 Subject: [PATCH 7/9] chore(integration): [worldpay] make city and line1 non optional --- .../src/connectors/worldpay/requests.rs | 6 ++---- .../src/connectors/worldpay/transformers.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs index 884caa9e840b..671971d69ea2 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs @@ -137,14 +137,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 ec23b520a200..69add9a199a8 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs @@ -88,10 +88,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" }, From 77576d2b21bd3b76b640dbbce5a0c080ca5bb43b Mon Sep 17 00:00:00 2001 From: Kashif Date: Mon, 13 Jan 2025 20:18:06 +0530 Subject: [PATCH 8/9] chore: enable 128-column-tables feature for diesel in common_enums --- crates/common_enums/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/common_enums/Cargo.toml b/crates/common_enums/Cargo.toml index 92fc2f02066b..5db5393644aa 100644 --- a/crates/common_enums/Cargo.toml +++ b/crates/common_enums/Cargo.toml @@ -13,7 +13,7 @@ openapi = [] payouts = [] [dependencies] -diesel = { version = "2.2.3", features = ["postgres"] } +diesel = { version = "2.2.3", features = ["postgres", "128-column-tables"] } serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0.115" strum = { version = "0.26", features = ["derive"] } From 4a5be80478aea49b336ec08500141e27943e2095 Mon Sep 17 00:00:00 2001 From: Kashif Date: Thu, 23 Jan 2025 12:47:42 +0530 Subject: [PATCH 9/9] chore: revert v2 fields --- crates/diesel_models/src/schema_v2.rs | 2 +- v2_migrations/2024-08-28-081721_add_v2_columns/down.sql | 2 +- v2_migrations/2024-08-28-081721_add_v2_columns/up.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index e191af0b30d9..0a87d365611d 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -867,7 +867,7 @@ diesel::table! { tax_on_surcharge -> Nullable, payment_method_billing_address -> Nullable, redirection_data -> Nullable, - processor_payment_data -> Nullable, + connector_payment_data -> Nullable, #[max_length = 64] id -> Varchar, shipping_cost -> Nullable, diff --git a/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql b/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql index 58fe9918df7c..a4616016abfc 100644 --- a/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql +++ b/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql @@ -42,7 +42,7 @@ ALTER TABLE payment_attempt DROP COLUMN payment_method_type_v2, DROP COLUMN tax_on_surcharge, DROP COLUMN payment_method_billing_address, DROP COLUMN redirection_data, - DROP COLUMN processor_payment_data; + DROP COLUMN connector_payment_data; ALTER TABLE merchant_connector_account ALTER COLUMN payment_methods_enabled TYPE JSON [ ]; 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 bf2f04c057d1..74f7746b9a07 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 processor_payment_data TEXT; + ADD COLUMN connector_payment_data TEXT; -- Change the type of the column from JSON to JSONB ALTER TABLE merchant_connector_account