Skip to content

Commit eb94cfe

Browse files
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>
1 parent baad3f6 commit eb94cfe

File tree

10 files changed

+50
-10
lines changed

10 files changed

+50
-10
lines changed

config/config.example.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,9 @@ card = "credit,debit"
908908

909909
#Payout Method Filters Based on Country and Currency
910910
[payout_method_filters.adyenplatform]
911-
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" }
911+
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" }
912+
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" }
913+
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" }
912914

913915
[payout_method_filters.stripe]
914916
ach = { country = "US", currency = "USD" }

config/deployments/integration_test.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,9 @@ trustly = { country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK
678678
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" }
679679

680680
[payout_method_filters.adyenplatform]
681-
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" }
681+
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" }
682+
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" }
683+
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" }
682684

683685
[payout_method_filters.stripe]
684686
ach = { country = "US", currency = "USD" }

config/deployments/production.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,9 @@ eft = { country = "NG, ZA, GH, KE, CI", currency = "NGN, GHS, ZAR, KES, USD" }
709709
pix = { country = "BR", currency = "BRL" }
710710

711711
[payout_method_filters.adyenplatform]
712-
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" }
712+
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" }
713+
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" }
714+
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" }
713715

714716
[payout_method_filters.stripe]
715717
ach = { country = "US", currency = "USD" }

config/deployments/sandbox.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
648648
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"}
649649

650650
[payout_method_filters.adyenplatform]
651-
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" }
651+
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" }
652+
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" }
653+
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" }
652654

653655
[pm_filters.rapyd]
654656
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" }

config/development.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,9 @@ merchant_name = "HyperSwitch"
10311031
card = "credit,debit"
10321032

10331033
[payout_method_filters.adyenplatform]
1034-
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" }
1034+
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" }
1035+
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" }
1036+
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" }
10351037

10361038
[payout_method_filters.stripe]
10371039
ach = { country = "US", currency = "USD" }

config/docker_compose.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,9 @@ merchant_name = "HyperSwitch"
10411041
card = "credit,debit"
10421042

10431043
[payout_method_filters.adyenplatform]
1044-
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" }
1044+
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" }
1045+
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" }
1046+
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" }
10451047

10461048
[payout_method_filters.stripe]
10471049
ach = { country = "US", currency = "USD" }

crates/connector_configs/toml/development.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,14 @@ required=true
367367
type="Text"
368368

369369
[adyenplatform_payout]
370+
[[adyenplatform_payout.credit]]
371+
payment_method_type = "Mastercard"
372+
[[adyenplatform_payout.credit]]
373+
payment_method_type = "Visa"
374+
[[adyenplatform_payout.debit]]
375+
payment_method_type = "Mastercard"
376+
[[adyenplatform_payout.debit]]
377+
payment_method_type = "Visa"
370378
[[adyenplatform_payout.bank_transfer]]
371379
payment_method_type = "sepa"
372380
[adyenplatform_payout.connector_auth.HeaderKey]

crates/connector_configs/toml/production.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ key1="Adyen Account Id"
121121
merchant_secret="Source verification key"
122122

123123
[adyenplatform_payout]
124+
[[adyenplatform_payout.credit]]
125+
payment_method_type = "Mastercard"
126+
[[adyenplatform_payout.credit]]
127+
payment_method_type = "Visa"
128+
[[adyenplatform_payout.debit]]
129+
payment_method_type = "Mastercard"
130+
[[adyenplatform_payout.debit]]
131+
payment_method_type = "Visa"
124132
[[adyenplatform_payout.bank_transfer]]
125133
payment_method_type = "sepa"
126134
[adyenplatform_payout.connector_auth.HeaderKey]

crates/connector_configs/toml/sandbox.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,14 @@ required=true
365365
type="Text"
366366

367367
[adyenplatform_payout]
368+
[[adyenplatform_payout.credit]]
369+
payment_method_type = "Mastercard"
370+
[[adyenplatform_payout.credit]]
371+
payment_method_type = "Visa"
372+
[[adyenplatform_payout.debit]]
373+
payment_method_type = "Mastercard"
374+
[[adyenplatform_payout.debit]]
375+
payment_method_type = "Visa"
368376
[[adyenplatform_payout.bank_transfer]]
369377
payment_method_type = "sepa"
370378
[adyenplatform_payout.connector_auth.HeaderKey]

crates/router/src/core/payouts.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ pub async fn payouts_update_core(
450450
// Verify update feasibility
451451
if helpers::is_payout_terminal_state(status) || helpers::is_payout_initiated(status) {
452452
return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
453-
message: format!("Payout {payout_id:?} cannot be updated for status {status}"),
453+
message: format!(
454+
"Payout {} cannot be updated for status {status}",
455+
payout_id.get_string_repr()
456+
),
454457
}));
455458
}
456459
helpers::update_payouts_and_payout_attempt(&mut payout_data, &merchant_context, &req, &state)
@@ -2697,7 +2700,7 @@ pub async fn payout_create_db_entries(
26972700

26982701
let client_secret = utils::generate_id(
26992702
consts::ID_LENGTH,
2700-
format!("payout_{payout_id:?}_secret").as_str(),
2703+
format!("payout_{}_secret", payout_id.get_string_repr()).as_str(),
27012704
);
27022705
let amount = MinorUnit::from(req.amount.unwrap_or(api::Amount::Zero));
27032706
let status = if req.payout_method_data.is_some()
@@ -2911,7 +2914,7 @@ pub async fn make_payout_data(
29112914
.map_err(|err| err.change_context(errors::ApiErrorResponse::InternalServerError))
29122915
.attach_printable_lazy(|| {
29132916
format!(
2914-
"Failed while fetching optional customer [id - {customer_id:?}] for payout [id - {payout_id:?}]"
2917+
"Failed while fetching optional customer [id - {customer_id:?}] for payout [id - {}]", payout_id.get_string_repr()
29152918
)
29162919
})
29172920
})
@@ -3179,8 +3182,9 @@ pub async fn create_payout_link(
31793182
.as_ref()
31803183
.map_or(default_config.expiry, |expiry| *expiry);
31813184
let url = format!(
3182-
"{base_url}/payout_link/{}/{payout_id:?}?locale={}",
3185+
"{base_url}/payout_link/{}/{}?locale={}",
31833186
merchant_id.get_string_repr(),
3187+
payout_id.get_string_repr(),
31843188
locale
31853189
);
31863190
let link = url::Url::parse(&url)

0 commit comments

Comments
 (0)