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

This commit is contained in:
Shankar Singh C
2023-07-04 18:48:30 +05:30
committed by GitHub
parent 9794079c79
commit 04c60d73cb
2 changed files with 53 additions and 21 deletions

View File

@ -1106,10 +1106,7 @@ pub async fn list_payment_methods(
});
}
response
.is_empty()
.then(|| Err(report!(errors::ApiErrorResponse::PaymentMethodNotFound)))
.unwrap_or(Ok(services::ApplicationResponse::Json(
Ok(services::ApplicationResponse::Json(
api::PaymentMethodListResponse {
redirect_url: merchant_account.return_url,
merchant_name: merchant_account.merchant_name,
@ -1118,7 +1115,7 @@ pub async fn list_payment_methods(
.and_then(|inner| inner.mandate_details)
.map(ForeignInto::foreign_into),
},
)))
))
}
#[allow(clippy::too_many_arguments)]

View File

@ -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.",