From b5cc7483f99dcd995b9022d21c94f2f9710ea7fe Mon Sep 17 00:00:00 2001 From: ItsMeShashank Date: Thu, 5 Oct 2023 23:15:35 +0530 Subject: [PATCH] fix(router): make payment type optional in payments request (#2465) --- crates/api_models/src/payments.rs | 3 +-- crates/router/src/routes/payments.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index c7415c5d54..095e30f382 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -301,8 +301,7 @@ pub struct PaymentsRequest { /// The type of the payment that differentiates between normal and various types of mandate payments #[schema(value_type = Option)] - #[serde(default)] - pub payment_type: api_enums::PaymentType, + pub payment_type: Option, } #[derive(Default, Debug, Clone, Copy)] diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs index db27929be3..9d7cf220a3 100644 --- a/crates/router/src/routes/payments.rs +++ b/crates/router/src/routes/payments.rs @@ -871,7 +871,7 @@ where // the operation are flow agnostic, and the flow is only required in the post_update_tracker // Thus the flow can be generated just before calling the connector instead of explicitly passing it here. - match req.payment_type { + match req.payment_type.unwrap_or_default() { api_models::enums::PaymentType::Normal | api_models::enums::PaymentType::RecurringMandate | api_models::enums::PaymentType::NewMandate => payments::payments_core::<