Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(address): add payment method billing details (#3812)

Narayan Bhat33f07419abb7
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 91a289652b..9a3afd2f0f 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -253,7 +253,7 @@ pub struct PaymentsRequest {
#[schema(value_type = Option<AuthenticationType>, example = "no_three_ds", default = "three_ds")]
pub authentication_type: Option<api_enums::AuthenticationType>,
- /// The billing details of the customer
+ /// The billing details of the payment. This address will be used for invoicing.
pub billing: Option<Address>,
/// A timestamp (ISO 8601 code) that determines when the payment should be captured.
@@ -309,7 +309,7 @@ pub struct PaymentsRequest {
/// The payment method information provided for making a payment
#[schema(example = "bank_transfer")]
- pub payment_method_data: Option<PaymentMethodData>,
+ pub payment_method_data: Option<PaymentMethodDataRequest>,
/// The payment method that is to be used
#[schema(value_type = Option<PaymentMethod>, example = "card")]
@@ -1049,6 +1049,16 @@ pub enum BankDebitData {
},
}
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)]
+pub struct PaymentMethodDataRequest {
+ #[serde(flatten)]
+ pub payment_method_data: PaymentMethodData,
+ /// billing details for the payment method.
+ /// This billing details will be passed to the processor as billing address.
+ /// If not passed, then payment.billing will be considered
+ pub billing: Option<Address>,
+}
+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum PaymentMethodData {
@@ -1921,20 +1931,28 @@ pub enum VoucherData {
pub enum PaymentMethodDataResponse {
#[serde(rename = "card")]
Card(Box<CardResponse>),
- BankTransfer,
- Wallet,
- PayLater,
- Paypal,
- BankRedirect,
- Crypto,
- BankDebit,
- MandatePayment,
- Reward,
- Upi,
- Voucher,
- GiftCard,
- CardRedirect,
- CardToken,
+ BankTransfer {},
+ Wallet {},
+ PayLater {},
+ Paypal {},
+ BankRedirect {},
+ Crypto {},
+ BankDebit {},
+ MandatePayment {},
+ Reward {},
+ Upi {},
+ Voucher {},
+ GiftCard {},
+ CardRedirect {},
+ CardToken {},
+}
+
+#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct PaymentMethodDataResponseWithBilling {
+ // The struct is flattened in order to provide backwards compatibility
+ #[serde(flatten)]
+ pub payment_method_data: PaymentMethodDataResponse,
+ pub billing: Option<Address>,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -2369,7 +2387,7 @@ pub struct PaymentsResponse {
/// The payment method information provided for making a payment
#[schema(value_type = Option<PaymentMethod>, example = "bank_transfer")]
#[auth_based]
- pub payment_method_data: Option<PaymentMethodDataResponse>,
+ pub payment_method_data: Option<PaymentMethodDataResponseWithBilling>,
/// Provide a reference to a stored payment method
#[schema(example = "187282ab-40ef-47a9-9206-5099ba31e432")]
@@ -2790,19 +2808,19 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
fn from(payment_method_data: AdditionalPaymentData) -> Self {
match payment_method_data {
AdditionalPaymentData::Card(card) => Self::Card(Box::new(CardResponse::from(*card))),
- AdditionalPaymentData::PayLater {} => Self::PayLater,
- AdditionalPaymentData::Wallet {} => Self::Wallet,
- AdditionalPaymentData::BankRedirect { .. } => Self::BankRedirect,
- AdditionalPaymentData::Crypto {} => Self::Crypto,
- AdditionalPaymentData::BankDebit {} => Self::BankDebit,
- AdditionalPaymentData::MandatePayment {} => Self::MandatePayment,
- AdditionalPaymentData::Reward {} => Self::Reward,
- AdditionalPaymentData::Upi {} => Self::Upi,
- AdditionalPaymentData::BankTransfer {} => Self::BankTransfer,
- AdditionalPaymentData::Voucher {} => Self::Voucher,
- AdditionalPaymentData::GiftCard {} => Self::GiftCard,
- AdditionalPaymentData::CardRedirect {} => Self::CardRedirect,
- AdditionalPaymentData::CardToken {} => Self::CardToken,
+ AdditionalPaymentData::PayLater {} => Self::PayLater {},
+ AdditionalPaymentData::Wallet {} => Self::Wallet {},
+ AdditionalPaymentData::BankRedirect { .. } => Self::BankRedirect {},
+ AdditionalPaymentData::Crypto {} => Self::Crypto {},
+ AdditionalPaymentData::BankDebit {} => Self::BankDebit {},
+ AdditionalPaymentData::MandatePayment {} => Self::MandatePayment {},
+ AdditionalPaymentData::Reward {} => Self::Reward {},
+ AdditionalPaymentData::Upi {} => Self::Upi {},
+ AdditionalPaymentData::BankTransfer {} => Self::BankTransfer {},
+ AdditionalPaymentData::Voucher {} => Self::Voucher {},
+ AdditionalPaymentData::GiftCard {} => Self::GiftCard {},
+ AdditionalPaymentData::CardRedirect {} => Self::CardRedirect {},
+ AdditionalPaymentData::CardToken {} => Self::CardToken {},
}
}
}
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index 3e187e25bc..f8af02857f 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -160,6 +160,7 @@ pub struct PaymentAttempt {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub mandate_data: Option<MandateDetails>,
+ pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
}
@@ -239,6 +240,7 @@ pub struct PaymentAttemptNew {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub mandate_data: Option<MandateDetails>,
+ pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
}
@@ -310,6 +312,7 @@ pub enum PaymentAttemptUpdate {
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
merchant_connector_id: Option<String>,
+ payment_method_billing_address_id: Option<String>,
fingerprint_id: Option<String>,
},
RejectUpdate {
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 927a05bfa5..e1e3956034 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -66,6 +66,7 @@ pub struct PaymentAttempt {
pub net_amount: Option<i64>,
pub mandate_data: Option<storage_enums::MandateDetails>,
pub fingerprint_id: Option<String>,
+ pub payment_method_billing_address_id: Option<String>,
}
impl PaymentAttempt {
@@ -142,6 +143,7 @@ pub struct PaymentAttemptNew {
pub net_amount: Option<i64>,
pub mandate_data: Option<storage_enums::MandateDetails>,
pub fingerprint_id: Option<String>,
+ pub payment_method_billing_address_id: Option<String>,
}
impl PaymentAttemptNew {
@@ -218,6 +220,7 @@ pub enum PaymentAttemptUpdate {
fingerprint_id: Option<String>,
updated_by: String,
merchant_connector_id: Option<String>,
+ payment_method_billing_address_id: Option<String>,
},
VoidUpdate {
status: storage_enums::AttemptStatus,
@@ -356,6 +359,7 @@ pub struct PaymentAttemptUpdateInternal {
unified_code: Option<Option<String>>,
unified_message: Option<Option<String>>,
fingerprint_id: Option<String>,
+ payment_method_billing_address_id: Option<String>,
}
impl PaymentAttemptUpdateInternal {
@@ -416,6 +420,7 @@ impl PaymentAttemptUpdate {
encoded_data,
unified_code,
unified_message,
+ payment_method_billing_address_id,
fingerprint_id,
} = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source);
PaymentAttempt {
@@ -458,6 +463,8 @@ impl PaymentAttemptUpdate {
encoded_data: encoded_data.or(source.encoded_data),
unified_code: unified_code.unwrap_or(source.unified_code),
unified_message: unified_message.unwrap_or(source.unified_message),
+ payment_method_billing_address_id: payment_method_billing_address_id
+ .or(source.payment_method_billing_address_id),
fingerprint_id: fingerprint_id.or(source.fingerprint_id),
..source
}
@@ -536,6 +543,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
merchant_connector_id,
surcharge_amount,
tax_amount,
+ payment_method_billing_address_id,
fingerprint_id,
} => Self {
amount: Some(amount),
@@ -559,6 +567,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
merchant_connector_id: merchant_connector_id.map(Some),
surcharge_amount,
tax_amount,
+ payment_method_billing_address_id,
fingerprint_id,
..Default::default()
},
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 9db9f8c2d4..35239ce026 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -695,6 +695,8 @@ diesel::table! {
mandate_data -> Nullable<Jsonb>,
#[max_length = 64]
fingerprint_id -> Nullable<Varchar>,
+ #[max_length = 64]
+ payment_method_billing_address_id -> Nullable<Varchar>,
}
}
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index beac5b0733..67f6cceca1 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -68,6 +68,7 @@ pub struct PaymentAttemptBatchNew {
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
pub mandate_data: Option<MandateDetails>,
+ pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
}
@@ -123,6 +124,7 @@ impl PaymentAttemptBatchNew {
unified_message: self.unified_message,
net_amount: self.net_amount,
mandate_data: self.mandate_data,
+ payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
}
}
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index e21797d2ee..7c97fba353 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -295,6 +295,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::MandateData,
api_models::payments::PhoneDetails,
api_models::payments::PaymentMethodData,
+ api_models::payments::PaymentMethodDataRequest,
api_models::payments::MandateType,
api_models::payments::AcceptanceType,
api_models::payments::MandateAmountData,
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 22f03c92cc..7d876b954b 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -336,7 +336,10 @@ impl TryFrom<StripePaymentIntentRequest> for payments::PaymentsRequest {
payment_method_data: item.payment_method_data.as_ref().and_then(|pmd| {
pmd.payment_method_details
.as_ref()
- .map(|spmd| payments::PaymentMethodData::from(spmd.to_owned()))
+ .map(|spmd| payments::PaymentMethodDataRequest {
+ payment_method_data: payments::PaymentMethodData::from(spmd.to_owned()),
+ billing: pmd.billing_details.clone().map(payments::Address::from),
+ })
}),
payment_method: item
.payment_method_data
@@ -535,7 +538,7 @@ impl From<payments::PaymentsResponse> for StripePaymentIntentResponse {
capture_on: resp.capture_on,
capture_method: resp.capture_method,
payment_method: resp.payment_method,
- payment_method_data: resp.payment_method_data.clone(),
+ payment_method_data: resp.payment_method_data.map(|pmd| pmd.payment_method_data),
payment_token: resp.payment_token,
shipping: resp.shipping,
billing: resp.billing,
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 4dcea1c4fe..25bb5a35b8 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -247,7 +247,10 @@ impl TryFrom<StripeSetupIntentRequest> for payments::PaymentsRequest {
payment_method_data: item.payment_method_data.as_ref().and_then(|pmd| {
pmd.payment_method_details
.as_ref()
- .map(|spmd| payments::PaymentMethodData::from(spmd.to_owned()))
+ .map(|spmd| payments::PaymentMethodDataRequest {
+ payment_method_data: payments::PaymentMethodData::from(spmd.to_owned()),
+ billing: pmd.billing_details.clone().map(payments::Address::from),
+ })
}),
payment_method: item
.payment_method_data
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 8c00938cad..4f69185921 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1177,8 +1177,8 @@ pub async fn list_payment_methods(
db,
pi.shipping_address_id.clone(),
&key_store,
- pi.payment_id.clone(),
- merchant_account.merchant_id.clone(),
+ &pi.payment_id,
+ &merchant_account.merchant_id,
merchant_account.storage_scheme,
)
.await
@@ -1194,8 +1194,8 @@ pub async fn list_payment_methods(
db,
pi.billing_address_id.clone(),
&key_store,
- pi.payment_id.clone(),
- merchant_account.merchant_id.clone(),
+ &pi.payment_id,
+ &merchant_account.merchant_id,
merchant_account.storage_scheme,
)
.await
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 782d1814cc..7e8fa2ae44 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -2026,6 +2026,7 @@ pub enum CallConnectorAction {
pub struct PaymentAddress {
pub shipping: Option<api::Address>,
pub billing: Option<api::Address>,
+ pub payment_method_billing: Option<api::Address>,
}
#[derive(Clone)]
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e0b8a5f623..d711bca7ab 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -387,16 +387,16 @@ pub async fn get_address_by_id(
db: &dyn StorageInterface,
address_id: Option<String>,
merchant_key_store: &domain::MerchantKeyStore,
- payment_id: String,
- merchant_id: String,
+ payment_id: &str,
+ merchant_id: &str,
storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Option<domain::Address>, errors::ApiErrorResponse> {
match address_id {
None => Ok(None),
Some(address_id) => Ok(db
.find_address_by_merchant_id_payment_id_address_id(
- &merchant_id,
- &payment_id,
+ merchant_id,
+ payment_id,
&address_id,
merchant_key_store,
storage_scheme,
@@ -994,7 +994,7 @@ pub fn verify_mandate_details(
#[instrument(skip_all)]
pub fn payment_attempt_status_fsm(
- payment_method_data: &Option<api::PaymentMethodData>,
+ payment_method_data: &Option<api::payments::PaymentMethodDataRequest>,
confirm: Option<bool>,
) -> storage_enums::AttemptStatus {
match payment_method_data {
@@ -1007,7 +1007,7 @@ pub fn payment_attempt_status_fsm(
}
pub fn payment_intent_status_fsm(
- payment_method_data: &Option<api::PaymentMethodData>,
+ payment_method_data: &Option<api::PaymentMethodDataRequest>,
confirm: Option<bool>,
) -> storage_enums::IntentStatus {
match payment_method_data {
@@ -1948,7 +1948,7 @@ pub(crate) fn validate_payment_method_fields_present(
.map_or(Ok(()), |req_payment_method_data| {
req.payment_method.map_or(Ok(()), |req_payment_method| {
validate_payment_method_and_payment_method_data(
- req_payment_method_data,
+ req_payment_method_data.payment_method_data,
req_payment_method,
)
})
@@ -3140,7 +3140,7 @@ impl AttemptType {
// In case if fields are not overridden by the request then they contain the same data that was in the previous attempt provided it is populated in this function.
#[inline(always)]
fn make_new_payment_attempt(
- payment_method_data: &Option<api_models::payments::PaymentMethodData>,
+ payment_method_data: &Option<api_models::payments::PaymentMethodDataRequest>,
old_payment_attempt: PaymentAttempt,
new_attempt_count: i16,
storage_scheme: enums::MerchantStorageScheme,
@@ -3212,6 +3212,8 @@ impl AttemptType {
unified_message: None,
net_amount: old_payment_attempt.amount,
mandate_data: old_payment_attempt.mandate_data,
+ // New payment method billing address can be passed for a retry
+ payment_method_billing_address_id: None,
fingerprint_id: None,
}
}
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index ce3998506c..caca29d8e2 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -96,25 +96,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
currency = payment_attempt.currency.get_required_value("currency")?;
amount = payment_attempt.get_total_amount().into();
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
+ payment_intent.shipping_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+
+ let billing_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -144,6 +151,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index fecf397101..097b7ab40e 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -78,26 +78,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
+ payment_intent.shipping_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+ let billing_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -153,6 +159,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index acf2ce4311..e9d520e4ab 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -127,26 +127,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
amount = payment_attempt.get_total_amount().into();
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
+ payment_intent.shipping_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+ let billing_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -198,6 +204,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: payments::PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 6bbe1c89a4..f7e7598cf7 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -120,7 +120,10 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
if should_validate_pm_or_token_given {
helpers::validate_pm_or_token_given(
&request.payment_method,
- &request.payment_method_data,
+ &request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
&request.payment_method_type,
&mandate_type,
&token,
@@ -146,25 +149,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.or_else(|| request.customer_id.clone()),
)?;
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- request.shipping.as_ref(),
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
+ payment_intent.shipping_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+
+ let billing_address = helpers::get_address_by_id(
db,
- request.billing.as_ref(),
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -233,9 +243,15 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: request.confirm,
- payment_method_data: request.payment_method_data.clone(),
+ payment_method_data: request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
force_sync: None,
refunds: vec![],
disputes: vec![],
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 2d2ee0e872..5c47c3f323 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -96,6 +96,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.in_current_span(),
);
+ // Parallel calls - level 0
let (mut payment_intent, mandate_details) = tokio::try_join!(
utils::flatten_join_error(payment_intent_fut),
utils::flatten_join_error(mandate_details_fut)
@@ -271,6 +272,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
| api_models::enums::IntentStatus::RequiresPaymentMethod
| api_models::enums::IntentStatus::RequiresConfirmation => {
// Normal payment
+ // Parallel calls - level 1
let (payment_attempt, shipping_address, billing_address, business_profile, _) =
tokio::try_join!(
utils::flatten_join_error(payment_attempt_fut),
@@ -360,13 +362,21 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
field_name: "browser_info",
})?;
- helpers::validate_card_data(request.payment_method_data.clone())?;
+ helpers::validate_card_data(
+ request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
+ )?;
let token = token.or_else(|| payment_attempt.payment_token.clone());
helpers::validate_pm_or_token_given(
&request.payment_method,
- &request.payment_method_data,
+ &request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
&request.payment_method_type,
&mandate_type,
&token,
@@ -399,8 +409,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.as_ref()
.map(|mcd| mcd.creds_identifier.to_owned());
- payment_intent.shipping_address_id = shipping_address.clone().map(|i| i.address_id);
- payment_intent.billing_address_id = billing_address.clone().map(|i| i.address_id);
+ payment_intent.shipping_address_id =
+ shipping_address.as_ref().map(|i| i.address_id.clone());
+ payment_intent.billing_address_id = billing_address.as_ref().map(|i| i.address_id.clone());
payment_intent.return_url = request
.return_url
.as_ref()
@@ -450,21 +461,74 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
sm
});
- let additional_pm_data = request
+ let n_request_payment_method_data = request
.payment_method_data
.as_ref()
- .async_map(|payment_method_data| async {
- helpers::get_additional_payment_data(payment_method_data, &*state.store).await
- })
- .await;
+ .map(|pmd| pmd.payment_method_data.clone());
+
+ let store = state.clone().store;
+
+ let additional_pm_data_fut = tokio::spawn(async move {
+ Ok(n_request_payment_method_data
+ .async_map(|payment_method_data| async move {
+ helpers::get_additional_payment_data(&payment_method_data, store.as_ref()).await
+ })
+ .await)
+ });
+
+ let store = state.clone().store;
+
+ let n_payment_method_billing_address_id =
+ payment_attempt.payment_method_billing_address_id.clone();
+ let n_request_payment_method_billing_address = request
+ .payment_method_data
+ .as_ref()
+ .and_then(|pmd| pmd.billing.clone());
+ let m_payment_intent_customer_id = payment_intent.customer_id.clone();
+ let m_payment_intent_payment_id = payment_intent.payment_id.clone();
+ let m_key_store = key_store.clone();
+ let m_customer_details_customer_id = customer_details.customer_id.clone();
+ let m_merchant_id = merchant_id.clone();
+
+ let payment_method_billing_future = tokio::spawn(
+ async move {
+ helpers::create_or_update_address_for_payment_by_request(
+ store.as_ref(),
+ n_request_payment_method_billing_address.as_ref(),
+ n_payment_method_billing_address_id.as_deref(),
+ m_merchant_id.as_str(),
+ m_payment_intent_customer_id
+ .as_ref()
+ .or(m_customer_details_customer_id.as_ref()),
+ &m_key_store,
+ m_payment_intent_payment_id.as_ref(),
+ storage_scheme,
+ )
+ .await
+ }
+ .in_current_span(),
+ );
+
+ // Parallel calls - level 2
+ let (additional_pm_data, payment_method_billing) = tokio::try_join!(
+ utils::flatten_join_error(additional_pm_data_fut),
+ utils::flatten_join_error(payment_method_billing_future),
+ )?;
+
let payment_method_data_after_card_bin_call = request
.payment_method_data
.as_ref()
.zip(additional_pm_data)
.map(|(payment_method_data, additional_payment_data)| {
- payment_method_data.apply_additional_payment_data(additional_payment_data)
+ payment_method_data
+ .payment_method_data
+ .apply_additional_payment_data(additional_payment_data)
});
+ payment_attempt.payment_method_billing_address_id = payment_method_billing
+ .as_ref()
+ .map(|payment_method_billing| payment_method_billing.address_id.clone());
+
let payment_data = PaymentData {
flow: PhantomData,
payment_intent,
@@ -479,6 +543,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: request.confirm,
payment_method_data: payment_method_data_after_card_bin_call,
@@ -705,9 +772,13 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
let business_sub_label = payment_data.payment_attempt.business_sub_label.clone();
let authentication_type = payment_data.payment_attempt.authentication_type;
- let (shipping_address, billing_address) = (
+ let (shipping_address_id, billing_address_id, payment_method_billing_address_id) = (
payment_data.payment_intent.shipping_address_id.clone(),
payment_data.payment_intent.billing_address_id.clone(),
+ payment_data
+ .payment_attempt
+ .payment_method_billing_address_id
+ .clone(),
);
let customer_id = customer.clone().map(|c| c.customer_id);
@@ -775,6 +846,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
merchant_connector_id,
surcharge_amount,
tax_amount,
+ payment_method_billing_address_id,
fingerprint_id: m_fingerprint_id,
},
storage_scheme,
@@ -787,8 +859,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
let m_payment_data_payment_intent = payment_data.payment_intent.clone();
let m_customer_id = customer_id.clone();
- let m_shipping_address_id = shipping_address.clone();
- let m_billing_address_id = billing_address.clone();
+ let m_shipping_address_id = shipping_address_id.clone();
+ let m_billing_address_id = billing_address_id.clone();
let m_return_url = return_url.clone();
let m_business_label = business_label.clone();
let m_description = description.clone();
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index f4db64dcfb..11ab21b891 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -146,6 +146,22 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
)
.await?;
+ let payment_method_billing_address =
+ helpers::create_or_find_address_for_payment_by_request(
+ db,
+ request
+ .payment_method_data
+ .as_ref()
+ .and_then(|pmd| pmd.billing.as_ref()),
+ None,
+ merchant_id,
+ customer_details.customer_id.as_ref(),
+ merchant_key_store,
+ &payment_id,
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
let browser_info = request
.browser_info
.clone()
@@ -216,9 +232,13 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
merchant_account,
money,
request,
- shipping_address.clone().map(|x| x.address_id),
+ shipping_address
+ .as_ref()
+ .map(|address| address.address_id.clone()),
payment_link_data.clone(),
- billing_address.clone().map(|x| x.address_id),
+ billing_address
+ .as_ref()
+ .map(|address| address.address_id.clone()),
attempt_id,
profile_id,
session_expiry,
@@ -234,6 +254,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
request,
browser_info,
state,
+ payment_method_billing_address
+ .as_ref()
+ .map(|address| address.address_id.clone()),
)
.await?;
@@ -341,7 +364,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.as_ref()
.zip(additional_payment_data)
.map(|(payment_method_data, additional_payment_data)| {
- payment_method_data.apply_additional_payment_data(additional_payment_data)
+ payment_method_data
+ .payment_method_data
+ .apply_additional_payment_data(additional_payment_data)
});
let amount = payment_attempt.get_total_amount().into();
let payment_data = PaymentData {
@@ -358,6 +383,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing_address
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: request.confirm,
payment_method_data: payment_method_data_after_card_bin_call,
@@ -624,7 +652,12 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::Paymen
})?;
helpers::validate_amount_to_capture_and_capture_method(None, request)?;
- helpers::validate_card_data(request.payment_method_data.clone())?;
+ helpers::validate_card_data(
+ request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
+ )?;
helpers::validate_payment_method_fields_present(request)?;
@@ -634,7 +667,10 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::Paymen
if request.confirm.unwrap_or(false) {
helpers::validate_pm_or_token_given(
&request.payment_method,
- &request.payment_method_data,
+ &request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
&request.payment_method_type,
&mandate_type,
&request.payment_token,
@@ -678,6 +714,7 @@ impl PaymentCreate {
request: &api::PaymentsRequest,
browser_info: Option<serde_json::Value>,
state: &AppState,
+ payment_method_billing_address_id: Option<String>,
) -> RouterResult<(
storage::PaymentAttemptNew,
Option<api_models::payments::AdditionalPaymentData>,
@@ -691,7 +728,11 @@ impl PaymentCreate {
.payment_method_data
.as_ref()
.async_map(|payment_method_data| async {
- helpers::get_additional_payment_data(payment_method_data, &*state.store).await
+ helpers::get_additional_payment_data(
+ &payment_method_data.payment_method_data,
+ &*state.store,
+ )
+ .await
})
.await;
let additional_pm_data_value = additional_pm_data
@@ -765,6 +806,7 @@ impl PaymentCreate {
.as_ref()
.and_then(|inner| inner.mandate_type.clone().map(Into::into)),
mandate_data,
+ payment_method_billing_address_id,
..storage::PaymentAttemptNew::default()
},
additional_pm_data,
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 02d2e953c1..281ffdd06f 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -77,26 +77,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
+ payment_intent.shipping_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+ let billing_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -141,6 +147,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 7db174313d..966600a549 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -85,26 +85,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
let amount = payment_attempt.get_total_amount().into();
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
+ payment_intent.shipping_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+ let billing_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -166,6 +172,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: payments::PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 79130b211a..2ca413b73a 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -40,7 +40,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
_request: &api::PaymentsStartRequest,
_mandate_type: Option<api::MandateTransactionType>,
merchant_account: &domain::MerchantAccount,
- mechant_key_store: &domain::MerchantKeyStore,
+ key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_payment_confirm_source: Option<common_enums::PaymentSource>,
) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsStartRequest, Ctx>> {
@@ -84,25 +84,32 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
currency = payment_attempt.currency.get_required_value("currency")?;
amount = payment_attempt.get_total_amount().into();
- let shipping_address = helpers::create_or_find_address_for_payment_by_request(
+ let shipping_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent.customer_id.as_ref(),
- mechant_key_store,
+ payment_intent.shipping_address_id.clone(),
+ key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
- let billing_address = helpers::create_or_find_address_for_payment_by_request(
+
+ let billing_address = helpers::get_address_by_id(
db,
- None,
- payment_intent.billing_address_id.as_deref(),
+ payment_intent.billing_address_id.clone(),
+ key_store,
+ &payment_intent.payment_id,
merchant_id,
- payment_intent.customer_id.as_ref(),
- mechant_key_store,
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
+ key_store,
&payment_intent.payment_id,
+ merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -142,6 +149,9 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: Some(payment_attempt.confirm),
payment_attempt,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index ed96feb2b5..aa622b3558 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -259,8 +259,8 @@ async fn get_tracker_for_sync<
db,
payment_intent.shipping_address_id.clone(),
mechant_key_store,
- payment_intent.payment_id.clone(),
- merchant_account.merchant_id.clone(),
+ &payment_intent.payment_id.clone(),
+ &merchant_account.merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -268,8 +268,18 @@ async fn get_tracker_for_sync<
db,
payment_intent.billing_address_id.clone(),
mechant_key_store,
- payment_intent.payment_id.clone(),
- merchant_account.merchant_id.clone(),
+ &payment_intent.payment_id.clone(),
+ &merchant_account.merchant_id,
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
+ let payment_method_billing = helpers::get_address_by_id(
+ db,
+ payment_attempt.payment_method_billing_address_id.clone(),
+ mechant_key_store,
+ &payment_intent.payment_id.clone(),
+ &merchant_account.merchant_id,
merchant_account.storage_scheme,
)
.await?;
@@ -408,6 +418,9 @@ async fn get_tracker_for_sync<
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing
+ .as_ref()
+ .map(|address| address.into()),
},
confirm: Some(request.force_sync),
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 494db2b852..cd73df26ff 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -75,7 +75,12 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
helpers::validate_customer_access(&payment_intent, auth_flow, request)?;
- helpers::validate_card_data(request.payment_method_data.clone())?;
+ helpers::validate_card_data(
+ request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
+ )?;
helpers::validate_payment_status_against_not_allowed_statuses(
&payment_intent.status,
@@ -193,6 +198,24 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
)
.await?;
+ let payment_method_billing = helpers::create_or_update_address_for_payment_by_request(
+ db,
+ request
+ .payment_method_data
+ .as_ref()
+ .and_then(|pmd| pmd.billing.as_ref()),
+ payment_attempt.payment_method_billing_address_id.as_deref(),
+ merchant_id,
+ payment_intent
+ .customer_id
+ .as_ref()
+ .or(customer_details.customer_id.as_ref()),
+ key_store,
+ &payment_intent.payment_id,
+ merchant_account.storage_scheme,
+ )
+ .await?;
+
payment_intent.shipping_address_id = shipping_address.clone().map(|x| x.address_id);
payment_intent.billing_address_id = billing_address.clone().map(|x| x.address_id);
@@ -221,7 +244,10 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
if request.confirm.unwrap_or(false) {
helpers::validate_pm_or_token_given(
&request.payment_method,
- &request.payment_method_data,
+ &request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
&request.payment_method_type,
&mandate_type,
&token,
@@ -356,9 +382,13 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
+ payment_method_billing: payment_method_billing.as_ref().map(|a| a.into()),
},
confirm: request.confirm,
- payment_method_data: request.payment_method_data.clone(),
+ payment_method_data: request
+ .payment_method_data
+ .as_ref()
+ .map(|pmd| pmd.payment_method_data.clone()),
force_sync: None,
refunds: vec![],
disputes: vec![],
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index 36095a1b7e..24292507c0 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -124,6 +124,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
address: PaymentAddress {
billing: None,
shipping: None,
+ payment_method_billing: None,
},
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 6cf547f668..7c7bac80cf 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -452,9 +452,16 @@ where
let merchant_decision = payment_intent.merchant_decision.to_owned();
let frm_message = payment_data.frm_message.map(FrmMessage::foreign_from);
- let payment_method_data_response =
+ let payment_method_data =
additional_payment_method_data.map(api::PaymentMethodDataResponse::from);
+ let payment_method_data_response = payment_method_data.map(|payment_method_data| {
+ api_models::payments::PaymentMethodDataResponseWithBilling {
+ payment_method_data,
+ billing: payment_data.address.payment_method_billing,
+ }
+ });
+
let mut headers = connector_http_status_code
.map(|status_code| {
vec![(
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 2987370f28..21ba27eac1 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -112,8 +112,8 @@ pub async fn create_link_token(
&*state.store,
pi.billing_address_id.clone(),
&key_store,
- pi.payment_id.clone(),
- merchant_account.merchant_id.clone(),
+ &pi.payment_id,
+ &merchant_account.merchant_id,
merchant_account.storage_scheme,
)
.await
@@ -678,8 +678,8 @@ pub async fn retrieve_payment_method_from_auth_service(
&*state.store,
payment_intent.billing_address_id.clone(),
key_store,
- payment_intent.payment_id.clone(),
- merchant_account.merchant_id.clone(),
+ &payment_intent.payment_id,
+ &merchant_account.merchant_id,
merchant_account.storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index d749163aa2..91aa36957a 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -111,6 +111,7 @@ pub async fn construct_payout_router_data<'a, F>(
email: a.email.to_owned().map(Email::from),
}
}),
+ payment_method_billing: None,
};
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index 9159abf4bd..1204ba79ac 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -4,13 +4,13 @@ pub use api_models::payments::{
MandateTransactionType, MandateType, MandateValidationFields, NextActionType, OnlineMandate,
PayLaterData, PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints,
PaymentListFilters, PaymentListResponse, PaymentListResponseV2, PaymentMethodData,
- PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials,
- PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
- PaymentsIncrementalAuthorizationRequest, PaymentsRedirectRequest, PaymentsRedirectionResponse,
- PaymentsRejectRequest, PaymentsRequest, PaymentsResponse, PaymentsResponseForm,
- PaymentsRetrieveRequest, PaymentsSessionRequest, PaymentsSessionResponse, PaymentsStartRequest,
- PgRedirectResponse, PhoneDetails, RedirectionResponse, SessionToken, TimeRange, UrlDetails,
- VerifyRequest, VerifyResponse, WalletData,
+ PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,
+ PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest, PaymentsCancelRequest,
+ PaymentsCaptureRequest, PaymentsIncrementalAuthorizationRequest, PaymentsRedirectRequest,
+ PaymentsRedirectionResponse, PaymentsRejectRequest, PaymentsRequest, PaymentsResponse,
+ PaymentsResponseForm, PaymentsRetrieveRequest, PaymentsSessionRequest, PaymentsSessionResponse,
+ PaymentsStartRequest, PgRedirectResponse, PhoneDetails, RedirectionResponse, SessionToken,
+ TimeRange, UrlDetails, VerifyRequest, VerifyResponse, WalletData,
};
use error_stack::{IntoReport, ResultExt};
@@ -259,7 +259,10 @@ mod payments_test {
fn payments_request() -> PaymentsRequest {
PaymentsRequest {
amount: Some(Amount::from(200)),
- payment_method_data: Some(PaymentMethodData::Card(card())),
+ payment_method_data: Some(PaymentMethodDataRequest {
+ payment_method_data: PaymentMethodData::Card(card()),
+ billing: None,
+ }),
..PaymentsRequest::default()
}
}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index e4c347187c..221d16a8b4 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -90,6 +90,7 @@ impl VerifyConnectorData {
address: types::PaymentAddress {
shipping: None,
billing: None,
+ payment_method_billing: None,
},
payment_id: common_utils::generate_id_with_default_len(
consts::VERIFY_CONNECTOR_ID_PREFIX,
diff --git a/crates/router/tests/connectors/dlocal.rs b/crates/router/tests/connectors/dlocal.rs
index 6b3a2954b6..992b1ae6ce 100644
--- a/crates/router/tests/connectors/dlocal.rs
+++ b/crates/router/tests/connectors/dlocal.rs
@@ -437,6 +437,7 @@ pub fn get_payment_info() -> PaymentInfo {
}),
email: None,
}),
+ payment_method_billing: None,
}),
auth_type: None,
access_token: None,
diff --git a/crates/router/tests/connectors/multisafepay.rs b/crates/router/tests/connectors/multisafepay.rs
index ff56239e97..393074ee63 100644
--- a/crates/router/tests/connectors/multisafepay.rs
+++ b/crates/router/tests/connectors/multisafepay.rs
@@ -55,6 +55,7 @@ fn get_default_payment_info() -> Option<PaymentInfo> {
phone: None,
email: None,
}),
+ payment_method_billing: None,
});
Some(PaymentInfo {
address,
diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs
index 0ec07f4f72..26f8469321 100644
--- a/crates/router/tests/connectors/payme.rs
+++ b/crates/router/tests/connectors/payme.rs
@@ -59,6 +59,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
phone: None,
email: None,
}),
+ payment_method_billing: None,
}),
auth_type: None,
access_token: None,
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 8ab2779d97..c1578c2d44 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -316,19 +316,22 @@ async fn payments_create_core() {
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OnSession),
authentication_type: Some(api_enums::AuthenticationType::NoThreeDs),
- payment_method_data: Some(api::PaymentMethodData::Card(api::Card {
- card_number: "4242424242424242".to_string().try_into().unwrap(),
- card_exp_month: "10".to_string().into(),
- card_exp_year: "35".to_string().into(),
- card_holder_name: Some(masking::Secret::new("Arun Raj".to_string())),
- card_cvc: "123".to_string().into(),
- card_issuer: None,
- card_network: None,
- card_type: None,
- card_issuing_country: None,
- bank_code: None,
- nick_name: Some(masking::Secret::new("nick_name".into())),
- })),
+ payment_method_data: Some(api::PaymentMethodDataRequest {
+ payment_method_data: api::PaymentMethodData::Card(api::Card {
+ card_number: "4242424242424242".to_string().try_into().unwrap(),
+ card_exp_month: "10".to_string().into(),
+ card_exp_year: "35".to_string().into(),
+ card_holder_name: Some(masking::Secret::new("Arun Raj".to_string())),
+ card_cvc: "123".to_string().into(),
+ card_issuer: None,
+ card_network: None,
+ card_type: None,
+ card_issuing_country: None,
+ bank_code: None,
+ nick_name: Some(masking::Secret::new("nick_name".into())),
+ }),
+ billing: None,
+ }),
payment_method: Some(api_enums::PaymentMethod::Card),
shipping: Some(api::Address {
address: None,
@@ -494,19 +497,22 @@ async fn payments_create_core_adyen_no_redirect() {
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OnSession),
authentication_type: Some(api_enums::AuthenticationType::NoThreeDs),
- payment_method_data: Some(api::PaymentMethodData::Card(api::Card {
- card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(),
- card_exp_month: "03".to_string().into(),
- card_exp_year: "2030".to_string().into(),
- card_holder_name: Some(masking::Secret::new("JohnDoe".to_string())),
- card_cvc: "737".to_string().into(),
- card_issuer: None,
- card_network: None,
- card_type: None,
- card_issuing_country: None,
- bank_code: None,
- nick_name: Some(masking::Secret::new("nick_name".into())),
- })),
+ payment_method_data: Some(api::PaymentMethodDataRequest {
+ payment_method_data: api::PaymentMethodData::Card(api::Card {
+ card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(),
+ card_exp_month: "03".to_string().into(),
+ card_exp_year: "2030".to_string().into(),
+ card_holder_name: Some(masking::Secret::new("JohnDoe".to_string())),
+ card_cvc: "737".to_string().into(),
+ card_issuer: None,
+ card_network: None,
+ card_type: None,
+ card_issuing_country: None,
+ bank_code: None,
+ nick_name: Some(masking::Secret::new("nick_name".into())),
+ }),
+ billing: None,
+ }),
payment_method: Some(api_enums::PaymentMethod::Card),
shipping: Some(api::Address {
address: None,
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index d901da342f..dadc3c9477 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -76,19 +76,22 @@ async fn payments_create_core() {
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: None,
authentication_type: Some(api_enums::AuthenticationType::NoThreeDs),
- payment_method_data: Some(api::PaymentMethodData::Card(api::Card {
- card_number: "4242424242424242".to_string().try_into().unwrap(),
- card_exp_month: "10".to_string().into(),
- card_exp_year: "35".to_string().into(),
- card_holder_name: Some(masking::Secret::new("Arun Raj".to_string())),
- card_cvc: "123".to_string().into(),
- card_issuer: None,
- card_network: None,
- card_type: None,
- card_issuing_country: None,
- bank_code: None,
- nick_name: Some(masking::Secret::new("nick_name".into())),
- })),
+ payment_method_data: Some(api::PaymentMethodDataRequest {
+ payment_method_data: api::PaymentMethodData::Card(api::Card {
+ card_number: "4242424242424242".to_string().try_into().unwrap(),
+ card_exp_month: "10".to_string().into(),
+ card_exp_year: "35".to_string().into(),
+ card_holder_name: Some(masking::Secret::new("Arun Raj".to_string())),
+ card_cvc: "123".to_string().into(),
+ card_issuer: None,
+ card_network: None,
+ card_type: None,
+ card_issuing_country: None,
+ bank_code: None,
+ nick_name: Some(masking::Secret::new("nick_name".into())),
+ }),
+ billing: None,
+ }),
payment_method: Some(api_enums::PaymentMethod::Card),
shipping: Some(api::Address {
address: None,
@@ -261,19 +264,23 @@ async fn payments_create_core_adyen_no_redirect() {
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OffSession),
authentication_type: Some(api_enums::AuthenticationType::NoThreeDs),
- payment_method_data: Some(api::PaymentMethodData::Card(api::Card {
- card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(),
- card_exp_month: "03".to_string().into(),
- card_exp_year: "2030".to_string().into(),
- card_holder_name: Some(masking::Secret::new("JohnDoe".to_string())),
- card_cvc: "737".to_string().into(),
- bank_code: None,
- card_issuer: None,
- card_network: None,
- card_type: None,
- card_issuing_country: None,
- nick_name: Some(masking::Secret::new("nick_name".into())),
- })),
+ payment_method_data: Some(api::PaymentMethodDataRequest {
+ payment_method_data: api::PaymentMethodData::Card(api::Card {
+ card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(),
+ card_exp_month: "03".to_string().into(),
+ card_exp_year: "2030".to_string().into(),
+ card_holder_name: Some(masking::Secret::new("JohnDoe".to_string())),
+ card_cvc: "737".to_string().into(),
+ bank_code: None,
+ card_issuer: None,
+ card_network: None,
+ card_type: None,
+ card_issuing_country: None,
+ nick_name: Some(masking::Secret::new("nick_name".into())),
+ }),
+ billing: None,
+ }),
+
payment_method: Some(api_enums::PaymentMethod::Card),
shipping: Some(api::Address {
address: None,
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 5add5036f0..7ae41f79c6 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -148,6 +148,7 @@ impl PaymentAttemptInterface for MockDb {
unified_code: payment_attempt.unified_code,
unified_message: payment_attempt.unified_message,
mandate_data: payment_attempt.mandate_data,
+ payment_method_billing_address_id: payment_attempt.payment_method_billing_address_id,
fingerprint_id: payment_attempt.fingerprint_id,
};
payment_attempts.push(payment_attempt.clone());
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index aff792636d..e7c6ad01ef 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -399,6 +399,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
unified_code: payment_attempt.unified_code.clone(),
unified_message: payment_attempt.unified_message.clone(),
mandate_data: payment_attempt.mandate_data.clone(),
+ payment_method_billing_address_id: payment_attempt
+ .payment_method_billing_address_id
+ .clone(),
fingerprint_id: payment_attempt.fingerprint_id.clone(),
};
@@ -1123,6 +1126,7 @@ impl DataModelExt for PaymentAttempt {
unified_code: self.unified_code,
unified_message: self.unified_message,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
+ payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
}
}
@@ -1182,6 +1186,7 @@ impl DataModelExt for PaymentAttempt {
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
+ payment_method_billing_address_id: storage_model.payment_method_billing_address_id,
fingerprint_id: storage_model.fingerprint_id,
}
}
@@ -1239,6 +1244,7 @@ impl DataModelExt for PaymentAttemptNew {
unified_code: self.unified_code,
unified_message: self.unified_message,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
+ payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
}
}
@@ -1296,6 +1302,7 @@ impl DataModelExt for PaymentAttemptNew {
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
+ payment_method_billing_address_id: storage_model.payment_method_billing_address_id,
fingerprint_id: storage_model.fingerprint_id,
}
}
@@ -1400,6 +1407,7 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ payment_method_billing_address_id,
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
amount,
currency,
@@ -1422,6 +1430,7 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ payment_method_billing_address_id,
},
Self::VoidUpdate {
status,
@@ -1672,6 +1681,7 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ payment_method_billing_address_id,
} => Self::ConfirmUpdate {
amount,
currency,
@@ -1694,6 +1704,7 @@ impl DataModelExt for PaymentAttemptUpdate {
fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
+ payment_method_billing_address_id,
},
DieselPaymentAttemptUpdate::VoidUpdate {
status,
diff --git a/migrations/2024-02-21-101951_add_payment_method_billing_to_payment_attempt/down.sql b/migrations/2024-02-21-101951_add_payment_method_billing_to_payment_attempt/down.sql
new file mode 100644
index 0000000000..3ca40852fe
--- /dev/null
+++ b/migrations/2024-02-21-101951_add_payment_method_billing_to_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS payment_method_billing_address_id;
diff --git a/migrations/2024-02-21-101951_add_payment_method_billing_to_payment_attempt/up.sql b/migrations/2024-02-21-101951_add_payment_method_billing_to_payment_attempt/up.sql
new file mode 100644
index 0000000000..7cedd57f37
--- /dev/null
+++ b/migrations/2024-02-21-101951_add_payment_method_billing_to_payment_attempt/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE payment_attempt
+ADD COLUMN IF NOT EXISTS payment_method_billing_address_id VARCHAR(64);
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index d0d2bcf653..293bfc85a7 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -11810,6 +11810,26 @@
}
]
},
+ "PaymentMethodDataRequest": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodData"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "billing": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Address"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ }
+ ]
+ },
"PaymentMethodDeleteResponse": {
"type": "object",
"required": [
@@ -12439,7 +12459,7 @@
"payment_method_data": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/PaymentMethodDataRequest"
}
],
"nullable": true
@@ -12796,7 +12816,7 @@
"payment_method_data": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/PaymentMethodDataRequest"
}
],
"nullable": true
@@ -13196,7 +13216,7 @@
"payment_method_data": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/PaymentMethodDataRequest"
}
],
"nullable": true
@@ -14193,7 +14213,7 @@
"payment_method_data": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/PaymentMethodDataRequest"
}
],
"nullable": true
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Confirm/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create a payment and Confirm/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/.meta.json
new file mode 100644
index 0000000000..69b505c6d8
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/.meta.json
@@ -0,0 +1,3 @@
+{
+ "childrenOrder": ["Payments - Create", "Payments - Retrieve"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/event.test.js
new file mode 100644
index 0000000000..d18cc474f8
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/event.test.js
@@ -0,0 +1,89 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) { }
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
+
+// Response body should have "payment_method_data.billing"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data.billing' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data.billing !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/request.json
new file mode 100644
index 0000000000..7a755ed4e6
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/request.json
@@ -0,0 +1,108 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "business_country": "US",
+ "business_label": "default",
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "bernard123",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "setup_future_usage": "on_session",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "01",
+ "card_exp_year": "26",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrisoff Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "Narayan",
+ "last_name": "Doe"
+ },
+ "email": "[email protected]"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "routing": {
+ "type": "single",
+ "data": "stripe"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments"]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/event.test.js
new file mode 100644
index 0000000000..808bc500b8
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/event.test.js
@@ -0,0 +1,89 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) { }
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
+
+// Response body should have "payment_method_data.billing"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data.billing' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data.billing !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/request.json
new file mode 100644
index 0000000000..6cd4b7d96c
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id"],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Create payment with payment method billing/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/.meta.json
new file mode 100644
index 0000000000..66671828f4
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Update",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/event.test.js
new file mode 100644
index 0000000000..87c1a31e47
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) { }
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/request.json
new file mode 100644
index 0000000000..95c2541e0b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/request.json
@@ -0,0 +1,70 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": false,
+ "business_country": "US",
+ "business_label": "default",
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "bernard123",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "setup_future_usage": "on_session",
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "routing": {
+ "type": "single",
+ "data": "stripe"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments"]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/event.test.js
new file mode 100644
index 0000000000..1f8005b2b7
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/event.test.js
@@ -0,0 +1,80 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) { }
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_confirmation" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_confirmation");
+ },
+ );
+}
+
+// Response body should have "payment_method_data.billing"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data.billing' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data.billing !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/request.json
new file mode 100644
index 0000000000..6cd4b7d96c
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id"],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/event.test.js
new file mode 100644
index 0000000000..5bb946ab51
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/event.test.js
@@ -0,0 +1,41 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) { }
+
+// Response body should have value "requires_confirmation" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_confirmation");
+ },
+ );
+}
+
+// Response body should have "payment_method_data.billing"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data.billing' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data.billing !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/request.json
new file mode 100644
index 0000000000..a8fc9965c7
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/request.json
@@ -0,0 +1,59 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "01",
+ "card_exp_year": "26",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrisoff Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "Narayan",
+ "last_name": "Doe"
+ },
+ "email": "[email protected]"
+ }
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id"],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario30-Update payment with payment method billing/Payments - Update/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/.meta.json
new file mode 100644
index 0000000000..57d3f8e2bc
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/.event.meta.json
new file mode 100644
index 0000000000..4ac527d834
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/event.prerequest.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/event.test.js
new file mode 100644
index 0000000000..f92fba3d04
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/request.json
new file mode 100644
index 0000000000..b92a83b5ad
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/request.json
@@ -0,0 +1,93 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrisoff Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "Narayan",
+ "last_name": "Doe"
+ },
+ "email": "[email protected]"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id", "confirm"],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/.event.meta.json
new file mode 100644
index 0000000000..4ac527d834
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/event.test.js
new file mode 100644
index 0000000000..0444324000
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/request.json
new file mode 100644
index 0000000000..b28abd0c30
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/request.json
@@ -0,0 +1,78 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/.event.meta.json
new file mode 100644
index 0000000000..688c85746e
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/event.test.js
new file mode 100644
index 0000000000..00a1aa1ce9
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/event.test.js
@@ -0,0 +1,80 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) { }
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "payment_method_data.billing"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data.billing' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data.billing !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/request.json
new file mode 100644
index 0000000000..b9ebc1be4a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario31-Pass payment method billing in Confirm/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]