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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(payments): populate mandate_data in the response body of the PaymentsCreate endpoint (#1715)
Kritik Modifb149cb0ff75
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex e781dd6f5b..99452d9b62 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -1433,6 +1433,7 @@ pub struct PaymentsResponse {pub mandate_id: Option<String>,/// Provided mandate information for creating a mandate+ #[auth_based]pub mandate_data: Option<MandateData>,/// Indicates that you intend to make future payments with this Payment’s payment method. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex b9d805a300..f7423ee60c 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -183,6 +183,7 @@ where&operation,payment_data.ephemeral_key,payment_data.sessions_token,+ payment_data.setup_mandate,)}}@@ -273,6 +274,7 @@ pub fn payments_to_payments_response<R, Op>(operation: &Op,ephemeral_key_option: Option<ephemeral_key::EphemeralKey>,session_tokens: Vec<api::SessionToken>,+ mandate_data: Option<api_models::payments::MandateData>,) -> RouterResponse<api::PaymentsResponse>whereOp: Debug,@@ -416,6 +418,10 @@ where.and_then(|cus| cus.phone.as_ref().map(|s| s.to_owned())),).set_mandate_id(mandate_id)+ .set_mandate_data(+ mandate_data.map(api::MandateData::from),+ auth_flow == services::AuthFlow::Merchant,+ ).set_description(payment_intent.description).set_refunds(refunds_response) // refunds.iter().map(refund_to_refund_response),.set_disputes(disputes_response)