From eb94cfe7e558348e8da3aeaaa01224a1ea2dbbe2 Mon Sep 17 00:00:00 2001 From: Kashif Date: Sat, 5 Jul 2025 20:07:09 +0530 Subject: [PATCH] fix(payout): use get_string_repr for formatting payout IDs (#8547) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- config/config.example.toml | 4 +++- config/deployments/integration_test.toml | 4 +++- config/deployments/production.toml | 4 +++- config/deployments/sandbox.toml | 4 +++- config/development.toml | 4 +++- config/docker_compose.toml | 4 +++- crates/connector_configs/toml/development.toml | 8 ++++++++ crates/connector_configs/toml/production.toml | 8 ++++++++ crates/connector_configs/toml/sandbox.toml | 8 ++++++++ crates/router/src/core/payouts.rs | 12 ++++++++---- 10 files changed, 50 insertions(+), 10 deletions(-) diff --git a/config/config.example.toml b/config/config.example.toml index 98ef7cf628..3c6da56b24 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -908,7 +908,9 @@ card = "credit,debit" #Payout Method Filters Based on Country and Currency [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } +debit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } [payout_method_filters.stripe] ach = { country = "US", currency = "USD" } diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml index 2bb07055e8..495847bd89 100644 --- a/config/deployments/integration_test.toml +++ b/config/deployments/integration_test.toml @@ -678,7 +678,9 @@ trustly = { country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" } [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } +debit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } [payout_method_filters.stripe] ach = { country = "US", currency = "USD" } diff --git a/config/deployments/production.toml b/config/deployments/production.toml index 9fa5a62f58..335d7f5ace 100644 --- a/config/deployments/production.toml +++ b/config/deployments/production.toml @@ -709,7 +709,9 @@ eft = { country = "NG, ZA, GH, KE, CI", currency = "NGN, GHS, ZAR, KES, USD" } pix = { country = "BR", currency = "BRL" } [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } +debit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } [payout_method_filters.stripe] ach = { country = "US", currency = "USD" } diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml index adca23f499..721e32b9b8 100644 --- a/config/deployments/sandbox.toml +++ b/config/deployments/sandbox.toml @@ -648,7 +648,9 @@ credit = {country = "AU,NZ,CN,HK,IN,LK,KR,MY,SG,GB,BE,FR,DE,IT,ME,NL,PL,ES,ZA,AR debit = {country = "AU,NZ,CN,HK,IN,LK,KR,MY,SG,GB,BE,FR,DE,IT,ME,NL,PL,ES,ZA,AR,BR,CO,MX,PA,UY,US,CA", currency = "AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BYN,BZD,BMD,BTN,BOB,VES,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XAF,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,CZK,DKK,DJF,DOP,XCD,EGP,ERN,ETB,EUR,FKP,FJD,XPF,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KGS,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,NZD,NIO,NGN,VUV,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SHP,SVC,WST,STN,SAR,RSD,SCR,SLL,SGD,SBD,SOS,ZAR,KRW,SSP,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,UGX,UAH,AED,USD,UYU,UZS,VND,XOF,YER,ZMW,ZWL"} [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } +debit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } [pm_filters.rapyd] apple_pay = { country = "AL,AS,AD,AR,AM,AU,AT,AZ,BH,BE,BM,BA,BR,BG,CA,KH,KY,CL,CO,CR,HR,CY,CZ,DK,DO,EC,SV,EE,FO,FI,FR,GE,DE,GI,GR,GL,GU,GT,GG,HN,HK,HU,IS,IE,IM,IL,IT,JP,KZ,KG,KW,LV,LI,LT,LU,MO,MY,MT,MX,MD,MC,ME,MA,NL,NZ,NI,MK,MP,NO,PA,PY,PR,PE,PL,PT,QA,RO,SM,RS,SG,SK,SI,ZA,ES,SE,CH,TW,TJ,TH,UA,AE,GB,US,UY,VI,VN", currency = "EUR,GBP,ISK,USD" } diff --git a/config/development.toml b/config/development.toml index db64e73099..ab885503c8 100644 --- a/config/development.toml +++ b/config/development.toml @@ -1031,7 +1031,9 @@ merchant_name = "HyperSwitch" card = "credit,debit" [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } +debit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } [payout_method_filters.stripe] ach = { country = "US", currency = "USD" } diff --git a/config/docker_compose.toml b/config/docker_compose.toml index af1fc3ea68..dbfeccf7cd 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -1041,7 +1041,9 @@ merchant_name = "HyperSwitch" card = "credit,debit" [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } +debit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" } [payout_method_filters.stripe] ach = { country = "US", currency = "USD" } diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml index a5a448fb0a..9966398471 100644 --- a/crates/connector_configs/toml/development.toml +++ b/crates/connector_configs/toml/development.toml @@ -367,6 +367,14 @@ required=true type="Text" [adyenplatform_payout] +[[adyenplatform_payout.credit]] + payment_method_type = "Mastercard" +[[adyenplatform_payout.credit]] + payment_method_type = "Visa" +[[adyenplatform_payout.debit]] + payment_method_type = "Mastercard" +[[adyenplatform_payout.debit]] + payment_method_type = "Visa" [[adyenplatform_payout.bank_transfer]] payment_method_type = "sepa" [adyenplatform_payout.connector_auth.HeaderKey] diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml index 09f94adbcd..a7d81b2c22 100644 --- a/crates/connector_configs/toml/production.toml +++ b/crates/connector_configs/toml/production.toml @@ -121,6 +121,14 @@ key1="Adyen Account Id" merchant_secret="Source verification key" [adyenplatform_payout] +[[adyenplatform_payout.credit]] + payment_method_type = "Mastercard" +[[adyenplatform_payout.credit]] + payment_method_type = "Visa" +[[adyenplatform_payout.debit]] + payment_method_type = "Mastercard" +[[adyenplatform_payout.debit]] + payment_method_type = "Visa" [[adyenplatform_payout.bank_transfer]] payment_method_type = "sepa" [adyenplatform_payout.connector_auth.HeaderKey] diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml index bb02a3197f..2660bd1a36 100644 --- a/crates/connector_configs/toml/sandbox.toml +++ b/crates/connector_configs/toml/sandbox.toml @@ -365,6 +365,14 @@ required=true type="Text" [adyenplatform_payout] +[[adyenplatform_payout.credit]] + payment_method_type = "Mastercard" +[[adyenplatform_payout.credit]] + payment_method_type = "Visa" +[[adyenplatform_payout.debit]] + payment_method_type = "Mastercard" +[[adyenplatform_payout.debit]] + payment_method_type = "Visa" [[adyenplatform_payout.bank_transfer]] payment_method_type = "sepa" [adyenplatform_payout.connector_auth.HeaderKey] diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs index 66c87086c7..bd0014d205 100644 --- a/crates/router/src/core/payouts.rs +++ b/crates/router/src/core/payouts.rs @@ -450,7 +450,10 @@ pub async fn payouts_update_core( // Verify update feasibility if helpers::is_payout_terminal_state(status) || helpers::is_payout_initiated(status) { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { - message: format!("Payout {payout_id:?} cannot be updated for status {status}"), + message: format!( + "Payout {} cannot be updated for status {status}", + payout_id.get_string_repr() + ), })); } helpers::update_payouts_and_payout_attempt(&mut payout_data, &merchant_context, &req, &state) @@ -2697,7 +2700,7 @@ pub async fn payout_create_db_entries( let client_secret = utils::generate_id( consts::ID_LENGTH, - format!("payout_{payout_id:?}_secret").as_str(), + format!("payout_{}_secret", payout_id.get_string_repr()).as_str(), ); let amount = MinorUnit::from(req.amount.unwrap_or(api::Amount::Zero)); let status = if req.payout_method_data.is_some() @@ -2911,7 +2914,7 @@ pub async fn make_payout_data( .map_err(|err| err.change_context(errors::ApiErrorResponse::InternalServerError)) .attach_printable_lazy(|| { format!( - "Failed while fetching optional customer [id - {customer_id:?}] for payout [id - {payout_id:?}]" + "Failed while fetching optional customer [id - {customer_id:?}] for payout [id - {}]", payout_id.get_string_repr() ) }) }) @@ -3179,8 +3182,9 @@ pub async fn create_payout_link( .as_ref() .map_or(default_config.expiry, |expiry| *expiry); let url = format!( - "{base_url}/payout_link/{}/{payout_id:?}?locale={}", + "{base_url}/payout_link/{}/{}?locale={}", merchant_id.get_string_repr(), + payout_id.get_string_repr(), locale ); let link = url::Url::parse(&url)