Skip to content

Commit cecea87

Browse files
refactor(router): throw bad request error on applepay verification failure (#2607)
1 parent fdd9580 commit cecea87

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

crates/router/src/core/payments/transformers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ where
449449
headers.extend(
450450
external_latency
451451
.map(|latency| vec![(X_HS_LATENCY.to_string(), latency.to_string())])
452-
.unwrap_or(vec![]),
452+
.unwrap_or_default(),
453453
);
454454
}
455455
let output = Ok(match payment_request {

crates/router/src/core/verification.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub async fn verify_merchant_creds_for_applepay(
8585
response.change_context(api_error_response::ApiErrorResponse::InternalServerError)?;
8686

8787
// Error is already logged
88-
Ok(match applepay_response {
88+
match applepay_response {
8989
Ok(_) => {
9090
utils::check_existence_and_add_domain_to_db(
9191
&state,
@@ -95,17 +95,20 @@ pub async fn verify_merchant_creds_for_applepay(
9595
)
9696
.await
9797
.change_context(api_error_response::ApiErrorResponse::InternalServerError)?;
98-
services::api::ApplicationResponse::Json(ApplepayMerchantResponse {
99-
status_message: "Applepay verification Completed".to_string(),
100-
})
98+
Ok(services::api::ApplicationResponse::Json(
99+
ApplepayMerchantResponse {
100+
status_message: "Applepay verification Completed".to_string(),
101+
},
102+
))
101103
}
102104
Err(error) => {
103105
logger::error!(?error);
104-
services::api::ApplicationResponse::Json(ApplepayMerchantResponse {
105-
status_message: "Applepay verification Failed".to_string(),
106-
})
106+
Err(api_error_response::ApiErrorResponse::InvalidRequestData {
107+
message: "Applepay verification Failed".to_string(),
108+
}
109+
.into())
107110
}
108-
})
111+
}
109112
}
110113

111114
pub async fn get_verified_apple_domains_with_mid_mca_id(

0 commit comments

Comments
 (0)