From a8da583bca943039bec3be3bf0eb0eda2db778d6 Mon Sep 17 00:00:00 2001 From: Narayan Bhat <48803246+Narayanbhat166@users.noreply.github.com> Date: Sat, 4 Mar 2023 11:25:46 +0530 Subject: [PATCH] refactor: rename statement descriptor to statement descriptor name (#711) --- crates/api_models/src/payments.rs | 4 ++-- .../router/src/compatibility/stripe/payment_intents/types.rs | 4 ++-- crates/router/src/compatibility/stripe/setup_intents/types.rs | 2 +- crates/router/src/core/payments/operations/payment_create.rs | 2 +- crates/router/src/core/payments/transformers.rs | 2 +- crates/router/tests/payments.rs | 4 ++-- crates/router/tests/payments2.rs | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 54ff974047..8c68ab0bb9 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -155,7 +155,7 @@ pub struct PaymentsRequest { /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters. #[schema(max_length = 255, example = "Hyperswitch Router")] - pub statement_descriptor: Option, + pub statement_descriptor_name: Option, /// Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. #[schema(max_length = 255, example = "Payment for shoes purchase")] @@ -862,7 +862,7 @@ pub struct PaymentsResponse { pub authentication_type: Option, /// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters. #[schema(max_length = 255, example = "Hyperswitch Router")] - pub statement_descriptor: Option, + pub statement_descriptor_name: Option, /// Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 255 characters for the concatenated descriptor. #[schema(max_length = 255, example = "Payment for shoes purchase")] pub statement_descriptor_suffix: Option, diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index 5c11ceb7a7..077917813a 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -181,7 +181,7 @@ impl TryFrom for payments::PaymentsRequest { .billing_details .as_ref() .map(|b| payments::Address::from(b.to_owned())), - statement_descriptor: item.statement_descriptor, + statement_descriptor_name: item.statement_descriptor, statement_descriptor_suffix: item.statement_descriptor_suffix, metadata: item.metadata, client_secret: item.client_secret.map(|s| s.peek().clone()), @@ -336,7 +336,7 @@ impl From for StripePaymentIntentResponse { name: resp.name, phone: resp.phone, authentication_type: resp.authentication_type, - statement_descriptor_name: resp.statement_descriptor, + statement_descriptor_name: resp.statement_descriptor_name, statement_descriptor_suffix: resp.statement_descriptor_suffix, next_action: into_stripe_next_action(resp.next_action, resp.return_url), cancellation_reason: resp.cancellation_reason, diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index 86e1e73fdc..d9e58f3fe5 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -159,7 +159,7 @@ impl From for payments::PaymentsRequest { .billing_details .as_ref() .map(|b| payments::Address::from(b.to_owned())), - statement_descriptor: item.statement_descriptor, + statement_descriptor_name: item.statement_descriptor, statement_descriptor_suffix: item.statement_descriptor_suffix, metadata: item.metadata, client_secret: item.client_secret.map(|s| s.peek().clone()), diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index fac63910a3..ee20cdc4df 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -500,7 +500,7 @@ impl PaymentCreate { return_url: request.return_url.as_ref().map(|a| a.to_string()), shipping_address_id, billing_address_id, - statement_descriptor_name: request.statement_descriptor.clone(), + statement_descriptor_name: request.statement_descriptor_name.clone(), statement_descriptor_suffix: request.statement_descriptor_suffix.clone(), metadata, ..storage::PaymentIntentNew::default() diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 5f4c510ed0..9c0d3833cb 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -324,7 +324,7 @@ where .authentication_type .map(ForeignInto::foreign_into), ) - .set_statement_descriptor(payment_intent.statement_descriptor_name) + .set_statement_descriptor_name(payment_intent.statement_descriptor_name) .set_statement_descriptor_suffix(payment_intent.statement_descriptor_suffix) .set_setup_future_usage( payment_intent diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs index e94069ad81..b6df347993 100644 --- a/crates/router/tests/payments.rs +++ b/crates/router/tests/payments.rs @@ -317,7 +317,7 @@ async fn payments_create_core() { address: None, phone: None, }), - statement_descriptor: Some("Hyperswtich".to_string()), + statement_descriptor_name: Some("Hyperswtich".to_string()), statement_descriptor_suffix: Some("Hyperswitch".to_string()), ..Default::default() }; @@ -463,7 +463,7 @@ async fn payments_create_core_adyen_no_redirect() { address: None, phone: None, }), - statement_descriptor: Some("Juspay".to_string()), + statement_descriptor_name: Some("Juspay".to_string()), statement_descriptor_suffix: Some("Router".to_string()), ..Default::default() }; diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs index c55a923223..d38b0b6d43 100644 --- a/crates/router/tests/payments2.rs +++ b/crates/router/tests/payments2.rs @@ -77,7 +77,7 @@ async fn payments_create_core() { address: None, phone: None, }), - statement_descriptor: Some("Hyperswitch".to_string()), + statement_descriptor_name: Some("Hyperswitch".to_string()), statement_descriptor_suffix: Some("Hyperswitch".to_string()), ..<_>::default() }; @@ -229,7 +229,7 @@ async fn payments_create_core_adyen_no_redirect() { address: None, phone: None, }), - statement_descriptor: Some("Juspay".to_string()), + statement_descriptor_name: Some("Juspay".to_string()), statement_descriptor_suffix: Some("Router".to_string()), ..Default::default() };