mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 11:24:45 +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")?),
|
payment_method_data: (payment_method_data.get_required_value("payment_method_data")?),
|
||||||
setup_future_usage: payment_data.payment_intent.setup_future_usage,
|
setup_future_usage: payment_data.payment_intent.setup_future_usage,
|
||||||
mandate_id: payment_data.mandate_id.clone(),
|
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(),
|
setup_mandate_details: payment_data.setup_mandate.clone(),
|
||||||
confirm: payment_data.payment_attempt.confirm,
|
confirm: payment_data.payment_attempt.confirm,
|
||||||
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
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")?),
|
.get_required_value("payment_method_data")?),
|
||||||
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
||||||
setup_future_usage: payment_data.payment_intent.setup_future_usage,
|
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(),
|
mandate_id: payment_data.mandate_id.clone(),
|
||||||
setup_mandate_details: payment_data.setup_mandate,
|
setup_mandate_details: payment_data.setup_mandate,
|
||||||
customer_acceptance: payment_data.customer_acceptance,
|
customer_acceptance: payment_data.customer_acceptance,
|
||||||
@ -3333,7 +3339,10 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::CompleteAuthoriz
|
|||||||
Ok(Self {
|
Ok(Self {
|
||||||
setup_future_usage: payment_data.payment_intent.setup_future_usage,
|
setup_future_usage: payment_data.payment_intent.setup_future_usage,
|
||||||
mandate_id: payment_data.mandate_id.clone(),
|
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(),
|
setup_mandate_details: payment_data.setup_mandate.clone(),
|
||||||
confirm: payment_data.payment_attempt.confirm,
|
confirm: payment_data.payment_attempt.confirm,
|
||||||
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
||||||
|
|||||||
@ -721,9 +721,7 @@ export const connectorDetails = {
|
|||||||
Response: {
|
Response: {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: {
|
body: {
|
||||||
error_code: "No error code",
|
status: "succeeded",
|
||||||
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.",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -734,9 +732,7 @@ export const connectorDetails = {
|
|||||||
Response: {
|
Response: {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: {
|
body: {
|
||||||
error_code: "No error code",
|
status: "requires_capture",
|
||||||
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.",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -748,9 +744,7 @@ export const connectorDetails = {
|
|||||||
Response: {
|
Response: {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: {
|
body: {
|
||||||
status: "failed",
|
status: "succeeded",
|
||||||
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.",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user