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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(connector): [shift4] Blik, Klarna, Bitpay PMs added (#8478)
sweta-sharma37a95e373367
diff --git a/config/config.example.toml b/config/config.example.tomlindex 2d5d4f471c..888db62bbc 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -822,6 +822,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.inespay]sepa = { country = "ES", currency = "EUR"}diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.tomlindex 6d5cfb6585..2bb07055e8 100644--- a/config/deployments/integration_test.toml+++ b/config/deployments/integration_test.toml@@ -655,6 +655,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.placetopay]credit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD"}diff --git a/config/deployments/production.toml b/config/deployments/production.tomlindex 4e68cadd28..9fa5a62f58 100644--- a/config/deployments/production.toml+++ b/config/deployments/production.toml@@ -665,6 +665,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.bluesnap]credit = { country = "AD,AE,AG,AL,AM,AO,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BJ,BN,BO,BR,BS,BT,BW,BY,BZ,CA,CD,CF,CG,CH,CI,CL,CM,CN,CO,CR,CV,CY,CZ,DE,DK,DJ,DM,DO,DZ,EC,EE,EG,ER,ES,ET,FI,FJ,FM,FR,GA,GB,GD,GE,GG,GH,GM,GN,GQ,GR,GT,GW,GY,HN,HR,HT,HU,ID,IE,IL,IN,IS,IT,JM,JP,JO,KE,KG,KH,KI,KM,KN,KR,KW,KZ,LA,LB,LC,LI,LK,LR,LS,LT,LU,LV,MA,MC,MD,ME,MG,MH,MK,ML,MM,MN,MR,MT,MU,MV,MW,MX,MY,MZ,NA,NE,NG,NI,NL,NO,NP,NR,NZ,OM,PA,PE,PG,PH,PK,PL,PS,PT,PW,PY,QA,RO,RS,RW,SA,SB,SC,SE,SG,SI,SK,SL,SM,SN,SO,SR,SS,ST,SV,SZ,TD,TG,TH,TJ,TL,TM,TN,TO,TR,TT,TV,TZ,UA,UG,US,UY,UZ,VA,VC,VE,VN,VU,WS,ZA,ZM,ZW", currency = "AED,AFN,ALL,AMD,ANG,ARS,AUD,AWG,BAM,BBD,BGN,BHD,BMD,BND,BOB,BRL,BSD,BWP,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,FJD,GBP,GEL,GIP,GTQ,HKD,HUF,IDR,ILS,INR,ISK,JMD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MUR,MWK,MXN,MYR,NAD,NGN,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PLN,PKR,QAR,RON,RSD,RUB,SAR,SCR,SDG,SEK,SGD,THB,TND,TRY,TTD,TWD,TZS,UAH,USD,UYU,UZS,VND,XAF,XCD,XOF,ZAR"}diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.tomlindex 699f24e76c..adca23f499 100644--- a/config/deployments/sandbox.toml+++ b/config/deployments/sandbox.toml@@ -686,6 +686,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.placetopay]credit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD"}diff --git a/config/development.toml b/config/development.tomlindex b4cb8fa259..c9d6e70dd7 100644--- a/config/development.toml+++ b/config/development.toml@@ -848,6 +848,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.placetopay]credit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD"}diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex 2f22764cda..af1fc3ea68 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -784,6 +784,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.inespay]sepa = { country = "ES", currency = "EUR"}diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rsindex c8d92dafea..10d9634b39 100644--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs@@ -920,6 +920,17 @@ lazy_static! {});+ shift4_supported_payment_methods.add(+ enums::PaymentMethod::BankRedirect,+ enums::PaymentMethodType::Blik,+ PaymentMethodDetails{+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods2.clone(),+ specific_features: None+ }+ );+shift4_supported_payment_methods.add(enums::PaymentMethod::Voucher,enums::PaymentMethodType::Boleto,@@ -991,6 +1002,28 @@ lazy_static! {},);+ shift4_supported_payment_methods.add(+ enums::PaymentMethod::PayLater,+ enums::PaymentMethodType::Klarna,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods2.clone(),+ specific_features: None,+ },+ );++ shift4_supported_payment_methods.add(+ enums::PaymentMethod::Crypto,+ enums::PaymentMethodType::CryptoCurrency,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods2.clone(),+ specific_features: None,+ },+ );+shift4_supported_payment_methods};diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rsindex 9dc2a835b4..fc9af3da71 100644--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs@@ -9,8 +9,8 @@ use common_utils::{use error_stack::ResultExt;use hyperswitch_domain_models::{payment_method_data::{- BankRedirectData, BankTransferData, Card as CardData, GiftCardData, PaymentMethodData,- VoucherData, WalletData,+ BankRedirectData, BankTransferData, Card as CardData, CryptoData, GiftCardData,+ PayLaterData, PaymentMethodData, VoucherData, WalletData,},router_data::{ConnectorAuthType, RouterData},router_flow_types::refunds::{Execute, RSync},@@ -135,6 +135,8 @@ pub enum Shift4PaymentMethod {Cards3DSRequest(Box<Cards3DSRequest>),VoucherRequest(Box<VoucherRequest>),WalletRequest(Box<WalletRequest>),+ PayLaterRequest(Box<PayLaterRequest>),+ CryptoRequest(Box<CryptoRequest>),}#[derive(Debug, Serialize)]@@ -144,6 +146,20 @@ pub struct WalletRequest {payment_method: PaymentMethod,}+#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct PayLaterRequest {+ flow: Flow,+ payment_method: PaymentMethod,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct CryptoRequest {+ flow: Flow,+ payment_method: PaymentMethod,+}+#[derive(Debug, Serialize)]#[serde(rename_all = "camelCase")]pub struct VoucherRequest {@@ -185,7 +201,7 @@ pub struct Flow {}#[derive(Debug, Serialize)]-#[serde(rename_all = "lowercase")]+#[serde(rename_all = "snake_case")]pub enum PaymentMethodType {Eps,Giropay,@@ -195,6 +211,9 @@ pub enum PaymentMethodType {Trustly,Alipay,Wechatpay,+ Blik,+ KlarnaDebitRisk,+ Bitpay,}#[derive(Debug, Serialize)]@@ -264,6 +283,48 @@ where}}+impl TryFrom<&PayLaterData> for PaymentMethodType {+ type Error = Error;+ fn try_from(value: &PayLaterData) -> Result<Self, Self::Error> {+ match value {+ PayLaterData::KlarnaRedirect { .. } => Ok(Self::KlarnaDebitRisk),+ PayLaterData::AffirmRedirect { .. }+ | PayLaterData::AfterpayClearpayRedirect { .. }+ | PayLaterData::PayBrightRedirect { .. }+ | PayLaterData::WalleyRedirect { .. }+ | PayLaterData::AlmaRedirect { .. }+ | PayLaterData::AtomeRedirect { .. }+ | PayLaterData::KlarnaSdk { .. } => Err(errors::ConnectorError::NotImplemented(+ utils::get_unimplemented_payment_method_error_message("Shift4"),+ )+ .into()),+ }+ }+}++impl<T, Req> TryFrom<(&RouterData<T, Req, PaymentsResponseData>, &PayLaterData)>+ for Shift4PaymentMethod+where+ Req: Shift4AuthorizePreprocessingCommon,+{+ type Error = Error;+ fn try_from(+ (item, pay_later_data): (&RouterData<T, Req, PaymentsResponseData>, &PayLaterData),+ ) -> Result<Self, Self::Error> {+ let flow = Flow::try_from(item.request.get_router_return_url())?;+ let method_type = PaymentMethodType::try_from(pay_later_data)?;+ let billing = Billing::try_from(item)?;+ let payment_method = PaymentMethod {+ method_type,+ billing,+ };+ Ok(Self::BankRedirectRequest(Box::new(BankRedirectRequest {+ payment_method,+ flow,+ })))+ }+}+impl<T, Req> TryFrom<&RouterData<T, Req, PaymentsResponseData>> for Shift4PaymentMethodwhereReq: Shift4AuthorizePreprocessingCommon,@@ -281,10 +342,12 @@ wherePaymentMethodData::GiftCard(ref giftcard_data) => {Self::try_from(giftcard_data.as_ref())}+ PaymentMethodData::PayLater(ref pay_later_data) => {+ Self::try_from((item, pay_later_data))+ }+ PaymentMethodData::Crypto(ref crypto_data) => Self::try_from((item, crypto_data)),PaymentMethodData::CardRedirect(_)- | PaymentMethodData::PayLater(_)| PaymentMethodData::BankDebit(_)- | PaymentMethodData::Crypto(_)| PaymentMethodData::MandatePayment| PaymentMethodData::Reward| PaymentMethodData::RealTimePayment(_)@@ -527,6 +590,37 @@ where}}+impl TryFrom<&CryptoData> for PaymentMethodType {+ type Error = Error;++ fn try_from(_value: &CryptoData) -> Result<Self, Self::Error> {+ Ok(Self::Bitpay)+ }+}++impl<T, Req> TryFrom<(&RouterData<T, Req, PaymentsResponseData>, &CryptoData)>+ for Shift4PaymentMethod+where+ Req: Shift4AuthorizePreprocessingCommon,+{+ type Error = Error;+ fn try_from(+ (item, redirect_data): (&RouterData<T, Req, PaymentsResponseData>, &CryptoData),+ ) -> Result<Self, Self::Error> {+ let flow = Flow::try_from(item.request.get_router_return_url())?;+ let method_type = PaymentMethodType::try_from(redirect_data)?;+ let billing = Billing::try_from(item)?;+ let payment_method = PaymentMethod {+ method_type,+ billing,+ };+ Ok(Self::CryptoRequest(Box::new(CryptoRequest {+ payment_method,+ flow,+ })))+ }+}+impl<T> TryFrom<&Shift4RouterData<&RouterData<T, CompleteAuthorizeData, PaymentsResponseData>>>for Shift4PaymentsRequest{@@ -585,8 +679,8 @@ impl TryFrom<&BankRedirectData> for PaymentMethodType {BankRedirectData::Ideal { .. } => Ok(Self::Ideal),BankRedirectData::Sofort { .. } => Ok(Self::Sofort),BankRedirectData::Trustly { .. } => Ok(Self::Trustly),+ BankRedirectData::Blik { .. } => Ok(Self::Blik),BankRedirectData::BancontactCard { .. }- | BankRedirectData::Blik { .. }| BankRedirectData::Eft { .. }| BankRedirectData::Przelewy24 { .. }| BankRedirectData::Bizum {}diff --git a/loadtest/config/development.toml b/loadtest/config/development.tomlindex 6664b3d90c..28e3e724c3 100644--- a/loadtest/config/development.toml+++ b/loadtest/config/development.toml@@ -473,6 +473,9 @@ boleto = { country = "BR", currency = "BRL" }trustly = { currency = "CZK,DKK,EUR,GBP,NOK,SEK" }ali_pay = { country = "CN", currency = "CNY" }we_chat_pay = { country = "CN", currency = "CNY" }+klarna = { currency = "EUR,GBP,CHF,SEK" }+blik = { country = "PL", currency = "PLN" }+crypto_currency = { currency = "USD,GBP,AED" }[pm_filters.getnet]credit = { country = "AR, BR, CL, MX, UY, ES, PT, DE, IT, FR, NL, BE, AT, PL, CH, GB, IE, LU, DK, SE, NO, FI, IN, AE", currency = "ARS, BRL, CLP, MXN, UYU, EUR, PLN, CHF, GBP, DKK, SEK, NOK, INR, AED" }