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

feat(connector): [AIRWALLEX] - Added Paypal, Trustly, Klarna , Atome, Blik Payment Methods (#8475)

Vani Guptad5f5527499c1
diff --git a/config/config.example.toml b/config/config.example.toml
index b1ffb8570b..1e28c3dc09 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -592,6 +592,11 @@ boleto = { country = "BR", currency = "BRL" }
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BG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LN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = {currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
[pm_filters.checkout]
debit = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,US,AU,HK,SG,SA,AE,BH,MX,AR,CL,CO,PE", currency = "AED,AFN,ALL,AMD,ANG,AOA,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index f839aabbf6..e921eb39db 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -331,6 +331,11 @@ we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG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K,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = {currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
[pm_filters.checkout]
debit = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,US,AU,HK,SG,SA,AE,BH,MX,AR,CL,CO,PE", currency = "AED,AFN,ALL,AMD,ANG,AOA,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 36f80248f9..3aefad73c0 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -345,6 +345,11 @@ we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
debit = { country = "AU,HK,SG,NZ,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N,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = { currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
[pm_filters.checkout]
debit = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,US,AU,HK,SG,SA,AE,BH,MX,AR,CL,CO,PE", currency = "AED,AFN,ALL,AMD,ANG,AOA,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 3018fb176d..51f9954dca 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -354,6 +354,11 @@ pix = { country = "BR", currency = "BRL" }
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN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D,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = {currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
[pm_filters.checkout]
debit = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,US,AU,HK,SG,SA,AE,BH,MX,AR,CL,CO,PE", currency = "AED,AFN,ALL,AMD,ANG,AOA,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/config/development.toml b/config/development.toml
index 665b301b87..38e89aa4ed 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -518,6 +518,11 @@ boleto = { country = "BR", currency = "BRL" }
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,B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PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = {currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
[pm_filters.elavon]
credit = { country = "US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index b232636421..af78f2d04d 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -492,6 +492,11 @@ we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK
credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,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,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = {currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
[pm_filters.checkout]
debit = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,US,AU,HK,SG,SA,AE,BH,MX,AR,CL,CO,PE", currency = "AED,AFN,ALL,AMD,ANG,AOA,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
index 900e8ef0d5..8e64541048 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
@@ -9,7 +9,10 @@ use common_utils::{
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt, ValueExt},
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{
+ AmountConvertor, MinorUnit, StringMajorUnit, StringMajorUnitForConnector, StringMinorUnit,
+ StringMinorUnitForConnector,
+ },
};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
@@ -52,20 +55,24 @@ use router_env::logger;
use transformers as airwallex;
use crate::{
+ connectors::airwallex::transformers::AirwallexAuthorizeResponse,
constants::headers,
types::{RefreshTokenRouterData, ResponseRouterData},
- utils::{convert_amount, AccessTokenRequestInfo, RefundsRequestData},
+ utils::{convert_amount, AccessTokenRequestInfo, ForeignTryFrom, RefundsRequestData},
};
#[derive(Clone)]
pub struct Airwallex {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMajorUnit> + Sync),
+ amount_converter_to_string_minor:
+ &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
}
impl Airwallex {
pub const fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &StringMajorUnitForConnector,
+ amount_converter_to_string_minor: &StringMinorUnitForConnector,
}
}
}
@@ -286,8 +293,23 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
req: &PaymentsPreProcessingRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let req_obj = airwallex::AirwallexIntentRequest::try_from(req)?;
- Ok(RequestContent::Json(Box::new(req_obj)))
+ let amount_in_minor_unit = MinorUnit::new(req.request.amount.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "amount",
+ },
+ )?);
+ let amount = convert_amount(
+ self.amount_converter,
+ amount_in_minor_unit,
+ req.request
+ .currency
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "currency",
+ })?,
+ )?;
+ let connector_router_data = airwallex::AirwallexRouterData::try_from((amount, req))?;
+ let connector_req = airwallex::AirwallexIntentRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
@@ -380,12 +402,13 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = airwallex::AirwallexRouterData::try_from((
- &self.get_currency_unit(),
+ let amount_in_minor_unit = MinorUnit::new(req.request.amount);
+ let amount = convert_amount(
+ self.amount_converter,
+ amount_in_minor_unit,
req.request.currency,
- req.request.amount,
- req,
- ))?;
+ )?;
+ let connector_router_data = airwallex::AirwallexRouterData::try_from((amount, req))?;
let connector_req = airwallex::AirwallexPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -418,13 +441,13 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: airwallex::AirwallexPaymentsResponse = res
+ let response: AirwallexAuthorizeResponse = res
.response
- .parse_struct("AirwallexPaymentsResponse")
+ .parse_struct("AirwallexAuthorizeResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| i.set_response_body(&response));
- router_env::logger::info!(connector_response=?response);
- RouterData::try_from(ResponseRouterData {
+ RouterData::foreign_try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
@@ -818,12 +841,13 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Airwall
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = airwallex::AirwallexRouterData::try_from((
- &self.get_currency_unit(),
+ let amount_in_minor_unit = MinorUnit::new(req.request.refund_amount);
+ let amount = convert_amount(
+ self.amount_converter,
+ amount_in_minor_unit,
req.request.currency,
- req.request.refund_amount,
- req,
- ))?;
+ )?;
+ let connector_router_data = airwallex::AirwallexRouterData::try_from((amount, req))?;
let connector_req = airwallex::AirwallexRefundRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -1076,7 +1100,7 @@ impl IncomingWebhook for Airwallex {
.parse_value("AirwallexDisputeObject")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let amount = convert_amount(
- self.amount_converter,
+ self.amount_converter_to_string_minor,
dispute_details.dispute_amount,
dispute_details.dispute_currency,
)?;
@@ -1120,6 +1144,11 @@ static AIRWALLEX_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
enums::CaptureMethod::SequentialAutomatic,
];
+ let supported_capture_methods_redirect = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
let supported_card_network = vec![
common_enums::CardNetwork::Visa,
common_enums::CardNetwork::Mastercard,
@@ -1181,6 +1210,61 @@ static AIRWALLEX_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
},
);
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::Paypal,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::PayLater,
+ enums::PaymentMethodType::Klarna,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::PayLater,
+ enums::PaymentMethodType::Atome,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods_redirect.clone(),
+ specific_features: None,
+ },
+ );
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::BankRedirect,
+ enums::PaymentMethodType::Trustly,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods_redirect.clone(),
+ specific_features: None,
+ },
+ );
+
+ airwallex_supported_payment_methods.add(
+ enums::PaymentMethod::BankRedirect,
+ enums::PaymentMethodType::Blik,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods_redirect.clone(),
+ specific_features: None,
+ },
+ );
+
airwallex_supported_payment_methods
});
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
index b677313a8e..4a752a82f5 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
@@ -1,8 +1,13 @@
use common_enums::enums;
-use common_utils::{errors::ParsingError, pii::IpAddress, request::Method, types::MinorUnit};
+use common_utils::{
+ errors::ParsingError,
+ pii::{Email, IpAddress},
+ request::Method,
+ types::{MinorUnit, StringMajorUnit},
+};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::{PaymentMethodData, WalletData},
+ payment_method_data::{BankRedirectData, PayLaterData, PaymentMethodData, WalletData},
router_data::{AccessToken, ConnectorAuthType, RouterData},
router_flow_types::{
refunds::{Execute, RSync},
@@ -12,7 +17,7 @@ use hyperswitch_domain_models::{
router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},
types,
};
-use hyperswitch_interfaces::{api, errors};
+use hyperswitch_interfaces::errors;
use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
@@ -21,7 +26,10 @@ use uuid::Uuid;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
- utils::{self, BrowserInformationData, CardData as _, PaymentsAuthorizeRequestData},
+ utils::{
+ self, BrowserInformationData, CardData as _, ForeignTryFrom, PaymentsAuthorizeRequestData,
+ PhoneDetailsData, RouterData as _,
+ },
};
pub struct AirwallexAuthType {
@@ -55,61 +63,87 @@ pub struct ReferrerData {
pub struct AirwallexIntentRequest {
// Unique ID to be sent for each transaction/operation request to the connector
request_id: String,
- amount: String,
+ amount: StringMajorUnit,
currency: enums::Currency,
//ID created in merchant's order system that corresponds to this PaymentIntent.
merchant_order_id: String,
// This data is required to whitelist Hyperswitch at Airwallex.
referrer_data: ReferrerData,
+ order: Option<AirwallexOrderData>,
}
-impl TryFrom<&types::PaymentsPreProcessingRouterData> for AirwallexIntentRequest {
+
+impl TryFrom<&AirwallexRouterData<&types::PaymentsPreProcessingRouterData>>
+ for AirwallexIntentRequest
+{
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: &AirwallexRouterData<&types::PaymentsPreProcessingRouterData>,
+ ) -> Result<Self, Self::Error> {
let referrer_data = ReferrerData {
r_type: "hyperswitch".to_string(),
version: "1.0.0".to_string(),
};
- // amount and currency will always be Some since PaymentsPreProcessingData is constructed using PaymentsAuthorizeData
- let amount = item
- .request
- .amount
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "amount",
- })?;
- let currency =
- item.request
- .currency
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "currency",
- })?;
+ let amount = item.amount.clone();
+ let currency = item.router_data.request.currency.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "currency",
+ },
+ )?;
+
+ let order = match item.router_data.request.payment_method_data {
+ Some(PaymentMethodData::PayLater(_)) => Some(
+ item.router_data
+ .request
+ .order_details
+ .as_ref()
+ .map(|order_data| AirwallexOrderData {
+ products: order_data
+ .iter()
+ .map(|product| AirwallexProductData {
+ name: product.product_name.clone(),
+ quantity: product.quantity,
+ unit_price: product.amount,
+ })
+ .collect(),
+ shipping: Some(AirwallexShippingData {
+ first_name: item.router_data.get_optional_shipping_first_name(),
+ last_name: item.router_data.get_optional_shipping_last_name(),
+ phone_number: item.router_data.get_optional_shipping_phone_number(),
+ address: AirwallexPLShippingAddress {
+ country_code: item.router_data.get_optional_shipping_country(),
+ city: item.router_data.get_optional_shipping_city(),
+ street: item.router_data.get_optional_shipping_line1(),
+ postcode: item.router_data.get_optional_shipping_zip(),
+ },
+ }),
+ })
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "order_details",
+ })?,
+ ),
+ _ => None,
+ };
+
Ok(Self {
request_id: Uuid::new_v4().to_string(),
- amount: utils::to_currency_base_unit(amount, currency)?,
+ amount,
currency,
- merchant_order_id: item.connector_request_reference_id.clone(),
+ merchant_order_id: item.router_data.connector_request_reference_id.clone(),
referrer_data,
+ order,
})
}
}
#[derive(Debug, Serialize)]
pub struct AirwallexRouterData<T> {
- pub amount: String,
+ pub amount: StringMajorUnit,
pub router_data: T,
}
-impl<T> TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for AirwallexRouterData<T> {
+impl<T> TryFrom<(StringMajorUnit, T)> for AirwallexRouterData<T> {
type Error = error_stack::Report<errors::ConnectorError>;
-
- fn try_from(
- (currency_unit, currency, amount, router_data): (
- &api::CurrencyUnit,
- enums::Currency,
- i64,
- T,
- ),
- ) -> Result<Self, Self::Error> {
- let amount = utils::get_amount_as_string(currency_unit, amount, currency)?;
+ fn try_from((amount, router_data): (StringMajorUnit, T)) -> Result<Self, Self::Error> {
Ok(Self {
amount,
router_data,
@@ -127,6 +161,35 @@ pub struct AirwallexPaymentsRequest {
device_data: DeviceData,
}
+#[derive(Debug, Serialize, Eq, PartialEq, Default)]
+pub struct AirwallexOrderData {
+ products: Vec<AirwallexProductData>,
+ shipping: Option<AirwallexShippingData>,
+}
+
+#[derive(Debug, Serialize, Eq, PartialEq)]
+pub struct AirwallexProductData {
+ name: String,
+ quantity: u16,
+ unit_price: MinorUnit,
+}
+
+#[derive(Debug, Serialize, Eq, PartialEq)]
+pub struct AirwallexShippingData {
+ first_name: Option<Secret<String>>,
+ last_name: Option<Secret<String>>,
+ phone_number: Option<Secret<String>>,
+ address: AirwallexPLShippingAddress,
+}
+
+#[derive(Debug, Serialize, Eq, PartialEq)]
+pub struct AirwallexPLShippingAddress {
+ country_code: Option<enums::CountryAlpha2>,
+ city: Option<String>,
+ street: Option<Secret<String>>,
+ postcode: Option<Secret<String>>,
+}
+
#[derive(Debug, Serialize)]
pub struct DeviceData {
accept_header: String,
@@ -159,6 +222,8 @@ pub struct Mobile {
pub enum AirwallexPaymentMethod {
Card(AirwallexCard),
Wallets(AirwallexWalletData),
+ PayLater(AirwallexPayLaterData),
+ BankRedirect(AirwallexBankRedirectData),
}
#[derive(Debug, Serialize)]
@@ -179,6 +244,7 @@ pub struct AirwallexCardDetails {
#[serde(untagged)]
pub enum AirwallexWalletData {
GooglePay(GooglePayData),
+ Paypal(PaypalData),
}
#[derive(Debug, Serialize)]
@@ -188,17 +254,118 @@ pub struct GooglePayData {
payment_method_type: AirwallexPaymentType,
}
+#[derive(Debug, Serialize)]
+pub struct PaypalData {
+ paypal: PaypalDetails,
+ #[serde(rename = "type")]
+ payment_method_type: AirwallexPaymentType,
+}
+
#[derive(Debug, Serialize)]
pub struct GooglePayDetails {
encrypted_payment_token: Secret<String>,
payment_data_type: GpayPaymentDataType,
}
+#[derive(Debug, Serialize)]
+pub struct PaypalDetails {
+ shopper_name: Option<Secret<String>>,
+ country_code: Option<enums::CountryAlpha2>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum AirwallexPayLaterData {
+ Klarna(Box<KlarnaData>),
+ Atome(AtomeData),
+}
+
+#[derive(Debug, Serialize)]
+pub struct KlarnaData {
+ klarna: KlarnaDetails,
+ #[serde(rename = "type")]
+ payment_method_type: AirwallexPaymentType,
+}
+
+#[derive(Debug, Serialize)]
+pub struct KlarnaDetails {
+ country_code: Option<enums::CountryAlpha2>,
+ language: Option<String>,
+ billing: Billing,
+}
+
+#[derive(Debug, Serialize)]
+pub struct Billing {
+ date_of_birth: Option<Secret<String>>,
+ email: Option<Email>,
+ first_name: Option<Secret<String>>,
+ last_name: Option<Secret<String>>,
+ phone_number: Option<Secret<String>>,
+ address: AddressAirwallex,
+}
+
+#[derive(Debug, Serialize)]
+pub struct AddressAirwallex {
+ country_code: Option<enums::CountryAlpha2>,
+ city: Option<String>,
+ street: Option<Secret<String>>,
+ postcode: Option<Secret<String>>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct AtomeData {
+ atome: AtomeDetails,
+ #[serde(rename = "type")]
+ payment_method_type: AirwallexPaymentType,
+}
+
+#[derive(Debug, Serialize)]
+pub struct AtomeDetails {
+ shopper_phone: Option<Secret<String>>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum AirwallexBankRedirectData {
+ Trustly(TrustlyData),
+ Blik(BlikData),
+}
+
+#[derive(Debug, Serialize)]
+pub struct TrustlyData {
+ trustly: TrustlyDetails,
+ #[serde(rename = "type")]
+ payment_method_type: AirwallexPaymentType,
+}
+
+#[derive(Debug, Serialize)]
+pub struct TrustlyDetails {
+ shopper_name: Option<Secret<String>>,
+ country_code: Option<enums::CountryAlpha2>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct BlikData {
+ blik: BlikDetails,
+ #[serde(rename = "type")]
+ payment_method_type: AirwallexPaymentType,
+}
+
+#[derive(Debug, Serialize)]
+pub struct BlikDetails {
+ shopper_name: Option<Secret<String>>,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum AirwallexPaymentType {
Card,
Googlepay,
+ Paypal,
+ Klarna,
+ Atome,
+ Trustly,
+ Blik,
}
#[derive(Debug, Serialize)]
@@ -211,12 +378,20 @@ pub enum GpayPaymentDataType {
#[serde(rename_all = "snake_case")]
pub enum AirwallexPaymentOptions {
Card(AirwallexCardPaymentOptions),
+ Klarna(AirwallexPayLaterPaymentOptions),
+ Atome(AirwallexPayLaterPaymentOptions),
}
+
#[derive(Debug, Serialize)]
pub struct AirwallexCardPaymentOptions {
auto_capture: bool,
}
+#[derive(Debug, Serialize)]
+pub struct AirwallexPayLaterPaymentOptions {
+ auto_capture: bool,
+}
+
impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>>
for AirwallexPaymentsRequest
{
@@ -247,10 +422,28 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>>
payment_method_type: AirwallexPaymentType::Card,
}))
}
- PaymentMethodData::Wallet(ref wallet_data) => get_wallet_details(wallet_data),
- PaymentMethodData::PayLater(_)
- | PaymentMethodData::BankRedirect(_)
- | PaymentMethodData::BankDebit(_)
+ PaymentMethodData::Wallet(ref wallet_data) => get_wallet_details(wallet_data, item),
+ PaymentMethodData::PayLater(ref paylater_data) => {
+ let paylater_options = AirwallexPayLaterPaymentOptions {
+ auto_capture: item.router_data.request.is_auto_capture()?,
+ };
+
+ payment_method_options = match paylater_data {
+ PayLaterData::KlarnaRedirect { .. } => {
+ Some(AirwallexPaymentOptions::Klarna(paylater_options))
+ }
+ PayLaterData::AtomeRedirect { .. } => {
+ Some(AirwallexPaymentOptions::Atome(paylater_options))
+ }
+ _ => None,
+ };
+
+ get_paylater_details(paylater_data, item)
+ }
+ PaymentMethodData::BankRedirect(ref bankredirect_data) => {
+ get_bankredirect_details(bankredirect_data, item)
+ }
+ PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::CardRedirect(_)
| PaymentMethodData::Crypto(_)
@@ -272,11 +465,24 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>>
}?;
let device_data = get_device_data(item.router_data)?;
+ let return_url = match &request.payment_method_data {
+ PaymentMethodData::Wallet(WalletData::PaypalRedirect(_paypal_details)) => {
+ item.router_data.request.router_return_url.clone()
+ }
+ PaymentMethodData::BankRedirect(_bankredirect_data) => {
+ item.router_data.request.router_return_url.clone()
+ }
+ PaymentMethodData::PayLater(_paylater_data) => {
+ item.router_data.request.router_return_url.clone()
+ }
+ _ => request.complete_authorize_url.clone(),
+ };
+
Ok(Self {
request_id: Uuid::new_v4().to_string(),
payment_method,
payment_method_options,
- return_url: request.complete_authorize_url.clone(),
+ return_url,
device_data,
})
}
@@ -319,8 +525,87 @@ fn get_device_data(
})
}
+fn get_paylater_details(
+ paylater_data: &PayLaterData,
+ item: &AirwallexRouterData<&types::PaymentsAuthorizeRouterData>,
+) -> Result<AirwallexPaymentMethod, errors::ConnectorError> {
+ let paylater_details = match paylater_data {
+ PayLaterData::KlarnaRedirect {} => {
+ AirwallexPaymentMethod::PayLater(AirwallexPayLaterData::Klarna(Box::new(KlarnaData {
+ klarna: KlarnaDetails {
+ country_code: item.router_data.get_optional_billing_country(),
+ language: item
+ .router_data
+ .request
+ .get_optional_language_from_browser_info(),
+ billing: Billing {
+ date_of_birth: None,
+ first_name: item.router_data.get_optional_billing_first_name(),
+ last_name: item.router_data.get_optional_billing_last_name(),
+ email: item.router_data.get_optional_billing_email(),
+ phone_number: item.router_data.get_optional_billing_phone_number(),
+ address: AddressAirwallex {
+ country_code: item.router_data.get_optional_billing_country(),
+ city: item.router_data.get_optional_billing_city(),
+ street: item.router_data.get_optional_billing_line1(),
+ postcode: item.router_data.get_optional_billing_zip(),
+ },
+ },
+ },
+ payment_method_type: AirwallexPaymentType::Klarna,
+ })))
+ }
+ PayLaterData::AtomeRedirect {} => {
+ AirwallexPaymentMethod::PayLater(AirwallexPayLaterData::Atome(AtomeData {
+ atome: AtomeDetails {
+ shopper_phone: item
+ .router_data
+ .get_billing_phone()
+ .ok()
+ .and_then(|phone| phone.get_number_with_country_code().ok()),
+ },
+ payment_method_type: AirwallexPaymentType::Atome,
+ }))
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("airwallex"),
+ ))?,
+ };
+ Ok(paylater_details)
+}
+
+fn get_bankredirect_details(
+ bankredirect_data: &BankRedirectData,
+ item: &AirwallexRouterData<&types::PaymentsAuthorizeRouterData>,
+) -> Result<AirwallexPaymentMethod, errors::ConnectorError> {
+ let bank_redirect_details = match bankredirect_data {
+ BankRedirectData::Trustly { .. } => {
+ AirwallexPaymentMethod::BankRedirect(AirwallexBankRedirectData::Trustly(TrustlyData {
+ trustly: TrustlyDetails {
+ shopper_name: item.router_data.get_optional_billing_full_name(),
+ country_code: item.router_data.get_optional_billing_country(),
+ },
+ payment_method_type: AirwallexPaymentType::Trustly,
+ }))
+ }
+ BankRedirectData::Blik { .. } => {
+ AirwallexPaymentMethod::BankRedirect(AirwallexBankRedirectData::Blik(BlikData {
+ blik: BlikDetails {
+ shopper_name: item.router_data.get_optional_billing_full_name(),
+ },
+ payment_method_type: AirwallexPaymentType::Blik,
+ }))
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("airwallex"),
+ ))?,
+ };
+ Ok(bank_redirect_details)
+}
+
fn get_wallet_details(
wallet_data: &WalletData,
+ item: &AirwallexRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<AirwallexPaymentMethod, errors::ConnectorError> {
let wallet_details: AirwallexPaymentMethod = match wallet_data {
WalletData::GooglePay(gpay_details) => {
@@ -334,6 +619,15 @@ fn get_wallet_details(
payment_method_type: AirwallexPaymentType::Googlepay,
}))
}
+ WalletData::PaypalRedirect(_paypal_details) => {
+ AirwallexPaymentMethod::Wallets(AirwallexWalletData::Paypal(PaypalData {
+ paypal: PaypalDetails {
+ shopper_name: item.router_data.request.customer_name.clone(),
+ country_code: item.router_data.get_optional_billing_country(),
+ },
+ payment_method_type: AirwallexPaymentType::Paypal,
+ }))
+ }
WalletData::AliPayQr(_)
| WalletData::AliPayRedirect(_)
| WalletData::AliPayHkRedirect(_)
@@ -350,7 +644,6 @@ fn get_wallet_details(
| WalletData::GooglePayThirdPartySdk(_)
| WalletData::MbWayRedirect(_)
| WalletData::MobilePayRedirect(_)
- | WalletData::PaypalRedirect(_)
| WalletData::PaypalSdk(_)
| WalletData::Paze(_)
| WalletData::SamsungPay(_)
@@ -490,9 +783,15 @@ pub enum AirwallexPaymentStatus {
Cancelled,
}
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum AirwallexNextAction {
+ Payments(AirwallexPaymentsNextAction),
+ Redirect(AirwallexRedirectNextAction),
+}
+
fn get_payment_status(
status: &AirwallexPaymentStatus,
- next_action: &Option<AirwallexPaymentsNextAction>,
+ next_action: &Option<AirwallexNextAction>,
) -> enums::AttemptStatus {
match status.clone() {
AirwallexPaymentStatus::Succeeded => enums::AttemptStatus::Charged,
@@ -501,13 +800,18 @@ fn get_payment_status(
AirwallexPaymentStatus::RequiresPaymentMethod => enums::AttemptStatus::PaymentMethodAwaited,
AirwallexPaymentStatus::RequiresCustomerAction => next_action.as_ref().map_or(
enums::AttemptStatus::AuthenticationPending,
- |next_action| match next_action.stage {
- AirwallexNextActionStage::WaitingDeviceDataCollection => {
- enums::AttemptStatus::DeviceDataCollectionPending
- }
- AirwallexNextActionStage::WaitingUserInfoInput => {
- enums::AttemptStatus::AuthenticationPending
+ |next_action| match next_action {
+ AirwallexNextAction::Payments(payments_next_action) => {
+ match payments_next_action.stage {
+ AirwallexNextActionStage::WaitingDeviceDataCollection => {
+ enums::AttemptStatus::DeviceDataCollectionPending
+ }
+ AirwallexNextActionStage::WaitingUserInfoInput => {
+ enums::AttemptStatus::AuthenticationPending
+ }
+ }
}
+ AirwallexNextAction::Redirect(_) => enums::AttemptStatus::AuthenticationPending,
},
),
AirwallexPaymentStatus::RequiresCapture => enums::AttemptStatus::Authorized,
@@ -541,6 +845,12 @@ pub struct AirwallexPaymentsNextAction {
stage: AirwallexNextActionStage,
}
+#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]
+pub struct AirwallexRedirectNextAction {
+ url: Url,
+ method: Method,
+}
+
#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]
pub struct AirwallexPaymentsResponse {
status: AirwallexPaymentStatus,
@@ -552,6 +862,15 @@ pub struct AirwallexPaymentsResponse {
next_action: Option<AirwallexPaymentsNextAction>,
}
+#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]
+pub struct AirwallexRedirectResponse {
+ status: AirwallexPaymentStatus,
+ id: String,
+ amount: Option<f32>,
+ payment_consent_id: Option<Secret<String>>,
+ next_action: Option<AirwallexRedirectNextAction>,
+}
+
#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)]
pub struct AirwallexPaymentsSyncResponse {
status: AirwallexPaymentStatus,
@@ -563,6 +882,13 @@ pub struct AirwallexPaymentsSyncResponse {
next_action: Option<AirwallexPaymentsNextAction>,
}
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum AirwallexAuthorizeResponse {
+ AirwallexPaymentsResponse(AirwallexPaymentsResponse),
+ AirwallexRedirectResponse(AirwallexRedirectResponse),
+}
+
fn get_redirection_form(response_url_data: AirwallexPaymentsNextAction) -> Option<RedirectForm> {
Some(RedirectForm::Form {
endpoint: response_url_data.url.to_string(),
@@ -605,6 +931,49 @@ fn get_redirection_form(response_url_data: AirwallexPaymentsNextAction) -> Optio
})
}
+impl<F, T>
+ ForeignTryFrom<ResponseRouterData<F, AirwallexAuthorizeResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn foreign_try_from(
+ item: ResponseRouterData<F, AirwallexAuthorizeResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let ResponseRouterData {
+ response,
+ data,
+ http_code,
+ } = item;
+
+ match response {
+ AirwallexAuthorizeResponse::AirwallexPaymentsResponse(res) => {
+ Self::try_from(ResponseRouterData::<
+ F,
+ AirwallexPaymentsResponse,
+ T,
+ PaymentsResponseData,
+ > {
+ response: res,
+ data,
+ http_code,
+ })
+ }
+ AirwallexAuthorizeResponse::AirwallexRedirectResponse(res) => {
+ Self::try_from(ResponseRouterData::<
+ F,
+ AirwallexRedirectResponse,
+ T,
+ PaymentsResponseData,
+ > {
+ response: res,
+ data,
+ http_code,
+ })
+ }
+ }
+ }
+}
+
impl<F, T> TryFrom<ResponseRouterData<F, AirwallexPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
@@ -615,7 +984,15 @@ impl<F, T> TryFrom<ResponseRouterData<F, AirwallexPaymentsResponse, T, PaymentsR
let (status, redirection_data) = item.response.next_action.clone().map_or(
// If no next action is there, map the status and set redirection form as None
(
- get_payment_status(&item.response.status, &item.response.next_action),
+ get_payment_status(
+ &item.response.status,
+ &item
+ .response
+ .next_action
+ .clone()
+ .map(AirwallexNextAction::Payments)
+ .clone(),
+ ),
None,
),
|response_url_data| {
@@ -631,30 +1008,93 @@ impl<F, T> TryFrom<ResponseRouterData<F, AirwallexPaymentsResponse, T, PaymentsR
// If the connector sends waiting for DDC and our status is already DDC Pending
// that means we initiated the call to collect the data and now we expect a different response
(
- AirwallexNextActionStage::WaitingDeviceDataCollection,
- enums::AttemptStatus::DeviceDataCollectionPending,
- _
- )
- // If the connector sends waiting for Customer Action and our status is already Authenticaition Pending
- // that means we initiated the call to authenticate and now we do not expect a requires_customer action
- // it will start a loop
- | (
- _,
- enums::AttemptStatus::AuthenticationPending,
- AirwallexPaymentStatus::RequiresCustomerAction,
- )
+ AirwallexNextActionStage::WaitingDeviceDataCollection,
+ enums::AttemptStatus::DeviceDataCollectionPending,
+ _
+ )
+ // If the connector sends waiting for Customer Action and our status is already Authenticaition Pending
+ // that means we initiated the call to authenticate and now we do not expect a requires_customer action
+ // it will start a loop
+ | (
+ _,
+ enums::AttemptStatus::AuthenticationPending,
+ AirwallexPaymentStatus::RequiresCustomerAction,
+ )
) {
// Fail the payment for above conditions
(enums::AttemptStatus::AuthenticationFailed, None)
} else {
(
//Build the redirect form and update the payment status
- get_payment_status(&item.response.status, &item.response.next_action),
+ get_payment_status(
+ &item.response.status,
+ &item
+ .response
+ .next_action
+ .map(AirwallexNextAction::Payments)
+ .clone(),
+ ),
get_redirection_form(response_url_data),
)
}
},
);
+
+ Ok(Self {
+ status,
+ reference_id: Some(item.response.id.clone()),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()),
+ redirection_data: Box::new(redirection_data),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.id),
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, AirwallexRedirectResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, AirwallexRedirectResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let (status, redirection_data) = item.response.next_action.clone().map_or(
+ (
+ get_payment_status(
+ &item.response.status,
+ &item
+ .response
+ .next_action
+ .clone()
+ .map(AirwallexNextAction::Redirect)
+ .clone(),
+ ),
+ None,
+ ),
+ |response_url_data| {
+ let redirection_data =
+ Some(RedirectForm::from((response_url_data.url, Method::Get)));
+ (
+ get_payment_status(
+ &item.response.status,
+ &item
+ .response
+ .next_action
+ .map(AirwallexNextAction::Redirect)
+ .clone(),
+ ),
+ redirection_data,
+ )
+ },
+ );
+
Ok(Self {
status,
reference_id: Some(item.response.id.clone()),
@@ -692,7 +1132,15 @@ impl
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let status = get_payment_status(&item.response.status, &item.response.next_action);
+ let status = get_payment_status(
+ &item.response.status,
+ &item
+ .response
+ .next_action
+ .clone()
+ .map(AirwallexNextAction::Payments)
+ .clone(),
+ );
let redirection_data = if let Some(redirect_url_data) = item.response.next_action {
get_redirection_form(redirect_url_data)
} else {
@@ -720,7 +1168,7 @@ impl
pub struct AirwallexRefundRequest {
// Unique ID to be sent for each transaction/operation request to the connector
request_id: String,
- amount: Option<String>,
+ amount: Option<StringMajorUnit>,
reason: Option<String>,
//Identifier for the PaymentIntent for which Refund is requested
payment_intent_id: String,
@@ -969,6 +1417,7 @@ impl TryFrom<AirwallexWebhookEventType> for api_models::webhooks::IncomingWebhoo
}
AirwallexWebhookEventType::DisputeLost => Self::DisputeLost,
AirwallexWebhookEventType::Unknown
+ | AirwallexWebhookEventType::PaymentAttemptAuthenticationRedirected
| AirwallexWebhookEventType::PaymentIntentCreated
| AirwallexWebhookEventType::PaymentIntentRequiresPaymentMethod
| AirwallexWebhookEventType::PaymentIntentCancelled
@@ -978,7 +1427,6 @@ impl TryFrom<AirwallexWebhookEventType> for api_models::webhooks::IncomingWebhoo
| AirwallexWebhookEventType::PaymentAttemptAuthorizationFailed
| AirwallexWebhookEventType::PaymentAttemptCaptureRequested
| AirwallexWebhookEventType::PaymentAttemptCaptureFailed
- | AirwallexWebhookEventType::PaymentAttemptAuthenticationRedirected
| AirwallexWebhookEventType::PaymentAttemptAuthenticationFailed
| AirwallexWebhookEventType::PaymentAttemptCancelled
| AirwallexWebhookEventType::PaymentAttemptExpired
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js b/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js
index 69d2ab7563..a5ae171e23 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Airwallex.js
@@ -798,4 +798,44 @@ export const connectorDetails = {
},
},
},
+ bank_redirect_pm: {
+ Trustly: {
+ Request: {
+ payment_method: "bank_redirect",
+ payment_method_type: "trustly",
+ payment_method_data: {
+ bank_redirect: {
+ trustly: {
+ country: "NL",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ Blik: {
+ Request: {
+ payment_method: "bank_redirect",
+ payment_method_type: "blik",
+ payment_method_data: {
+ bank_redirect: {
+ blik: {
+ blik_code: "000000",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ },
};
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 4711699bdf..85a70dc877 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -567,6 +567,16 @@ eft = { country = "NG, ZA, GH, KE, CI", currency = "NGN, GHS, ZAR, KES, USD" }
[pm_filters.santander]
pix = { country = "BR", currency = "BRL" }
+[pm_filters.airwallex]
+credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,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,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" }
+paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,JPY,MYR,MXN,NOK,NZD,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
+klarna = { currency = "EUR, DKK, NOK, PLN, SEK, CHF, GBP, USD, CZK" }
+trustly = {currency="DKK, EUR, GBP, NOK, PLN, SEK" }
+blik = { country="PL" , currency = "PLN" }
+atome = { country = "SG, MY" , currency = "SGD, MYR" }
+
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }