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): [Noon] Add GooglePay, ApplePay, PayPal Support (#1450)

SamraatBansal8ebcc1ce3935
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index 666713d97f..d98ad9c135 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -10,6 +10,10 @@ use crate::{
types::{self, api, storage::enums},
};
+// These needs to be accepted from SDK, need to be done after 1.0.0 stability as API contract will change
+const GOOGLEPAY_API_VERSION_MINOR: u8 = 0;
+const GOOGLEPAY_API_VERSION: u8 = 2;
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum NoonChannels {
@@ -73,11 +77,34 @@ pub struct NoonCard {
cvv: Secret<String>,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NoonApplePay {
+ payment_token: Secret<String>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NoonGooglePay {
+ api_version_minor: u8,
+ api_version: u8,
+ payment_method_data: conn_utils::GooglePayWalletData,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NoonPayPal {
+ return_url: String,
+}
+
#[derive(Debug, Serialize)]
#[serde(tag = "type", content = "data")]
pub enum NoonPaymentData {
Card(NoonCard),
Subscription(NoonSubscription),
+ ApplePay(NoonApplePay),
+ GooglePay(NoonGooglePay),
+ PayPal(NoonPayPal),
}
#[derive(Debug, Serialize)]
@@ -118,6 +145,30 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
expiry_year: req_card.card_exp_year,
cvv: req_card.card_cvc,
})),
+ api::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
+ api_models::payments::WalletData::GooglePay(google_pay_data) => {
+ Ok(NoonPaymentData::GooglePay(NoonGooglePay {
+ api_version_minor: GOOGLEPAY_API_VERSION_MINOR,
+ api_version: GOOGLEPAY_API_VERSION,
+ payment_method_data: conn_utils::GooglePayWalletData::from(
+ google_pay_data,
+ ),
+ }))
+ }
+ api_models::payments::WalletData::ApplePay(apple_pay_data) => {
+ Ok(NoonPaymentData::ApplePay(NoonApplePay {
+ payment_token: Secret::new(apple_pay_data.payment_data),
+ }))
+ }
+ api_models::payments::WalletData::PaypalRedirect(_) => {
+ Ok(NoonPaymentData::PayPal(NoonPayPal {
+ return_url: item.request.get_router_return_url()?,
+ }))
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Wallets".to_string(),
+ )),
+ },
_ => Err(errors::ConnectorError::NotImplemented(
"Payment methods".to_string(),
)),