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): [paysafe] introduce applepay encrypt and predecrypt flow (#9358)

Pa1NarK2e0da5c03229
diff --git a/config/config.example.toml b/config/config.example.toml
index 499dd8e806..b69f959fbe 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -947,6 +947,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.paysafe]
+apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+
[connector_customer]
connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe"
payout_connector_list = "nomupay,stripe,wise"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 3f2586eeeb..5f8f8b4a62 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -819,6 +819,9 @@ giropay = { country = "DZ,AO,BJ,BW,BF,BI,CM,CV,TD,KM,CI,CD,DJ,EG,ER,ET,GA,GM,GN,
ideal = { country = "DZ,AO,BJ,BW,BF,BI,CM,CV,TD,KM,CI,CD,DJ,EG,ER,ET,GA,GM,GN,GW,KE,LS,MG,MW,ML,MR,MU,MA,MZ,NA,NE,NG,CG,RW,SH,ST,SN,SC,SL,SO,ZA,SZ,TZ,TG,TN,UG,ZM,ZW,AI,AG,AR,AW,BS,BB,BZ,BM,BO,BR,VG,CA,KY,CL,CO,CR,DM,DO,EC,SV,FK,GL,GD,GT,GY,HN,JM,MX,MS,NI,PA,PY,PE,KN,LC,PM,VC,SR,TT,TC,US,UY,VE,AM,AU,BH,BT,BN,KH,CN,CK,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LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+
[pm_filters.datatrans]
credit = { country = "AL,AD,AM,AT,AZ,BY,BE,BA,BG,CH,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GE,GR,HR,HU,IE,IS,IT,KZ,LI,LT,LU,LV,MC,MD,ME,MK,MT,NL,NO,PL,PT,RO,RU,SE,SI,SK,SM,TR,UA,VA", currency = "BHD,BIF,CHF,DJF,EUR,GBP,GNF,IQD,ISK,JPY,JOD,KMF,KRW,KWD,LYD,OMR,PYG,RWF,TND,UGX,USD,VND,VUV,XAF,XOF,XPF" }
debit = { country = "AL,AD,AM,AT,AZ,BY,BE,BA,BG,CH,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GE,GR,HR,HU,IE,IS,IT,KZ,LI,LT,LU,LV,MC,MD,ME,MK,MT,NL,NO,PL,PT,RO,RU,SE,SI,SK,SM,TR,UA,VA", currency = "BHD,BIF,CHF,DJF,EUR,GBP,GNF,IQD,ISK,JPY,JOD,KMF,KRW,KWD,LYD,OMR,PYG,RWF,TND,UGX,USD,VND,VUV,XAF,XOF,XPF" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 5f157f4de0..491ca6a9ea 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -829,6 +829,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.paysafe]
+apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ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CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" }
credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP" }
@@ -871,7 +874,7 @@ dwolla = { long_lived_token = true, payment_method = "bank_debit" }
outgoing_enabled = true
redis_lock_expiry_seconds = 180
-[l2_l3_data_config]
+[l2_l3_data_config]
enabled = "false"
[webhook_source_verification_call]
@@ -908,4 +911,3 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
[grpc_client.unified_connector_service]
ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
-
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 74e5ea0e39..b25eb5ff62 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -841,6 +841,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.paysafe]
+apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+
[payout_method_filters.stripe]
ach = { country = "US", currency = "USD" }
diff --git a/config/development.toml b/config/development.toml
index 7a8ff3048a..15a0348d7d 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -989,6 +989,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.paysafe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AR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 9d70cc9d61..ef0ca21ebf 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -972,6 +972,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.paysafe]
+apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+
[bank_config.online_banking_fpx]
adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
fiuu.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_of_china,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
@@ -1258,7 +1261,7 @@ max_retry_count_for_thirty_day = 20
[revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery
initial_timestamp_in_seconds = 3600 # number of seconds added to start time for Decider service of Revenue Recovery
-job_schedule_buffer_time_in_seconds = 3600 # time in seconds to be added in schedule time as a buffer
+job_schedule_buffer_time_in_seconds = 3600 # time in seconds to be added in schedule time as a buffer
reopen_workflow_buffer_time_in_seconds = 60 # time in seconds to be added in scheduling for calculate workflow
[clone_connector_allowlist]
diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rs
index e57c4370e4..57f239f613 100644
--- a/crates/common_types/src/payments.rs
+++ b/crates/common_types/src/payments.rs
@@ -669,6 +669,13 @@ impl ApplePayPredecryptData {
let month = self.get_expiry_month()?.expose();
Ok(Secret::new(format!("{month}{year}")))
}
+
+ /// Get the expiry date in YYMM format from the Apple Pay pre-decrypt data
+ pub fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ValidationError> {
+ let year = self.get_two_digit_expiry_year()?.expose();
+ let month = self.get_expiry_month()?.expose();
+ Ok(Secret::new(format!("{year}{month}")))
+ }
}
/// type of action that needs to taken after consuming recovery payload
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 3c86878215..6db43c3174 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -121,13 +121,22 @@ pub struct AccountIdConfigForRedirect {
pub three_ds: Option<Vec<InputData>>,
}
+#[serde_with::skip_serializing_none]
+#[derive(Debug, Deserialize, Serialize, Clone)]
+
+pub struct AccountIdConfigForApplePay {
+ pub encrypt: Option<Vec<InputData>>,
+ pub decrypt: Option<Vec<InputData>>,
+}
+
#[serde_with::skip_serializing_none]
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct AccountIDSupportedMethods {
+ apple_pay: HashMap<String, AccountIdConfigForApplePay>,
card: HashMap<String, AccountIdConfigForCard>,
- skrill: HashMap<String, AccountIdConfigForRedirect>,
interac: HashMap<String, AccountIdConfigForRedirect>,
pay_safe_card: HashMap<String, AccountIdConfigForRedirect>,
+ skrill: HashMap<String, AccountIdConfigForRedirect>,
}
#[serde_with::skip_serializing_none]
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 713f875075..0871692caa 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -2158,7 +2158,7 @@ merchant_secret="Source verification key"
api_key="Client ID"
key1="Client Secret"
[dwolla.connector_webhook_details]
-merchant_secret="Source verification key"
+merchant_secret = "Source verification key"
[dwolla.metadata.merchant_funding_source]
name = "merchant_funding_source"
label = "Funding Source ID"
@@ -6647,7 +6647,7 @@ options=[]
[[santander.voucher]]
payment_method_type = "boleto"
[[santander.bank_transfer]]
- payment_method_type = "pix"
+ payment_method_type = "pix"
[santander.connector_auth.BodyKey]
api_key="Client ID"
@@ -6882,11 +6882,16 @@ payment_method_type = "interac"
payment_method_type = "skrill"
[[paysafe.gift_card]]
payment_method_type = "pay_safe_card"
+[[paysafe.wallet]]
+payment_method_type = "apple_pay"
+
[paysafe.connector_auth.BodyKey]
api_key = "Username"
key1 = "Password"
+
[paysafe.connector_webhook_details]
merchant_secret = "Source verification key"
+
[[paysafe.metadata.account_id.card.USD.three_ds]]
name="three_ds"
label="ThreeDS account id"
@@ -6954,6 +6959,71 @@ placeholder="Enter eur Account ID"
required=true
type="Text"
+[[paysafe.metadata.account_id.apple_pay.USD.encrypt]]
+name="encrypt"
+label="Encrypt"
+placeholder="Enter encrypt value"
+required=true
+type="Text"
+[[paysafe.metadata.account_id.apple_pay.USD.decrypt]]
+name="decrypt"
+label="Decrypt"
+placeholder="Enter decrypt value"
+required=true
+type="Text"
+
+[[paysafe.metadata.apple_pay]]
+name="certificate"
+label="Merchant Certificate (Base64 Encoded)"
+placeholder="Enter Merchant Certificate (Base64 Encoded)"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="certificate_keys"
+label="Merchant PrivateKey (Base64 Encoded)"
+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="merchant_identifier"
+label="Apple Merchant Identifier"
+placeholder="Enter Apple Merchant Identifier"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="display_name"
+label="Display Name"
+placeholder="Enter Display Name"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="initiative"
+label="Domain"
+placeholder="Enter Domain"
+required=true
+type="Select"
+options=["web","ios"]
+[[paysafe.metadata.apple_pay]]
+name="initiative_context"
+label="Domain Name"
+placeholder="Enter Domain Name"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="merchant_business_country"
+label="Merchant Business Country"
+placeholder="Enter Merchant Business Country"
+required=true
+type="Select"
+options=[]
+[[paysafe.metadata.apple_pay]]
+name="payment_processing_details_at"
+label="Payment Processing Details At"
+placeholder="Enter Payment Processing Details At"
+required=true
+type="Radio"
+options=["Connector","Hyperswitch"]
+
[peachpayments]
[[peachpayments.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 6068ad7f0c..66f84be371 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1322,7 +1322,7 @@ api_key="Celero API Key"
api_key = "Checkbook API Secret key"
[checkbook.connector_webhook_details]
merchant_secret="Source verification key"
-
+
[checkout]
[[checkout.credit]]
payment_method_type = "Mastercard"
@@ -5370,7 +5370,7 @@ type = "Text"
[[santander.voucher]]
payment_method_type = "boleto"
[[santander.bank_transfer]]
- payment_method_type = "pix"
+ payment_method_type = "pix"
[santander.connector_auth.BodyKey]
api_key = "Client ID"
key1 = "Client Secret"
@@ -5620,11 +5620,16 @@ payment_method_type = "interac"
payment_method_type = "skrill"
[[paysafe.gift_card]]
payment_method_type = "pay_safe_card"
+[[paysafe.wallet]]
+payment_method_type = "apple_pay"
+
[paysafe.connector_auth.BodyKey]
api_key = "Username"
key1 = "Password"
+
[paysafe.connector_webhook_details]
merchant_secret = "Source verification key"
+
[[paysafe.metadata.account_id.card.USD.three_ds]]
name="three_ds"
label="ThreeDS account id"
@@ -5692,6 +5697,71 @@ placeholder="Enter eur Account ID"
required=true
type="Text"
+[[paysafe.metadata.account_id.apple_pay.USD.encrypt]]
+name="encrypt"
+label="Encrypt"
+placeholder="Enter encrypt value"
+required=true
+type="Text"
+[[paysafe.metadata.account_id.apple_pay.USD.decrypt]]
+name="decrypt"
+label="Decrypt"
+placeholder="Enter decrypt value"
+required=true
+type="Text"
+
+[[paysafe.metadata.apple_pay]]
+name="certificate"
+label="Merchant Certificate (Base64 Encoded)"
+placeholder="Enter Merchant Certificate (Base64 Encoded)"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="certificate_keys"
+label="Merchant PrivateKey (Base64 Encoded)"
+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="merchant_identifier"
+label="Apple Merchant Identifier"
+placeholder="Enter Apple Merchant Identifier"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="display_name"
+label="Display Name"
+placeholder="Enter Display Name"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="initiative"
+label="Domain"
+placeholder="Enter Domain"
+required=true
+type="Select"
+options=["web","ios"]
+[[paysafe.metadata.apple_pay]]
+name="initiative_context"
+label="Domain Name"
+placeholder="Enter Domain Name"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="merchant_business_country"
+label="Merchant Business Country"
+placeholder="Enter Merchant Business Country"
+required=true
+type="Select"
+options=[]
+[[paysafe.metadata.apple_pay]]
+name="payment_processing_details_at"
+label="Payment Processing Details At"
+placeholder="Enter Payment Processing Details At"
+required=true
+type="Radio"
+options=["Connector","Hyperswitch"]
+
[peachpayments]
[[peachpayments.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 99ed75fa9c..c5790d9672 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -6628,7 +6628,7 @@ options = []
[[santander.voucher]]
payment_method_type = "boleto"
[[santander.bank_transfer]]
- payment_method_type = "pix"
+ payment_method_type = "pix"
[santander.connector_auth.BodyKey]
api_key = "Client ID"
@@ -6861,11 +6861,16 @@ payment_method_type = "interac"
payment_method_type = "skrill"
[[paysafe.gift_card]]
payment_method_type = "pay_safe_card"
+[[paysafe.wallet]]
+payment_method_type = "apple_pay"
+
[paysafe.connector_auth.BodyKey]
api_key = "Username"
key1 = "Password"
+
[paysafe.connector_webhook_details]
merchant_secret = "Source verification key"
+
[[paysafe.metadata.account_id.card.USD.three_ds]]
name="three_ds"
label="ThreeDS account id"
@@ -6933,7 +6938,70 @@ placeholder="Enter eur Account ID"
required=true
type="Text"
+[[paysafe.metadata.account_id.apple_pay.USD.encrypt]]
+name="encrypt"
+label="Encrypt"
+placeholder="Enter encrypt value"
+required=true
+type="Text"
+[[paysafe.metadata.account_id.apple_pay.USD.decrypt]]
+name="decrypt"
+label="Decrypt"
+placeholder="Enter decrypt value"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="certificate"
+label="Merchant Certificate (Base64 Encoded)"
+placeholder="Enter Merchant Certificate (Base64 Encoded)"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="certificate_keys"
+label="Merchant PrivateKey (Base64 Encoded)"
+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="merchant_identifier"
+label="Apple Merchant Identifier"
+placeholder="Enter Apple Merchant Identifier"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="display_name"
+label="Display Name"
+placeholder="Enter Display Name"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="initiative"
+label="Domain"
+placeholder="Enter Domain"
+required=true
+type="Select"
+options=["web","ios"]
+[[paysafe.metadata.apple_pay]]
+name="initiative_context"
+label="Domain Name"
+placeholder="Enter Domain Name"
+required=true
+type="Text"
+[[paysafe.metadata.apple_pay]]
+name="merchant_business_country"
+label="Merchant Business Country"
+placeholder="Enter Merchant Business Country"
+required=true
+type="Select"
+options=[]
+[[paysafe.metadata.apple_pay]]
+name="payment_processing_details_at"
+label="Payment Processing Details At"
+placeholder="Enter Payment Processing Details At"
+required=true
+type="Radio"
+options=["Connector","Hyperswitch"]
[peachpayments]
[[peachpayments.credit]]
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
index df996434c7..c59149f37f 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
@@ -342,6 +342,11 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
enums::PaymentMethod::Card if !req.is_three_ds() => {
Ok(format!("{}v1/payments", self.base_url(connectors)))
}
+ enums::PaymentMethod::Wallet
+ if req.request.payment_method_type == Some(enums::PaymentMethodType::ApplePay) =>
+ {
+ Ok(format!("{}v1/payments", self.base_url(connectors)))
+ }
_ => Ok(format!("{}v1/paymenthandles", self.base_url(connectors),)),
}
}
@@ -365,6 +370,13 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
+ enums::PaymentMethod::Wallet
+ if req.request.payment_method_type == Some(enums::PaymentMethodType::ApplePay) =>
+ {
+ let connector_req =
+ paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
_ => {
let connector_req =
paysafe::PaysafePaymentHandleRequest::try_from(&connector_router_data)?;
@@ -415,6 +427,21 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
http_code: res.status_code,
})
}
+ enums::PaymentMethod::Wallet
+ if data.request.payment_method_type == Some(enums::PaymentMethodType::ApplePay) =>
+ {
+ let response: paysafe::PaysafePaymentsResponse = res
+ .response
+ .parse_struct("Paysafe PaymentsAuthorizeResponse")
+ .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 {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
_ => {
let response: paysafe::PaysafePaymentHandleResponse = res
.response
@@ -1029,6 +1056,17 @@ static PAYSAFE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = La
},
);
+ paysafe_supported_payment_methods.add(
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::ApplePay,
+ PaymentMethodDetails {
+ mandates: enums::FeatureStatus::NotSupported,
+ refunds: enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
paysafe_supported_payment_methods.add(
enums::PaymentMethod::Wallet,
enums::PaymentMethodType::Skrill,
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
index 2ab16981cf..ccb74ec122 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
@@ -1,7 +1,9 @@
use std::collections::HashMap;
+use base64::Engine;
use cards::CardNumber;
use common_enums::{enums, Currency};
+use common_types::payments::{ApplePayPaymentData, ApplePayPredecryptData};
use common_utils::{
id_type,
pii::{Email, IpAddress, SecretSerdeValue},
@@ -10,8 +12,10 @@ use common_utils::{
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::{BankRedirectData, GiftCardData, PaymentMethodData, WalletData},
- router_data::{ConnectorAuthType, RouterData},
+ payment_method_data::{
+ ApplePayWalletData, BankRedirectData, GiftCardData, PaymentMethodData, WalletData,
+ },
+ router_data::{ConnectorAuthType, PaymentMethodToken, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::{
CompleteAuthorizeData, PaymentsAuthorizeData, PaymentsPreProcessingData, PaymentsSyncData,
@@ -30,8 +34,9 @@ use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
- self, to_connector_meta, BrowserInformationData, CardData, PaymentsAuthorizeRequestData,
- PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData, RouterData as _,
+ self, missing_field_err, to_connector_meta, BrowserInformationData, CardData,
+ PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData,
+ PaymentsPreProcessingRequestData, RouterData as _,
},
};
@@ -56,10 +61,11 @@ pub struct PaysafeConnectorMetadataObject {
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct PaysafePaymentMethodDetails {
+ pub apple_pay: Option<HashMap<Currency, ApplePayAccountDetails>>,
pub card: Option<HashMap<Currency, CardAccountId>>,
- pub skrill: Option<HashMap<Currency, RedirectAccountId>>,
pub interac: Option<HashMap<Currency, RedirectAccountId>>,
pub pay_safe_card: Option<HashMap<Currency, RedirectAccountId>>,
+ pub skrill: Option<HashMap<Currency, RedirectAccountId>>,
}
#[derive(Debug, Default, Serialize, Deserialize)]
@@ -68,6 +74,12 @@ pub struct CardAccountId {
three_ds: Option<Secret<String>>,
}
+#[derive(Debug, Default, Serialize, Deserialize)]
+pub struct ApplePayAccountDetails {
+ encrypt: Option<Secret<String>>,
+ decrypt: Option<Secret<String>>,
+}
+
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct RedirectAccountId {
three_ds: Option<Secret<String>>,
@@ -151,12 +163,13 @@ pub struct PaysafeProfile {
#[serde(rename_all = "camelCase")]
#[serde(untagged)]
pub enum PaysafePaymentMethod {
+ ApplePay {
+ #[serde(rename = "applePay")]
+ apple_pay: Box<PaysafeApplepayPayment>,
+ },
Card {
card: PaysafeCard,
},
- Skrill {
- skrill: SkrillWallet,
- },
Interac {
#[serde(rename = "interacEtransfer")]
interac_etransfer: InteracBankRedirect,
@@ -165,6 +178,119 @@ pub enum PaysafePaymentMethod {
#[serde(rename = "paysafecard")]
pay_safe_card: PaysafeGiftCard,
},
+ Skrill {
+ skrill: SkrillWallet,
+ },
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplepayPayment {
+ pub label: Option<String>,
+ pub request_billing_address: Option<bool>,
+ #[serde(rename = "applePayPaymentToken")]
+ pub apple_pay_payment_token: PaysafeApplePayPaymentToken,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayPaymentToken {
+ pub token: PaysafeApplePayToken,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub billing_contact: Option<PaysafeApplePayBillingContact>,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayToken {
+ pub payment_data: PaysafeApplePayPaymentData,
+ pub payment_method: PaysafeApplePayPaymentMethod,
+ pub transaction_identifier: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(untagged)]
+pub enum PaysafeApplePayPaymentData {
+ Encrypted(PaysafeApplePayEncryptedData),
+ Decrypted(PaysafeApplePayDecryptedDataWrapper),
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayEncryptedData {
+ pub data: Secret<String>,
+ pub signature: Secret<String>,
+ pub header: PaysafeApplePayHeader,
+ pub version: Secret<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayDecryptedDataWrapper {
+ pub decrypted_data: PaysafeApplePayDecryptedData,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayDecryptedData {
+ pub application_primary_account_number: CardNumber,
+ pub application_expiration_date: Secret<String>,
+ pub currency_code: String,
+ pub transaction_amount: Option<MinorUnit>,
+ pub cardholder_name: Option<Secret<String>>,
+ pub device_manufacturer_identifier: Option<String>,
+ pub payment_data_type: Option<String>,
+ pub payment_data: PaysafeApplePayDecryptedPaymentData,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayDecryptedPaymentData {
+ pub online_payment_cryptogram: Secret<String>,
+ pub eci_indicator: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayHeader {
+ pub public_key_hash: String,
+ pub ephemeral_public_key: String,
+ pub transaction_id: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayPaymentMethod {
+ pub display_name: Secret<String>,
+ pub network: Secret<String>,
+ #[serde(rename = "type")]
+ pub method_type: Secret<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaysafeApplePayBillingContact {
+ pub address_lines: Vec<Option<Secret<String>>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub administrative_area: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub country: Option<String>,
+ pub country_code: api_models::enums::CountryAlpha2,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub family_name: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub given_name: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub locality: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub phonetic_family_name: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub phonetic_given_name: Option<Secret<String>>,
+ pub postal_code: Secret<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub sub_administrative_area: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub sub_locality: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Clone, PartialEq)]
@@ -205,6 +331,7 @@ pub enum LinkType {
#[derive(Debug, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum PaysafePaymentType {
+ // For Apple Pay and Google Pay, paymentType is 'CARD' as per Paysafe docs and is not reserved for card payments only
Card,
Skrill,
InteracEtransfer,
@@ -218,6 +345,32 @@ pub enum TransactionType {
}
impl PaysafePaymentMethodDetails {
+ pub fn get_applepay_encrypt_account_id(
+ &self,
+ currency: Currency,
+ ) -> Result<Secret<String>, errors::ConnectorError> {
+ self.apple_pay
+ .as_ref()
+ .and_then(|apple_pay| apple_pay.get(&currency))
+ .and_then(|flow| flow.encrypt.clone())
+ .ok_or_else(|| errors::ConnectorError::InvalidConnectorConfig {
+ config: "Missing ApplePay encrypt account_id",
+ })
+ }
+
+ pub fn get_applepay_decrypt_account_id(
+ &self,
+ currency: Currency,
+ ) -> Result<Secret<String>, errors::ConnectorError> {
+ self.apple_pay
+ .as_ref()
+ .and_then(|apple_pay| apple_pay.get(&currency))
+ .and_then(|flow| flow.decrypt.clone())
+ .ok_or_else(|| errors::ConnectorError::InvalidConnectorConfig {
+ config: "Missing ApplePay decrypt account_id",
+ })
+ }
+
pub fn get_no_three_ds_account_id(
&self,
currency: Currency,
@@ -289,84 +442,149 @@ impl TryFrom<&PaysafeRouterData<&PaymentsPreProcessingRouterData>> for PaysafePa
fn try_from(
item: &PaysafeRouterData<&PaymentsPreProcessingRouterData>,
) -> Result<Self, Self::Error> {
- if item.router_data.is_three_ds() {
- Err(errors::ConnectorError::NotSupported {
- message: "Card 3DS".to_string(),
- connector: "Paysafe",
- })?
- };
let metadata: PaysafeConnectorMetadataObject =
utils::to_connector_meta_from_secret(item.router_data.connector_meta_data.clone())
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "merchant_connector_account.metadata",
})?;
- let currency = item.router_data.request.get_currency()?;
- match item.router_data.request.get_payment_method_data()?.clone() {
- PaymentMethodData::Card(req_card) => {
- let card = PaysafeCard {
- card_num: req_card.card_number.clone(),
- card_expiry: PaysafeCardExpiry {
- month: req_card.card_exp_month.clone(),
- year: req_card.get_expiry_year_4_digit(),
- },
- cvv: if req_card.card_cvc.clone().expose().is_empty() {
- None
- } else {
- Some(req_card.card_cvc.clone())
- },
- holder_name: item.router_data.get_optional_billing_full_name(),
- };
-
- let payment_method = PaysafePaymentMethod::Card { card: card.clone() };
- let account_id = metadata.account_id.get_no_three_ds_account_id(currency)?;
- let amount = item.amount;
- let payment_type = PaysafePaymentType::Card;
- let transaction_type = TransactionType::Payment;
- let redirect_url = item.router_data.request.get_router_return_url()?;
- let return_links = vec![
- ReturnLink {
- rel: LinkType::Default,
- href: redirect_url.clone(),
- method: Method::Get.to_string(),
- },
- ReturnLink {
- rel: LinkType::OnCompleted,
- href: redirect_url.clone(),
- method: Method::Get.to_string(),
- },
- ReturnLink {
- rel: LinkType::OnFailed,
- href: redirect_url.clone(),
- method: Method::Get.to_string(),
- },
- ReturnLink {
- rel: LinkType::OnCancelled,
- href: redirect_url.clone(),
- method: Method::Get.to_string(),
- },
- ];
-
- Ok(Self {
- merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
- amount,
- settle_with_auth: matches!(
- item.router_data.request.capture_method,
- Some(enums::CaptureMethod::Automatic) | None
- ),
- payment_method,
- currency_code: currency,
- payment_type,
- transaction_type,
- return_links,
- account_id,
- three_ds: None,
- profile: None,
- })
- }
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment Method".to_string(),
- ))?,
- }
+
+ let amount = item.amount;
+ let currency_code = item.router_data.request.get_currency()?;
+ let redirect_url = item.router_data.request.get_router_return_url()?;
+ let return_links = vec![
+ ReturnLink {
+ rel: LinkType::Default,
+ href: redirect_url.clone(),
+ method: Method::Get.to_string(),
+ },
+ ReturnLink {
+ rel: LinkType::OnCompleted,
+ href: redirect_url.clone(),
+ method: Method::Get.to_string(),
+ },
+ ReturnLink {
+ rel: LinkType::OnFailed,
+ href: redirect_url.clone(),
+ method: Method::Get.to_string(),
+ },
+ ReturnLink {
+ rel: LinkType::OnCancelled,
+ href: redirect_url.clone(),
+ method: Method::Get.to_string(),
+ },
+ ];
+ let settle_with_auth = matches!(
+ item.router_data.request.capture_method,
+ Some(enums::CaptureMethod::Automatic) | None
+ );
+ let transaction_type = TransactionType::Payment;
+
+ let (payment_method, payment_type, account_id) =
+ match item.router_data.request.get_payment_method_data()?.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = PaysafeCard {
+ card_num: req_card.card_number.clone(),
+ card_expiry: PaysafeCardExpiry {
+ month: req_card.card_exp_month.clone(),
+ year: req_card.get_expiry_year_4_digit(),
+ },
+ cvv: if req_card.card_cvc.clone().expose().is_empty() {
+ None
+ } else {
+ Some(req_card.card_cvc.clone())
+ },
+ holder_name: item.router_data.get_optional_billing_full_name(),
+ };
+
+ let payment_method = PaysafePaymentMethod::Card { card: card.clone() };
+ let payment_type = PaysafePaymentType::Card;
+ let account_id = metadata
+ .account_id
+ .get_no_three_ds_account_id(currency_code)?;
+ (payment_method, payment_type, account_id)
+ }
+ PaymentMethodData::Wallet(wallet_data) => match wallet_data {
+ WalletData::ApplePay(applepay_data) => {
+ let is_encrypted = matches!(
+ applepay_data.payment_data,
+ ApplePayPaymentData::Encrypted(_)
+ );
+
+ let account_id = if is_encrypted {
+ metadata
+ .account_id
+ .get_applepay_encrypt_account_id(currency_code)?
+ } else {
+ metadata
+ .account_id
+ .get_applepay_decrypt_account_id(currency_code)?
+ };
+
+ let applepay_payment =
+ PaysafeApplepayPayment::try_from((&applepay_data, item))?;
+
+ let payment_method = PaysafePaymentMethod::ApplePay {
+ apple_pay: Box::new(applepay_payment),
+ };
+
+ let payment_type = PaysafePaymentType::Card;
+
+ (payment_method, payment_type, account_id)
+ }
+ WalletData::AliPayQr(_)
+ | WalletData::AliPayRedirect(_)
+ | WalletData::AliPayHkRedirect(_)
+ | WalletData::AmazonPay(_)
+ | WalletData::AmazonPayRedirect(_)
+ | WalletData::Paysera(_)
+ | WalletData::Skrill(_)
+ | WalletData::BluecodeRedirect {}
+ | WalletData::MomoRedirect(_)
+ | WalletData::KakaoPayRedirect(_)
+ | WalletData::GoPayRedirect(_)
+ | WalletData::GcashRedirect(_)
+ | WalletData::ApplePayRedirect(_)
+ | WalletData::ApplePayThirdPartySdk(_)
+ | WalletData::DanaRedirect {}
+ | WalletData::GooglePayRedirect(_)
+ | WalletData::GooglePay(_)
+ | WalletData::GooglePayThirdPartySdk(_)
+ | WalletData::MbWayRedirect(_)
+ | WalletData::MobilePayRedirect(_)
+ | WalletData::PaypalSdk(_)
+ | WalletData::PaypalRedirect(_)
+ | WalletData::Paze(_)
+ | WalletData::SamsungPay(_)
+ | WalletData::TwintRedirect {}
+ | WalletData::VippsRedirect {}
+ | WalletData::TouchNGoRedirect(_)
+ | WalletData::WeChatPayRedirect(_)
+ | WalletData::CashappQr(_)
+ | WalletData::SwishQr(_)
+ | WalletData::WeChatPayQr(_)
+ | WalletData::RevolutPay(_)
+ | WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Paysafe"),
+ ))?,
+ },
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Payment Method".to_string(),
+ ))?,
+ };
+
+ Ok(Self {
+ merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
+ amount,
+ settle_with_auth,
+ payment_method,
+ currency_code,
+ payment_type,
+ transaction_type,
+ return_links,
+ account_id,
+ three_ds: None,
+ profile: None,
+ })
}
}
@@ -442,6 +660,7 @@ impl<F>
>,
) -> Result<Self, Self::Error> {
Ok(Self {
+ status: enums::AttemptStatus::try_from(item.response.status)?,
preprocessing_id: Some(
item.response
.payment_handle_token
@@ -517,15 +736,16 @@ impl<F>
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let url = match item.response.links.as_ref().and_then(|links| links.first()) {
- Some(link) => link.href.clone(),
- None => return Err(errors::ConnectorError::ResponseDeserializationFailed)?,
- };
- let redirection_data = Some(RedirectForm::Form {
- endpoint: url,
- method: Method::Get,
- form_fields: Default::default(),
- });
+ let redirection_data = item
+ .response
+ .links
+ .as_ref()
+ .and_then(|links| links.first())
+ .map(|link| RedirectForm::Form {
+ endpoint: link.href.clone(),
+ method: Method::Get,
+ form_fields: Default::default(),
+ });
let connector_metadata = serde_json::json!(PaysafeMeta {
payment_handle_token: item.response.payment_handle_token.clone(),
});
@@ -573,6 +793,159 @@ pub struct PaysafeCardExpiry {
pub year: Secret<String>,
}
+#[derive(Debug, Deserialize)]
+struct DecryptedApplePayTokenData {
+ data: Secret<String>,
+ signature: Secret<String>,
+ header: DecryptedApplePayTokenHeader,
+ version: Secret<String>,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct DecryptedApplePayTokenHeader {
+ public_key_hash: String,
+ ephemeral_public_key: String,
+ transaction_id: String,
+}
+
+fn get_apple_pay_decrypt_data(
+ apple_pay_predecrypt_data: &ApplePayPredecryptData,
+ item: &PaysafeRouterData<&PaymentsPreProcessingRouterData>,
+) -> Result<PaysafeApplePayDecryptedData, error_stack::Report<errors::ConnectorError>> {
+ Ok(PaysafeApplePayDecryptedData {
+ application_primary_account_number: apple_pay_predecrypt_data
+ .application_primary_account_number
+ .clone(),
+ application_expiration_date: apple_pay_predecrypt_data
+ .get_expiry_date_as_yymm()
+ .change_context(errors::ConnectorError::InvalidDataFormat {
+ field_name: "application_expiration_date",
+ })?,
+ currency_code: Currency::iso_4217(
+ item.router_data
+ .request
+ .currency
+ .ok_or_else(missing_field_err("currency"))?,
+ )
+ .to_string(),
+
+ transaction_amount: Some(item.amount),
+ cardholder_name: None,
+ device_manufacturer_identifier: Some("Apple".to_string()),
+ payment_data_type: Some("3DSecure".to_string()),
+ payment_data: PaysafeApplePayDecryptedPaymentData {
+ online_payment_cryptogram: apple_pay_predecrypt_data
+ .payment_data
+ .online_payment_cryptogram
+ .clone(),
+ eci_indicator: apple_pay_predecrypt_data
+ .payment_data
+ .eci_indicator
+ .clone()
+ .ok_or_else(missing_field_err(
+ "payment_method_data.wallet.apple_pay.payment_data.eci_indicator",
+ ))?,
+ },
+ })
+}
+
+impl
+ TryFrom<(
+ &ApplePayWalletData,
+ &PaysafeRouterData<&PaymentsPreProcessingRouterData>,
+ )> for PaysafeApplepayPayment
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (wallet_data, item): (
+ &ApplePayWalletData,
+ &PaysafeRouterData<&PaymentsPreProcessingRouterData>,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let apple_pay_payment_token = PaysafeApplePayPaymentToken {
+ token: PaysafeApplePayToken {
+ payment_data: if let Ok(PaymentMethodToken::ApplePayDecrypt(ref token)) =
+ item.router_data.get_payment_method_token()
+ {
+ PaysafeApplePayPaymentData::Decrypted(PaysafeApplePayDecryptedDataWrapper {
+ decrypted_data: get_apple_pay_decrypt_data(token, item)?,
+ })
+ } else {
+ match &wallet_data.payment_data {
+ ApplePayPaymentData::Decrypted(applepay_predecrypt_data) => {
+ PaysafeApplePayPaymentData::Decrypted(
+ PaysafeApplePayDecryptedDataWrapper {
+ decrypted_data: get_apple_pay_decrypt_data(
+ applepay_predecrypt_data,
+ item,
+ )?,
+ },
+ )
+ }
+ ApplePayPaymentData::Encrypted(applepay_encrypt_data) => {
+ let decoded_data = base64::prelude::BASE64_STANDARD
+ .decode(applepay_encrypt_data)
+ .change_context(errors::ConnectorError::InvalidDataFormat {
+ field_name: "apple_pay_encrypted_data",
+ })?;
+
+ let apple_pay_token: DecryptedApplePayTokenData =
+ serde_json::from_slice(&decoded_data).change_context(
+ errors::ConnectorError::InvalidDataFormat {
+ field_name: "apple_pay_token_json",
+ },
+ )?;
+
+ PaysafeApplePayPaymentData::Encrypted(PaysafeApplePayEncryptedData {
+ data: apple_pay_token.data,
+ signature: apple_pay_token.signature,
+ header: PaysafeApplePayHeader {
+ public_key_hash: apple_pay_token.header.public_key_hash,
+ ephemeral_public_key: apple_pay_token
+ .header
+ .ephemeral_public_key,
+ transaction_id: apple_pay_token.header.transaction_id,
+ },
+ version: apple_pay_token.version,
+ })
+ }
+ }
+ },
+ payment_method: PaysafeApplePayPaymentMethod {
+ display_name: Secret::new(wallet_data.payment_method.display_name.clone()),
+ network: Secret::new(wallet_data.payment_method.network.clone()),
+ method_type: Secret::new(wallet_data.payment_method.pm_type.clone()),
+ },
+ transaction_identifier: wallet_data.transaction_identifier.clone(),
+ },
+ billing_contact: Some(PaysafeApplePayBillingContact {
+ address_lines: vec![
+ item.router_data.get_optional_billing_line1(),
+ item.router_data.get_optional_billing_line2(),
+ ],
+ postal_code: item.router_data.get_billing_zip()?,
+ country_code: item.router_data.get_billing_country()?,
+ country: None,
+ family_name: None,
+ given_name: None,
+ locality: None,
+ phonetic_family_name: None,
+ phonetic_given_name: None,
+ sub_administrative_area: None,
+ administrative_area: None,
+ sub_locality: None,
+ }),
+ };
+
+ Ok(Self {
+ label: None,
+ request_billing_address: Some(false),
+ apple_pay_payment_token,
+ })
+ }
+}
+
impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
index bfb3e36b29..eccd9b02b3 100644
--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs
+++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs
@@ -2393,6 +2393,17 @@ fn get_wallet_required_fields() -> HashMap<enums::PaymentMethodType, ConnectorFi
Connector::Novalnet,
fields(vec![], vec![], vec![RequiredField::BillingEmail]),
),
+ (
+ Connector::Paysafe,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from([
+ RequiredField::BillingAddressZip.to_tuple(),
+ RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
+ ]),
+ },
+ ),
(
Connector::Wellsfargo,
RequiredFieldFinal {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index d7eed1a89b..d960c23138 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -6568,6 +6568,12 @@ where
router_data.preprocessing_steps(state, connector).await?,
false,
)
+ } else if connector.connector_name == router_types::Connector::Paysafe {
+ router_data = router_data.preprocessing_steps(state, connector).await?;
+
+ let is_error_in_response = router_data.response.is_err();
+ // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
+ (router_data, !is_error_in_response)
} else {
(router_data, should_continue_payment)
}
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 19e4d3cbd9..139fd801c3 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -681,6 +681,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.paysafe]
+apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+
#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" } }