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,19 +1106,16 @@ pub async fn list_payment_methods(
}); });
} }
response Ok(services::ApplicationResponse::Json(
.is_empty() api::PaymentMethodListResponse {
.then(|| Err(report!(errors::ApiErrorResponse::PaymentMethodNotFound))) redirect_url: merchant_account.return_url,
.unwrap_or(Ok(services::ApplicationResponse::Json( merchant_name: merchant_account.merchant_name,
api::PaymentMethodListResponse { payment_methods: payment_method_responses,
redirect_url: merchant_account.return_url, mandate_payment: payment_attempt
merchant_name: merchant_account.merchant_name, .and_then(|inner| inner.mandate_details)
payment_methods: payment_method_responses, .map(ForeignInto::foreign_into),
mandate_payment: payment_attempt },
.and_then(|inner| inner.mandate_details) ))
.map(ForeignInto::foreign_into),
},
)))
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]

View File

@ -2740,6 +2740,12 @@
} }
], ],
"nullable": true "nullable": true
},
"nick_name": {
"type": "string",
"description": "The card holder's nick name",
"example": "John Test",
"nullable": true
} }
} }
}, },
@ -2771,6 +2777,12 @@
"type": "string", "type": "string",
"description": "Card Holder Name", "description": "Card Holder Name",
"example": "John Doe" "example": "John Doe"
},
"nick_name": {
"type": "string",
"description": "Card Holder's Nick Name",
"example": "John Doe",
"nullable": true
} }
} }
}, },
@ -2808,6 +2820,10 @@
"card_fingerprint": { "card_fingerprint": {
"type": "string", "type": "string",
"nullable": true "nullable": true
},
"nick_name": {
"type": "string",
"nullable": true
} }
} }
}, },
@ -6340,8 +6356,7 @@
"type": "object", "type": "object",
"required": [ "required": [
"amount", "amount",
"currency", "currency"
"manual_retry"
], ],
"properties": { "properties": {
"payment_id": { "payment_id": {
@ -6652,9 +6667,13 @@
"description": "Business sub label for the payment", "description": "Business sub label for the payment",
"nullable": true "nullable": true
}, },
"manual_retry": { "retry_action": {
"type": "boolean", "allOf": [
"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." {
"$ref": "#/components/schemas/RetryAction"
}
],
"nullable": true
}, },
"udf": { "udf": {
"type": "object", "type": "object",
@ -6974,9 +6993,13 @@
"description": "Business sub label for the payment", "description": "Business sub label for the payment",
"nullable": true "nullable": true
}, },
"manual_retry": { "retry_action": {
"type": "boolean", "allOf": [
"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." {
"$ref": "#/components/schemas/RetryAction"
}
],
"nullable": true
}, },
"udf": { "udf": {
"type": "object", "type": "object",
@ -7302,6 +7325,11 @@
], ],
"nullable": true "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": { "udf": {
"type": "object", "type": "object",
"description": "Any user defined fields can be passed here.", "description": "Any user defined fields can be passed here.",
@ -7818,6 +7846,13 @@
} }
} }
}, },
"RetryAction": {
"type": "string",
"enum": [
"manual_retry",
"requeue"
]
},
"RevokeApiKeyResponse": { "RevokeApiKeyResponse": {
"type": "object", "type": "object",
"description": "The response body for revoking an API Key.", "description": "The response body for revoking an API Key.",