Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(core): fixed invalid merchant country code error object (#8665)

Sahkal Poddar20b37bdb7a25
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index d5827c843c..6fb6b9a3b7 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3379,8 +3379,9 @@ impl ProfileCreateBridge for api::ProfileCreate {
.as_ref()
.map(|country_code| country_code.validate_and_get_country_from_merchant_country_code())
.transpose()
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Error while parsing country from merchant country code")?;
+ .change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Invalid merchant country code".to_string(),
+ })?;
Ok(domain::Profile::from(domain::ProfileSetter {
profile_id,
@@ -3931,8 +3932,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
.as_ref()
.map(|country_code| country_code.validate_and_get_country_from_merchant_country_code())
.transpose()
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Error while parsing country from merchant country code")?;
+ .change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Invalid merchant country code".to_string(),
+ })?;
Ok(domain::ProfileUpdate::Update(Box::new(
domain::ProfileGeneralUpdate {