refactor(router): throw bad request error on applepay verification failure (#2607)

This commit is contained in:
Prajjwal Kumar
2023-10-17 15:18:51 +05:30
committed by GitHub
parent fdd9580012
commit cecea8718a
2 changed files with 12 additions and 9 deletions

View File

@ -449,7 +449,7 @@ where
headers.extend(
external_latency
.map(|latency| vec![(X_HS_LATENCY.to_string(), latency.to_string())])
.unwrap_or(vec![]),
.unwrap_or_default(),
);
}
let output = Ok(match payment_request {

View File

@ -85,7 +85,7 @@ pub async fn verify_merchant_creds_for_applepay(
response.change_context(api_error_response::ApiErrorResponse::InternalServerError)?;
// Error is already logged
Ok(match applepay_response {
match applepay_response {
Ok(_) => {
utils::check_existence_and_add_domain_to_db(
&state,
@ -95,17 +95,20 @@ pub async fn verify_merchant_creds_for_applepay(
)
.await
.change_context(api_error_response::ApiErrorResponse::InternalServerError)?;
services::api::ApplicationResponse::Json(ApplepayMerchantResponse {
status_message: "Applepay verification Completed".to_string(),
})
Ok(services::api::ApplicationResponse::Json(
ApplepayMerchantResponse {
status_message: "Applepay verification Completed".to_string(),
},
))
}
Err(error) => {
logger::error!(?error);
services::api::ApplicationResponse::Json(ApplepayMerchantResponse {
status_message: "Applepay verification Failed".to_string(),
})
Err(api_error_response::ApiErrorResponse::InvalidRequestData {
message: "Applepay verification Failed".to_string(),
}
.into())
}
})
}
}
pub async fn get_verified_apple_domains_with_mid_mca_id(