mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
fix(core): Populate off_session based on payments request (#6855)
This commit is contained in:
@ -2615,7 +2615,10 @@ 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().map(|_| true),
|
||||
off_session: payment_data
|
||||
.mandate_id
|
||||
.as_ref()
|
||||
.and(payment_data.payment_intent.off_session),
|
||||
setup_mandate_details: payment_data.setup_mandate.clone(),
|
||||
confirm: payment_data.payment_attempt.confirm,
|
||||
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
||||
@ -3218,7 +3221,10 @@ 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().map(|_| true),
|
||||
off_session: payment_data
|
||||
.mandate_id
|
||||
.as_ref()
|
||||
.and(payment_data.payment_intent.off_session),
|
||||
mandate_id: payment_data.mandate_id.clone(),
|
||||
setup_mandate_details: payment_data.setup_mandate,
|
||||
customer_acceptance: payment_data.customer_acceptance,
|
||||
@ -3333,7 +3339,10 @@ 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().map(|_| true),
|
||||
off_session: payment_data
|
||||
.mandate_id
|
||||
.as_ref()
|
||||
.and(payment_data.payment_intent.off_session),
|
||||
setup_mandate_details: payment_data.setup_mandate.clone(),
|
||||
confirm: payment_data.payment_attempt.confirm,
|
||||
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
||||
|
||||
@ -721,9 +721,7 @@ export const connectorDetails = {
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
error_code: "No error code",
|
||||
error_message:
|
||||
"You cannot confirm with `off_session=true` when `setup_future_usage` is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage. Please confirm this PaymentIntent with your customer on-session.",
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -734,9 +732,7 @@ export const connectorDetails = {
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
error_code: "No error code",
|
||||
error_message:
|
||||
"You cannot confirm with `off_session=true` when `setup_future_usage` is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage. Please confirm this PaymentIntent with your customer on-session.",
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -748,9 +744,7 @@ export const connectorDetails = {
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "failed",
|
||||
error_message:
|
||||
"You cannot confirm with `off_session=true` when `setup_future_usage` is also set on the PaymentIntent. The customer needs to be on-session to perform the steps which may be required to set up the PaymentMethod for future usage. Please confirm this PaymentIntent with your customer on-session.",
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user