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

refactor(connector): [Square] remove default case handling (#2701)

HeetVekariya05100ea38d54
diff --git a/crates/router/src/connector/square/transformers.rs b/crates/router/src/connector/square/transformers.rs
index 01ed507bf3..54a7c461db 100644
--- a/crates/router/src/connector/square/transformers.rs
+++ b/crates/router/src/connector/square/transformers.rs
@@ -23,7 +23,10 @@ impl TryFrom<(&types::TokenizationRouterData, BankDebitData)> for SquareTokenReq
"Payment Method".to_string(),
))
.into_report(),
- _ => Err(errors::ConnectorError::NotSupported {
+
+ BankDebitData::SepaBankDebit { .. }
+ | BankDebitData::BecsBankDebit { .. }
+ | BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotSupported {
message: format!("{:?}", item.request.payment_method_data),
connector: "Square",
})?,
@@ -85,7 +88,14 @@ impl TryFrom<(&types::TokenizationRouterData, PayLaterData)> for SquareTokenRequ
errors::ConnectorError::NotImplemented("Payment Method".to_string()),
)
.into_report(),
- _ => Err(errors::ConnectorError::NotSupported {
+
+ PayLaterData::KlarnaRedirect { .. }
+ | PayLaterData::KlarnaSdk { .. }
+ | PayLaterData::AffirmRedirect { .. }
+ | PayLaterData::PayBrightRedirect { .. }
+ | PayLaterData::WalleyRedirect { .. }
+ | PayLaterData::AlmaRedirect { .. }
+ | PayLaterData::AtomeRedirect { .. } => Err(errors::ConnectorError::NotSupported {
message: format!("{:?}", item.request.payment_method_data),
connector: "Square",
})?,
@@ -106,7 +116,31 @@ impl TryFrom<(&types::TokenizationRouterData, WalletData)> for SquareTokenReques
"Payment Method".to_string(),
))
.into_report(),
- _ => Err(errors::ConnectorError::NotSupported {
+
+ WalletData::AliPayQr(_)
+ | WalletData::AliPayRedirect(_)
+ | WalletData::AliPayHkRedirect(_)
+ | WalletData::MomoRedirect(_)
+ | WalletData::KakaoPayRedirect(_)
+ | WalletData::GoPayRedirect(_)
+ | WalletData::GcashRedirect(_)
+ | WalletData::ApplePayRedirect(_)
+ | WalletData::ApplePayThirdPartySdk(_)
+ | WalletData::DanaRedirect {}
+ | WalletData::GooglePayRedirect(_)
+ | WalletData::GooglePayThirdPartySdk(_)
+ | WalletData::MbWayRedirect(_)
+ | WalletData::MobilePayRedirect(_)
+ | WalletData::PaypalRedirect(_)
+ | WalletData::PaypalSdk(_)
+ | WalletData::SamsungPay(_)
+ | WalletData::TwintRedirect {}
+ | WalletData::VippsRedirect {}
+ | WalletData::TouchNGoRedirect(_)
+ | WalletData::WeChatPayRedirect(_)
+ | WalletData::WeChatPayQr(_)
+ | WalletData::CashappQr(_)
+ | WalletData::SwishQr(_) => Err(errors::ConnectorError::NotSupported {
message: format!("{:?}", item.request.payment_method_data),
connector: "Square",
})?,
@@ -295,7 +329,14 @@ impl TryFrom<&types::ConnectorAuthType> for SquareAuthType {
api_key: api_key.to_owned(),
key1: key1.to_owned(),
}),
- _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+
+ types::ConnectorAuthType::HeaderKey { .. }
+ | types::ConnectorAuthType::SignatureKey { .. }
+ | types::ConnectorAuthType::MultiAuthKey { .. }
+ | types::ConnectorAuthType::CurrencyAuthKey { .. }
+ | types::ConnectorAuthType::NoKey { .. } => {
+ Err(errors::ConnectorError::FailedToObtainAuthType.into())
+ }
}
}
}