Skip to content

Commit

Permalink
fix(connector): [STRIPE] fix stripe mandate (#6899)
Browse files Browse the repository at this point in the history
  • Loading branch information
swangi-kumari committed Dec 20, 2024
1 parent 653fd0e commit 2042f36
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 12 additions & 3 deletions crates/router/src/connector/stripe/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,13 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
};
let mut payment_method_options = None;

let (mut payment_data, payment_method, billing_address, payment_method_types) = {
let (
mut payment_data,
payment_method,
billing_address,
payment_method_types,
setup_future_usage,
) = {
match item
.request
.mandate_id
Expand All @@ -1716,6 +1722,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
connector_mandate_ids.get_connector_mandate_id(),
StripeBillingAddress::default(),
get_payment_method_type_for_saved_payment_method_payment(item)?,
None,
),
Some(api_models::payments::MandateReferenceId::NetworkMandateId(
network_transaction_id,
Expand Down Expand Up @@ -1781,9 +1788,10 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
None,
StripeBillingAddress::default(),
None,
None,
)
}
_ => {
Some(api_models::payments::MandateReferenceId::NetworkTokenWithNTI(_)) | None => {
let (payment_method_data, payment_method_type, billing_address) =
create_stripe_payment_method(
&item.request.payment_method_data,
Expand All @@ -1805,6 +1813,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
None,
billing_address,
payment_method_type,
item.request.setup_future_usage,
)
}
}
Expand Down Expand Up @@ -1968,7 +1977,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
customer,
setup_mandate_details,
off_session: item.request.off_session,
setup_future_usage: item.request.setup_future_usage,
setup_future_usage,
payment_method_types,
expand: Some(ExpandableObjects::LatestCharge),
browser_info,
Expand Down
15 changes: 3 additions & 12 deletions crates/router/src/core/payments/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2615,10 +2615,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
payment_method_data: (payment_method_data.get_required_value("payment_method_data")?),
setup_future_usage: payment_data.payment_intent.setup_future_usage,
mandate_id: payment_data.mandate_id.clone(),
off_session: payment_data
.mandate_id
.as_ref()
.and(payment_data.payment_intent.off_session),
off_session: payment_data.mandate_id.as_ref().map(|_| true),
setup_mandate_details: payment_data.setup_mandate.clone(),
confirm: payment_data.payment_attempt.confirm,
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
Expand Down Expand Up @@ -3221,10 +3218,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
.get_required_value("payment_method_data")?),
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
setup_future_usage: payment_data.payment_intent.setup_future_usage,
off_session: payment_data
.mandate_id
.as_ref()
.and(payment_data.payment_intent.off_session),
off_session: payment_data.mandate_id.as_ref().map(|_| true),
mandate_id: payment_data.mandate_id.clone(),
setup_mandate_details: payment_data.setup_mandate,
customer_acceptance: payment_data.customer_acceptance,
Expand Down Expand Up @@ -3339,10 +3333,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
Ok(Self {
setup_future_usage: payment_data.payment_intent.setup_future_usage,
mandate_id: payment_data.mandate_id.clone(),
off_session: payment_data
.mandate_id
.as_ref()
.and(payment_data.payment_intent.off_session),
off_session: payment_data.mandate_id.as_ref().map(|_| true),
setup_mandate_details: payment_data.setup_mandate.clone(),
confirm: payment_data.payment_attempt.confirm,
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
Expand Down

0 comments on commit 2042f36

Please sign in to comment.