mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
fix(payment_methods): return an empty array when the merchant does not have any payment methods (#1601)
This commit is contained in:
@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user