Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connector): [STRIPE] fix stripe mandate #6899

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1703,7 +1703,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 @@ -1717,6 +1723,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 @@ -1782,9 +1789,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 @@ -1806,6 +1814,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
None,
billing_address,
payment_method_type,
item.request.setup_future_usage,
)
}
}
Expand Down Expand Up @@ -1969,7 +1978,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 @@ -2597,10 +2597,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 @@ -3206,10 +3203,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 @@ -3324,10 +3318,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
Loading