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
fix(Connector): [Noon] Update ApplePay Payment Struct (#1794)
SamraatBansalb96687c3fa86
diff --git a/config/config.example.toml b/config/config.example.tomlindex e96b54a20c..bae450663a 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -200,6 +200,10 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"zen.base_url = "https://api.zen-test.com/"zen.secondary_base_url = "https://secure.zen-test.com/"+#Payment Method Filters Based on Country and Currency+[pm_filters.default]+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }+# Bank redirect configs for allowed banks through online_banking_czech_republic payment method[bank_config.online_banking_czech_republic]adyen = { banks = "ceska_sporitelna,komercni_banka,platnosc_online_karta_platnicza" }diff --git a/config/development.toml b/config/development.tomlindex 237154253f..11c268dca3 100644--- a/config/development.toml+++ b/config/development.toml@@ -204,7 +204,7 @@ adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_ba[pm_filters.default]google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }-apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }paypal = { currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" }klarna = { country = "AT,BE,DK,FI,FR,DE,IE,IT,NL,NO,ES,SE,GB,US,CA", currency = "USD,GBP,EUR,CHF,DKK,SEK,NOK,AUD,PLN,CAD" }affirm = { country = "US", currency = "USD" }diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex 073abc578c..f142e31a15 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -123,6 +123,9 @@ zen.base_url = "https://api.zen-test.com/"zen.secondary_base_url = "https://secure.zen-test.com/"+[pm_filters.default]+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }+[connectors.supported]wallets = ["klarna", "braintree", "applepay"]rewards = ["cashtocode", "zen"]diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rsindex 648a708245..b7b200804c 100644--- a/crates/router/src/connector/noon/transformers.rs+++ b/crates/router/src/connector/noon/transformers.rs@@ -1,13 +1,16 @@+use error_stack::ResultExt;use masking::Secret;use serde::{Deserialize, Serialize};use crate::{connector::utils::{self as conn_utils, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData,+ WalletData,},core::errors,services,types::{self, api, storage::enums, ErrorResponse},+ utils,};// These needs to be accepted from SDK, need to be done after 1.0.0 stability as API contract will change@@ -77,10 +80,49 @@ pub struct NoonCard {cvv: Secret<String>,}+#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonApplePayPaymentMethod {+ pub display_name: String,+ pub network: String,+ #[serde(rename = "type")]+ pub pm_type: String,+}++#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonApplePayHeader {+ ephemeral_public_key: Secret<String>,+ public_key_hash: Secret<String>,+ transaction_id: Secret<String>,+}++#[derive(Debug, Serialize, Deserialize)]+pub struct NoonApplePaymentData {+ version: Secret<String>,+ data: Secret<String>,+ signature: Secret<String>,+ header: NoonApplePayHeader,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonApplePayData {+ payment_data: NoonApplePaymentData,+ payment_method: NoonApplePayPaymentMethod,+ transaction_identifier: Secret<String>,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonApplePayTokenData {+ token: NoonApplePayData,+}+#[derive(Debug, Serialize)]#[serde(rename_all = "camelCase")]pub struct NoonApplePay {- payment_token: Secret<String>,+ payment_info: Secret<String>,}#[derive(Debug, Serialize)]@@ -145,7 +187,7 @@ 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::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() {api_models::payments::WalletData::GooglePay(google_pay_data) => {Ok(NoonPaymentData::GooglePay(NoonGooglePay {api_version_minor: GOOGLEPAY_API_VERSION_MINOR,@@ -156,8 +198,27 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {}))}api_models::payments::WalletData::ApplePay(apple_pay_data) => {+ let payment_token_data = NoonApplePayTokenData {+ token: NoonApplePayData {+ payment_data: wallet_data.get_wallet_token_as_json()?,+ payment_method: NoonApplePayPaymentMethod {+ display_name: apple_pay_data.payment_method.display_name,+ network: apple_pay_data.payment_method.network,+ pm_type: apple_pay_data.payment_method.pm_type,+ },+ transaction_identifier: Secret::new(+ apple_pay_data.transaction_identifier,+ ),+ },+ };+ let payment_token =+ utils::Encode::<NoonApplePayTokenData>::encode_to_string_of_json(+ &payment_token_data,+ )+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;+Ok(NoonPaymentData::ApplePay(NoonApplePay {- payment_token: Secret::new(apple_pay_data.payment_data),+ payment_info: Secret::new(payment_token),}))}api_models::payments::WalletData::PaypalRedirect(_) => {diff --git a/loadtest/config/development.toml b/loadtest/config/development.tomlindex 3291e442d2..b3e599be96 100644--- a/loadtest/config/development.toml+++ b/loadtest/config/development.toml@@ -109,6 +109,9 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"zen.base_url = "https://api.zen-test.com/"zen.secondary_base_url = "https://secure.zen-test.com/"+[pm_filters.default]+apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }+[connectors.supported]wallets = ["klarna", "braintree", "applepay"]rewards = ["cashtocode", "zen"]