Skip to content

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

fix(payment_methods): return an empty array when the merchant does not have any payment methods (#1601)

Shankar Singh C04c60d73cb34
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index c790f6bb2d..93a71fb357 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1106,19 +1106,16 @@ pub async fn list_payment_methods(
});
}
- response
- .is_empty()
- .then(|| Err(report!(errors::ApiErrorResponse::PaymentMethodNotFound)))
- .unwrap_or(Ok(services::ApplicationResponse::Json(
- api::PaymentMethodListResponse {
- redirect_url: merchant_account.return_url,
- merchant_name: merchant_account.merchant_name,
- payment_methods: payment_method_responses,
- mandate_payment: payment_attempt
- .and_then(|inner| inner.mandate_details)
- .map(ForeignInto::foreign_into),
- },
- )))
+ Ok(services::ApplicationResponse::Json(
+ api::PaymentMethodListResponse {
+ redirect_url: merchant_account.return_url,
+ merchant_name: merchant_account.merchant_name,
+ payment_methods: payment_method_responses,
+ mandate_payment: payment_attempt
+ .and_then(|inner| inner.mandate_details)
+ .map(ForeignInto::foreign_into),
+ },
+ ))
}
#[allow(clippy::too_many_arguments)]
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 72ebee8100..582caf8977 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -2740,6 +2740,12 @@
}
],
"nullable": true
+ },
+ "nick_name": {
+ "type": "string",
+ "description": "The card holder's nick name",
+ "example": "John Test",
+ "nullable": true
}
}
},
@@ -2771,6 +2777,12 @@
"type": "string",
"description": "Card Holder Name",
"example": "John Doe"
+ },
+ "nick_name": {
+ "type": "string",
+ "description": "Card Holder's Nick Name",
+ "example": "John Doe",
+ "nullable": true
}
}
},
@@ -2808,6 +2820,10 @@
"card_fingerprint": {
"type": "string",
"nullable": true
+ },
+ "nick_name": {
+ "type": "string",
+ "nullable": true
}
}
},
@@ -6340,8 +6356,7 @@
"type": "object",
"required": [
"amount",
- "currency",
- "manual_retry"
+ "currency"
],
"properties": {
"payment_id": {
@@ -6652,9 +6667,13 @@
"description": "Business sub label for the payment",
"nullable": true
},
- "manual_retry": {
- "type": "boolean",
- "description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
+ "retry_action": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RetryAction"
+ }
+ ],
+ "nullable": true
},
"udf": {
"type": "object",
@@ -6974,9 +6993,13 @@
"description": "Business sub label for the payment",
"nullable": true
},
- "manual_retry": {
- "type": "boolean",
- "description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
+ "retry_action": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RetryAction"
+ }
+ ],
+ "nullable": true
},
"udf": {
"type": "object",
@@ -7302,6 +7325,11 @@
],
"nullable": true
},
+ "manual_retry_allowed": {
+ "type": "boolean",
+ "description": "If true the payment can be retried with same or different payment method which means the confirm call can be made again.",
+ "nullable": true
+ },
"udf": {
"type": "object",
"description": "Any user defined fields can be passed here.",
@@ -7818,6 +7846,13 @@
}
}
},
+ "RetryAction": {
+ "type": "string",
+ "enum": [
+ "manual_retry",
+ "requeue"
+ ]
+ },
"RevokeApiKeyResponse": {
"type": "object",
"description": "The response body for revoking an API Key.",