Skip to content

Commit b5cc748

Browse files
authored
fix(router): make payment type optional in payments request (#2465)
1 parent bb2ba08 commit b5cc748

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

crates/api_models/src/payments.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ pub struct PaymentsRequest {
301301

302302
/// The type of the payment that differentiates between normal and various types of mandate payments
303303
#[schema(value_type = Option<PaymentType>)]
304-
#[serde(default)]
305-
pub payment_type: api_enums::PaymentType,
304+
pub payment_type: Option<api_enums::PaymentType>,
306305
}
307306

308307
#[derive(Default, Debug, Clone, Copy)]

crates/router/src/routes/payments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ where
871871
// the operation are flow agnostic, and the flow is only required in the post_update_tracker
872872
// Thus the flow can be generated just before calling the connector instead of explicitly passing it here.
873873

874-
match req.payment_type {
874+
match req.payment_type.unwrap_or_default() {
875875
api_models::enums::PaymentType::Normal
876876
| api_models::enums::PaymentType::RecurringMandate
877877
| api_models::enums::PaymentType::NewMandate => payments::payments_core::<

0 commit comments

Comments
 (0)