refactor(payments): attempt to address unintended 5xx and 4xx in payments (#1376)

This commit is contained in:
Abhishek Marrivagu
2023-06-15 13:20:48 +05:30
committed by GitHub
parent 71c0d4c500
commit cf64862dac
4 changed files with 24 additions and 26 deletions

View File

@ -26,6 +26,7 @@ use self::{
helpers::authenticate_client_secret,
operations::{payment_complete_authorize, BoxedOperation, Operation},
};
use super::errors::StorageErrorExt;
use crate::{
configs::settings::PaymentMethodTypeTokenFilter,
core::{
@ -104,7 +105,7 @@ where
validate_result.merchant_id,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
.attach_printable("Failed while fetching/creating customer")?;
let connector = get_connector_choice(
@ -1090,7 +1091,7 @@ pub async fn list_payments(
) -> RouterResponse<api::PaymentListResponse> {
use futures::stream::StreamExt;
use crate::{core::errors::utils::StorageErrorExt, types::transformers::ForeignFrom};
use crate::types::transformers::ForeignFrom;
helpers::validate_payment_list_request(&constraints)?;
let merchant_id = &merchant.merchant_id;