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): [Worldpayxml] add card payment (#8076)

AkshayaFoigerb8b68af4f86e
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index f3e9eeb56c..ccf8adc945 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8156,6 +8156,7 @@
"wise",
"worldline",
"worldpay",
+ "worldpayxml",
"signifyd",
"plaid",
"riskified",
@@ -21790,6 +21791,7 @@
"wise",
"worldline",
"worldpay",
+ "worldpayxml",
"xendit",
"zen",
"plaid",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index c192ef38b7..203b462881 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -10019,6 +10019,7 @@
"wise",
"worldline",
"worldpay",
+ "worldpayxml",
"signifyd",
"plaid",
"riskified",
@@ -26043,6 +26044,7 @@
"wise",
"worldline",
"worldpay",
+ "worldpayxml",
"xendit",
"zen",
"plaid",
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 16b2d42431..1eaa85131c 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -557,6 +557,10 @@ credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,K
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,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HS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+
[pm_filters.zen]
boleto = { country = "BR", currency = "BRL" }
efecty = { country = "CO", currency = "COP" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 63cb675467..bef4e00e9e 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -572,6 +572,11 @@ credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,K
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", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ET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PW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+
+
[pm_filters.zen]
boleto = { country = "BR", currency = "BRL" }
efecty = { country = "CO", currency = "COP" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index f13435cbc5..b24cd63b6f 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -580,6 +580,10 @@ credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,K
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", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL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TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+
[pm_filters.zen]
boleto = { country = "BR", currency = "BRL" }
efecty = { country = "CO", currency = "COP" }
diff --git a/config/development.toml b/config/development.toml
index 73822068c7..dba50fc889 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -750,6 +750,10 @@ credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,K
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", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP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,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+
[file_upload_config]
bucket_name = ""
region = ""
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 8fd9a5ed50..5878c397b4 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -701,6 +701,10 @@ credit = { country = "AF,DZ,AW,AU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ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }
+
[pm_filters.fiuu]
duit_now = { country = "MY", currency = "MYR" }
apple_pay = { country = "MY", currency = "MYR" }
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index d40ac929e5..1bc1403511 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -151,7 +151,7 @@ pub enum RoutableConnectors {
Wise,
Worldline,
Worldpay,
- // Worldpayxml,
+ Worldpayxml,
Xendit,
Zen,
Plaid,
@@ -307,7 +307,7 @@ pub enum Connector {
Wise,
Worldline,
Worldpay,
- // Worldpayxml,
+ Worldpayxml,
Signifyd,
Plaid,
Riskified,
@@ -469,7 +469,7 @@ impl Connector {
| Self::Wise
| Self::Worldline
| Self::Worldpay
- // | Self::Worldpayxml
+ | Self::Worldpayxml
| Self::Xendit
| Self::Zen
| Self::Zsl
@@ -624,7 +624,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Wise => Self::Wise,
RoutableConnectors::Worldline => Self::Worldline,
RoutableConnectors::Worldpay => Self::Worldpay,
- // RoutableConnectors::Worldpayxml => Self::Worldpayxml,
+ RoutableConnectors::Worldpayxml => Self::Worldpayxml,
RoutableConnectors::Zen => Self::Zen,
RoutableConnectors::Plaid => Self::Plaid,
RoutableConnectors::Zsl => Self::Zsl,
@@ -737,7 +737,7 @@ impl TryFrom<Connector> for RoutableConnectors {
Connector::Wise => Ok(Self::Wise),
Connector::Worldline => Ok(Self::Worldline),
Connector::Worldpay => Ok(Self::Worldpay),
- // Connector::Worldpayxml => Ok(Self::Worldpayxml),
+ Connector::Worldpayxml => Ok(Self::Worldpayxml),
Connector::Xendit => Ok(Self::Xendit),
Connector::Zen => Ok(Self::Zen),
Connector::Plaid => Ok(Self::Plaid),
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 5c0a7755b5..4b42aa78a1 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -263,7 +263,7 @@ pub struct ConnectorConfig {
pub wise_payout: Option<ConnectorTomlConfig>,
pub worldline: Option<ConnectorTomlConfig>,
pub worldpay: Option<ConnectorTomlConfig>,
- // pub worldpayxml: Option<ConnectorTomlConfig>,
+ pub worldpayxml: Option<ConnectorTomlConfig>,
pub xendit: Option<ConnectorTomlConfig>,
pub square: Option<ConnectorTomlConfig>,
pub stax: Option<ConnectorTomlConfig>,
@@ -442,7 +442,7 @@ impl ConnectorConfig {
Connector::Wise => Err("Use get_payout_connector_config".to_string()),
Connector::Worldline => Ok(connector_data.worldline),
Connector::Worldpay => Ok(connector_data.worldpay),
- // Connector::Worldpayxml => Ok(connector_data.worldpayxml),
+ Connector::Worldpayxml => Ok(connector_data.worldpayxml),
Connector::Zen => Ok(connector_data.zen),
Connector::Zsl => Ok(connector_data.zsl),
#[cfg(feature = "dummy_connector")]
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 55d469c463..a393c9f6b9 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -5819,6 +5819,7 @@ api_secret="Secret Key"
api_key="Password"
key1="Username"
+
[archipel]
[archipel.connector_auth.HeaderKey]
api_key="Enter CA Certificate PEM"
@@ -5924,3 +5925,48 @@ label = "Acquirer Merchant ID"
placeholder = "Enter Acquirer Merchant ID"
required = false
type = "Text"
+
+
+
+[worldpayxml]
+[[worldpayxml.credit]]
+ payment_method_type = "Mastercard"
+[[worldpayxml.credit]]
+ payment_method_type = "Visa"
+[[worldpayxml.credit]]
+ payment_method_type = "Interac"
+[[worldpayxml.credit]]
+ payment_method_type = "AmericanExpress"
+[[worldpayxml.credit]]
+ payment_method_type = "JCB"
+[[worldpayxml.credit]]
+ payment_method_type = "DinersClub"
+[[worldpayxml.credit]]
+ payment_method_type = "Discover"
+[[worldpayxml.credit]]
+ payment_method_type = "CartesBancaires"
+[[worldpayxml.credit]]
+ payment_method_type = "UnionPay"
+[[worldpayxml.debit]]
+ payment_method_type = "Mastercard"
+[[worldpayxml.debit]]
+ payment_method_type = "Visa"
+[[worldpayxml.debit]]
+ payment_method_type = "Interac"
+[[worldpayxml.debit]]
+ payment_method_type = "AmericanExpress"
+[[worldpayxml.debit]]
+ payment_method_type = "JCB"
+[[worldpayxml.debit]]
+ payment_method_type = "DinersClub"
+[[worldpayxml.debit]]
+ payment_method_type = "Discover"
+[[worldpayxml.debit]]
+ payment_method_type = "CartesBancaires"
+[[worldpayxml.debit]]
+ payment_method_type = "UnionPay"
+
+[worldpayxml.connector_auth.SignatureKey]
+api_secret="Merchant Code"
+api_key="API Username"
+key1="API Password"
\ No newline at end of file
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 4d4456cf71..82070794c7 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -4502,3 +4502,47 @@ label = "Acquirer Merchant ID"
placeholder = "Enter Acquirer Merchant ID"
required = false
type = "Text"
+
+
+[worldpayxml]
+[[worldpayxml.credit]]
+ payment_method_type = "Mastercard"
+[[worldpayxml.credit]]
+ payment_method_type = "Visa"
+[[worldpayxml.credit]]
+ payment_method_type = "Interac"
+[[worldpayxml.credit]]
+ payment_method_type = "AmericanExpress"
+[[worldpayxml.credit]]
+ payment_method_type = "JCB"
+[[worldpayxml.credit]]
+ payment_method_type = "DinersClub"
+[[worldpayxml.credit]]
+ payment_method_type = "Discover"
+[[worldpayxml.credit]]
+ payment_method_type = "CartesBancaires"
+[[worldpayxml.credit]]
+ payment_method_type = "UnionPay"
+[[worldpayxml.debit]]
+ payment_method_type = "Mastercard"
+[[worldpayxml.debit]]
+ payment_method_type = "Visa"
+[[worldpayxml.debit]]
+ payment_method_type = "Interac"
+[[worldpayxml.debit]]
+ payment_method_type = "AmericanExpress"
+[[worldpayxml.debit]]
+ payment_method_type = "JCB"
+[[worldpayxml.debit]]
+ payment_method_type = "DinersClub"
+[[worldpayxml.debit]]
+ payment_method_type = "Discover"
+[[worldpayxml.debit]]
+ payment_method_type = "CartesBancaires"
+[[worldpayxml.debit]]
+ payment_method_type = "UnionPay"
+
+[worldpayxml.connector_auth.SignatureKey]
+api_secret="Merchant Code"
+api_key="API Username"
+key1="API Password"
\ No newline at end of file
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 28227a7255..5883386d21 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -5899,3 +5899,47 @@ label = "Acquirer Merchant ID"
placeholder = "Enter Acquirer Merchant ID"
required = false
type = "Text"
+
+
+[worldpayxml]
+[[worldpayxml.credit]]
+ payment_method_type = "Mastercard"
+[[worldpayxml.credit]]
+ payment_method_type = "Visa"
+[[worldpayxml.credit]]
+ payment_method_type = "Interac"
+[[worldpayxml.credit]]
+ payment_method_type = "AmericanExpress"
+[[worldpayxml.credit]]
+ payment_method_type = "JCB"
+[[worldpayxml.credit]]
+ payment_method_type = "DinersClub"
+[[worldpayxml.credit]]
+ payment_method_type = "Discover"
+[[worldpayxml.credit]]
+ payment_method_type = "CartesBancaires"
+[[worldpayxml.credit]]
+ payment_method_type = "UnionPay"
+[[worldpayxml.debit]]
+ payment_method_type = "Mastercard"
+[[worldpayxml.debit]]
+ payment_method_type = "Visa"
+[[worldpayxml.debit]]
+ payment_method_type = "Interac"
+[[worldpayxml.debit]]
+ payment_method_type = "AmericanExpress"
+[[worldpayxml.debit]]
+ payment_method_type = "JCB"
+[[worldpayxml.debit]]
+ payment_method_type = "DinersClub"
+[[worldpayxml.debit]]
+ payment_method_type = "Discover"
+[[worldpayxml.debit]]
+ payment_method_type = "CartesBancaires"
+[[worldpayxml.debit]]
+ payment_method_type = "UnionPay"
+
+[worldpayxml.connector_auth.SignatureKey]
+api_secret="Merchant Code"
+api_key="API Username"
+key1="API Password"
\ No newline at end of file
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
index 6cb73f2735..8740fc8942 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
@@ -1,13 +1,16 @@
pub mod transformers;
+use std::sync::LazyLock;
+
+use base64::Engine;
use common_utils::{
errors::CustomResult,
- ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
@@ -19,10 +22,13 @@ use hyperswitch_domain_models::{
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
- router_response_types::{PaymentsResponseData, RefundsResponseData},
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
types::{
- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
- RefundSyncRouterData, RefundsRouterData,
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
@@ -31,7 +37,7 @@ use hyperswitch_interfaces::{
ConnectorValidation,
},
configs::Connectors,
- errors,
+ consts, errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
@@ -84,7 +90,7 @@ where
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
- self.get_content_type().to_string().into(),
+ self.common_get_content_type().to_string().into(),
)];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
@@ -102,7 +108,7 @@ impl ConnectorCommon for Worldpayxml {
}
fn common_get_content_type(&self) -> &'static str {
- "application/json"
+ "text/xml"
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
@@ -115,9 +121,19 @@ impl ConnectorCommon for Worldpayxml {
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = worldpayxml::WorldpayxmlAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let basic_auth_value = format!(
+ "Basic {}",
+ common_utils::consts::BASE64_ENGINE.encode(format!(
+ "{}:{}",
+ auth.api_username.expose(),
+ auth.api_password.expose()
+ ))
+ );
+
Ok(vec![(
headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
+ Mask::into_masked(basic_auth_value),
)])
}
@@ -126,30 +142,59 @@ impl ConnectorCommon for Worldpayxml {
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: worldpayxml::WorldpayxmlErrorResponse = res
- .response
- .parse_struct("WorldpayxmlErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- event_builder.map(|i| i.set_response_body(&response));
- router_env::logger::info!(connector_response=?response);
-
- Ok(ErrorResponse {
- status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
- attempt_status: None,
- connector_transaction_id: None,
- network_advice_code: None,
- network_decline_code: None,
- network_error_message: None,
- })
+ let response: Result<worldpayxml::PaymentService, _> =
+ utils::deserialize_xml_to_struct(&res.response);
+
+ match response {
+ Ok(response_data) => {
+ event_builder.map(|i| i.set_error_response_body(&response_data));
+ router_env::logger::info!(connector_response=?response_data);
+ let (error_code, error_msg) = response_data
+ .reply
+ .as_ref()
+ .and_then(|reply| {
+ reply
+ .error
+ .as_ref()
+ .map(|error| (Some(error.code.clone()), Some(error.message.clone())))
+ })
+ .unwrap_or((None, None));
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: error_code.unwrap_or(consts::NO_ERROR_CODE.to_string()),
+ message: error_msg
+ .clone()
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ reason: error_msg.clone(),
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ })
+ }
+ Err(error_msg) => {
+ event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));
+ router_env::logger::error!(deserialization_error =? error_msg);
+ utils::handle_json_response_deserialization_failure(res, "worldpayxml")
+ }
+ }
}
}
impl ConnectorValidation for Worldpayxml {
- //TODO: implement functions when support enabled
+ fn validate_mandate_payment(
+ &self,
+ _pm_type: Option<common_enums::PaymentMethodType>,
+ _pm_data: PaymentMethodData,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "mandate payment".to_string(),
+ connector: "worldpayxml",
+ }
+ .into())
+ }
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Worldpayxml {
@@ -161,6 +206,17 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
for Worldpayxml
{
+ // Not Implemented (R)
+ fn build_request(
+ &self,
+ _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented(
+ "Setup Mandate flow for Worldpayxml".to_string(),
+ )
+ .into())
+ }
}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Worldpayxml {
@@ -179,9 +235,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(self.base_url(connectors).to_owned())
}
fn get_request_body(
@@ -196,9 +252,16 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
)?;
let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((amount, req));
- let connector_req =
- worldpayxml::WorldpayxmlPaymentsRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Json(Box::new(connector_req)))
+ let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
+
+ let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
+ &connector_req_object,
+ worldpayxml::worldpayxml_constants::XML_VERSION,
+ Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
+ None,
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE,
+ )?;
+ Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
@@ -229,10 +292,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: worldpayxml::WorldpayxmlPaymentsResponse = res
- .response
- .parse_struct("Worldpayxml PaymentsAuthorizeResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response: worldpayxml::PaymentService =
+ utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -267,9 +328,25 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
fn get_url(
&self,
_req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(self.base_url(connectors).to_owned())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
+ let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
+ &connector_req_object,
+ worldpayxml::worldpayxml_constants::XML_VERSION,
+ Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
+ None,
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE,
+ )?;
+ Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
@@ -279,10 +356,13 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Get)
+ .method(Method::Post)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::PaymentsSyncType::get_request_body(
+ self, req, connectors,
+ )?)
.build(),
))
}
@@ -293,10 +373,8 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: worldpayxml::WorldpayxmlPaymentsResponse = res
- .response
- .parse_struct("worldpayxml PaymentsSyncResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response: worldpayxml::PaymentService =
+ utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -331,17 +409,32 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
fn get_url(
&self,
_req: &PaymentsCaptureRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(self.base_url(connectors).to_owned())
}
fn get_request_body(
&self,
- _req: &PaymentsCaptureRouterData,
+ req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount_to_capture,
+ req.request.currency,
+ )?;
+ let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((amount, req));
+ let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
+
+ let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
+ &connector_req_object,
+ worldpayxml::worldpayxml_constants::XML_VERSION,
+ Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
+ None,
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE,
+ )?;
+ Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
@@ -370,10 +463,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
- let response: worldpayxml::WorldpayxmlPaymentsResponse = res
- .response
- .parse_struct("Worldpayxml PaymentsCaptureResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response: worldpayxml::PaymentService =
+ utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -392,7 +483,85 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
}
}
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Worldpayxml {}
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Worldpayxml {
+ fn get_headers(
+ &self,
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(self.base_url(connectors).to_owned())
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsCancelRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
+
+ let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
+ &connector_req_object,
+ worldpayxml::worldpayxml_constants::XML_VERSION,
+ Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
+ None,
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE,
+ )?;
+ Ok(RequestContent::RawBytes(connector_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCancelRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+ let response: worldpayxml::PaymentService =
+ utils::deserialize_xml_to_struct(&res.response)?;
+ 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,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpayxml {
fn get_headers(
@@ -410,9 +579,9 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpa
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(self.base_url(connectors).to_owned())
}
fn get_request_body(
@@ -427,9 +596,15 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpa
)?;
let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((refund_amount, req));
- let connector_req =
- worldpayxml::WorldpayxmlRefundRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Json(Box::new(connector_req)))
+ let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
+ let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
+ &connector_req_object,
+ worldpayxml::worldpayxml_constants::XML_VERSION,
+ Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
+ None,
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE,
+ )?;
+ Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
@@ -457,10 +632,8 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpa
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
- let response: worldpayxml::RefundResponse = res
- .response
- .parse_struct("worldpayxml RefundResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response: worldpayxml::PaymentService =
+ utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -495,9 +668,26 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayx
fn get_url(
&self,
_req: &RefundSyncRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(self.base_url(connectors).to_owned())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
+
+ let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
+ &connector_req_object,
+ worldpayxml::worldpayxml_constants::XML_VERSION,
+ Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
+ None,
+ worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE,
+ )?;
+ Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
@@ -507,7 +697,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayx
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Get)
+ .method(Method::Post)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
@@ -524,10 +714,8 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayx
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
- let response: worldpayxml::RefundResponse = res
- .response
- .parse_struct("worldpayxml RefundSyncResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let response: worldpayxml::PaymentService =
+ utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -570,4 +758,84 @@ impl webhooks::IncomingWebhook for Worldpayxml {
}
}
-impl ConnectorSpecifications for Worldpayxml {}
+static WORLDPAYXML_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ common_enums::CaptureMethod::Automatic,
+ common_enums::CaptureMethod::Manual,
+ common_enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::AmericanExpress,
+ common_enums::CardNetwork::CartesBancaires,
+ common_enums::CardNetwork::DinersClub,
+ common_enums::CardNetwork::JCB,
+ common_enums::CardNetwork::Maestro,
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ ];
+
+ let mut worldpayxml_supported_payment_methods = SupportedPaymentMethods::new();
+
+ worldpayxml_supported_payment_methods.add(
+ common_enums::PaymentMethod::Card,
+ common_enums::PaymentMethodType::Credit,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+
+ worldpayxml_supported_payment_methods.add(
+ common_enums::PaymentMethod::Card,
+ common_enums::PaymentMethodType::Debit,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: Some(
+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
+ api_models::feature_matrix::CardSpecificFeatures {
+ three_ds: common_enums::FeatureStatus::NotSupported,
+ no_three_ds: common_enums::FeatureStatus::Supported,
+ supported_card_networks: supported_card_network.clone(),
+ }
+ }),
+ ),
+ },
+ );
+ worldpayxml_supported_payment_methods
+ });
+
+static WORLDPAYXML_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Worldpay XML",
+ description: "Worldpay is a payment gateway and PSP enabling secure online transactions",
+ connector_type: common_enums::PaymentConnectorCategory::PaymentGateway,
+};
+
+static WORLDPAYXML_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Worldpayxml {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&WORLDPAYXML_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*WORLDPAYXML_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::EventClass]> {
+ Some(&WORLDPAYXML_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
index 8063db0478..0e02cc5931 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
@@ -1,31 +1,39 @@
use common_enums::enums;
use common_utils::types::StringMinorUnit;
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
- payment_method_data::PaymentMethodData,
- router_data::{ConnectorAuthType, RouterData},
+ payment_method_data::{Card, PaymentMethodData},
+ router_data::{ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::refunds::{Execute, RSync},
- router_request_types::ResponseId,
+ router_request_types::{
+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData,
+ ResponseId,
+ },
router_response_types::{PaymentsResponseData, RefundsResponseData},
- types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+ },
};
-use hyperswitch_interfaces::errors;
+use hyperswitch_interfaces::{consts, errors};
use masking::Secret;
use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
- utils::PaymentsAuthorizeRequestData,
+ utils::{
+ self as connector_utils, CardData, PaymentsAuthorizeRequestData, PaymentsSyncRequestData,
+ RouterData as _,
+ },
};
-//TODO: Fill the struct with respective fields
pub struct WorldpayxmlRouterData<T> {
- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: StringMinorUnit,
pub router_data: T,
}
impl<T> From<(StringMinorUnit, T)> for WorldpayxmlRouterData<T> {
fn from((amount, item): (StringMinorUnit, T)) -> Self {
- //Todo : use utils to convert the amount to the type of amount that a connector accepts
Self {
amount,
router_data: item,
@@ -33,65 +41,544 @@ impl<T> From<(StringMinorUnit, T)> for WorldpayxmlRouterData<T> {
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, PartialEq)]
-pub struct WorldpayxmlPaymentsRequest {
- amount: StringMinorUnit,
- card: WorldpayxmlCard,
+pub mod worldpayxml_constants {
+ pub const WORLDPAYXML_VERSION: &str = "1.4";
+ pub const XML_VERSION: &str = "1.0";
+ pub const XML_ENCODING: &str = "UTF-8";
+ pub const WORLDPAYXML_DOC_TYPE: &str = r#"paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd""#;
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename = "paymentService")]
+pub struct PaymentService {
+ #[serde(rename = "@version")]
+ version: String,
+ #[serde(rename = "@merchantCode")]
+ merchant_code: Secret<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ submit: Option<Submit>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub reply: Option<Reply>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ inquiry: Option<Inquiry>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ modify: Option<Modify>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct Modify {
+ order_modification: OrderModification,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct OrderModification {
+ #[serde(rename = "@orderCode")]
+ order_code: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ capture: Option<CaptureRequest>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ cancel: Option<CancelRequest>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ refund: Option<RefundRequest>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+struct RefundRequest {
+ amount: WorldpayXmlAmount,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+struct CancelRequest {}
+
+#[derive(Debug, Serialize, Deserialize)]
+struct CaptureRequest {
+ amount: WorldpayXmlAmount,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct Inquiry {
+ order_inquiry: OrderInquiry,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+struct OrderInquiry {
+ #[serde(rename = "@orderCode")]
+ order_code: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+struct Submit {
+ order: Order,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Reply {
+ order_status: Option<OrderStatus>,
+ pub error: Option<WorldpayXmlErrorResponse>,
+ ok: Option<OkResponse>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct OkResponse {
+ capture_received: Option<ModifyRequestReceived>,
+ cancel_received: Option<ModifyRequestReceived>,
+ refund_received: Option<ModifyRequestReceived>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct ModifyRequestReceived {
+ #[serde(rename = "@orderCode")]
+ order_code: String,
+ amount: Option<WorldpayXmlAmount>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+pub struct WorldpayXmlErrorResponse {
+ #[serde(rename = "@code")]
+ pub code: String,
+ #[serde(rename = "$value")]
+ pub message: String,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct OrderStatus {
+ #[serde(rename = "@orderCode")]
+ order_code: String,
+ payment: Option<Payment>,
+ error: Option<WorldpayXmlErrorResponse>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct Payment {
+ payment_method: String,
+ amount: WorldpayXmlAmount,
+ last_event: LastEvent,
+ #[serde(rename = "AuthorisationId")]
+ authorisation_id: Option<AuthorisationId>,
+ scheme_response: Option<SchemeResponse>,
+ payment_method_detail: Option<PaymentMethodDetail>,
+ #[serde(rename = "CVCResultCode")]
+ cvc_result_code: Option<ResultCode>,
+ #[serde(rename = "AVSResultCode")]
+ avs_result_code: Option<ResultCode>,
+ #[serde(rename = "AAVAddressResultCode")]
+ aav_address_result_code: Option<ResultCode>,
+ #[serde(rename = "AAVPostcodeResultCode")]
+ aav_postcode_result_code: Option<ResultCode>,
+ #[serde(rename = "AAVCardholderNameResultCode")]
+ aav_cardholder_name_result_code: Option<ResultCode>,
+ #[serde(rename = "AAVTelephoneResultCode")]
+ aav_telephone_result_code: Option<ResultCode>,
+ #[serde(rename = "AAVEmailResultCode")]
+ aav_email_result_code: Option<ResultCode>,
+ issuer_country_code: Option<String>,
+ issuer_name: Option<String>,
+ balance: Option<Vec<Balance>>,
+ card_holder_name: Option<String>,
+ #[serde(rename = "ISO8583ReturnCode")]
+ return_code: Option<ReturnCode>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct ReturnCode {
+ #[serde(rename = "@description")]
+ description: String,
+ #[serde(rename = "@code")]
+ code: String,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct ResultCode {
+ #[serde(rename = "@description")]
+ description: String,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct Balance {
+ #[serde(rename = "@accountType")]
+ account_type: String,
+ amount: WorldpayXmlAmount,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct PaymentMethodDetail {
+ card: CardResponse,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct CardResponse {
+ #[serde(rename = "@number")]
+ number: Option<Secret<String>>,
+ #[serde(rename = "@type")]
+ card_type: String,
+ expiry_date: Option<ExpiryDate>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct AuthorisationId {
+ #[serde(rename = "@id")]
+ id: Secret<String>,
+}
+
+#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+enum LastEvent {
+ Authorised,
+ Refused,
+ Cancelled,
+ Captured,
+ Settled,
+ SentForAuthorisation,
+ SentForRefund,
+ Refunded,
+ RefundRequested,
+ RefundFailed,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct SchemeResponse {
+ transaction_identifier: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct Order {
+ #[serde(rename = "@orderCode")]
+ order_code: String,
+ #[serde(rename = "@captureDelay")]
+ capture_delay: AutoCapture,
+ description: String,
+ amount: WorldpayXmlAmount,
+ payment_details: PaymentDetails,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+enum AutoCapture {
+ Off,
+ #[serde(rename = "0")]
+ On,
}
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct WorldpayxmlCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct WorldpayXmlAmount {
+ #[serde(rename = "@value")]
+ value: StringMinorUnit,
+ #[serde(rename = "@currencyCode")]
+ currency_code: api_models::enums::Currency,
+ #[serde(rename = "@exponent")]
+ exponent: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+struct PaymentDetails {
+ #[serde(rename = "CARD-SSL")]
+ card_ssl: CardSSL,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct CardSSL {
+ card_number: cards::CardNumber,
+ expiry_date: ExpiryDate,
+ card_holder_name: Option<Secret<String>>,
cvc: Secret<String>,
- complete: bool,
}
-impl TryFrom<&WorldpayxmlRouterData<&PaymentsAuthorizeRouterData>> for WorldpayxmlPaymentsRequest {
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename = "expiryDate")]
+struct ExpiryDate {
+ date: Date,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct Date {
+ #[serde(rename = "@month")]
+ month: Secret<String>,
+ #[serde(rename = "@year")]
+ year: Secret<String>,
+}
+
+impl TryFrom<&Card> for PaymentDetails {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(card_data: &Card) -> Result<Self, Self::Error> {
+ Ok(Self {
+ card_ssl: CardSSL {
+ card_number: card_data.card_number.clone(),
+ expiry_date: ExpiryDate {
+ date: Date {
+ month: card_data.get_card_expiry_month_2_digit()?,
+ year: card_data.get_expiry_year_4_digit(),
+ },
+ },
+ card_holder_name: card_data.card_holder_name.to_owned(),
+ cvc: card_data.card_cvc.to_owned(),
+ },
+ })
+ }
+}
+
+impl TryFrom<(&WorldpayxmlRouterData<&PaymentsAuthorizeRouterData>, &Card)> for PaymentService {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: (&WorldpayxmlRouterData<&PaymentsAuthorizeRouterData>, &Card),
+ ) -> Result<Self, Self::Error> {
+ let authorize_data = item.0;
+ let card_data = item.1;
+ let auth = WorldpayxmlAuthType::try_from(&authorize_data.router_data.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let order_code = authorize_data
+ .router_data
+ .connector_request_reference_id
+ .to_owned();
+ let capture_delay = if authorize_data.router_data.request.is_auto_capture()? {
+ AutoCapture::On
+ } else {
+ AutoCapture::Off
+ };
+ let description = authorize_data.router_data.description.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "description",
+ },
+ )?;
+ let exponent = authorize_data
+ .router_data
+ .request
+ .currency
+ .number_of_digits_after_decimal_point()
+ .to_string();
+ let amount = WorldpayXmlAmount {
+ currency_code: authorize_data.router_data.request.currency.to_owned(),
+ exponent,
+ value: authorize_data.amount.to_owned(),
+ };
+ let payment_details = PaymentDetails::try_from(card_data)?;
+ let submit = Some(Submit {
+ order: Order {
+ order_code,
+ capture_delay,
+ description,
+ amount,
+ payment_details,
+ },
+ });
+
+ Ok(Self {
+ version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(),
+ merchant_code: auth.merchant_code.clone(),
+ submit,
+ reply: None,
+ inquiry: None,
+ modify: None,
+ })
+ }
+}
+
+impl TryFrom<&WorldpayxmlRouterData<&PaymentsAuthorizeRouterData>> for PaymentService {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &WorldpayxmlRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
+ if item.router_data.is_three_ds() {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Card 3DS".to_string(),
+ connector: "Worldpayxml",
+ })?
+ };
match item.router_data.request.payment_method_data.clone() {
- PaymentMethodData::Card(req_card) => {
- let card = WorldpayxmlCard {
- number: req_card.card_number,
- expiry_month: req_card.card_exp_month,
- expiry_year: req_card.card_exp_year,
- cvc: req_card.card_cvc,
- complete: item.router_data.request.is_auto_capture()?,
- };
- Ok(Self {
- amount: item.amount.clone(),
- card,
- })
- }
- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ PaymentMethodData::Card(req_card) => Self::try_from((item, &req_card)),
+ _ => Err(errors::ConnectorError::NotImplemented(
+ connector_utils::get_unimplemented_payment_method_error_message("Worldpayxml"),
+ ))?,
+ }
+ }
+}
+
+impl TryFrom<&WorldpayxmlRouterData<&PaymentsCaptureRouterData>> for PaymentService {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &WorldpayxmlRouterData<&PaymentsCaptureRouterData>,
+ ) -> Result<Self, Self::Error> {
+ let auth = WorldpayxmlAuthType::try_from(&item.router_data.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let modify = Some(Modify {
+ order_modification: OrderModification {
+ order_code: item.router_data.request.connector_transaction_id.clone(),
+ capture: Some(CaptureRequest {
+ amount: WorldpayXmlAmount {
+ currency_code: item.router_data.request.currency.to_owned(),
+ exponent: item
+ .router_data
+ .request
+ .currency
+ .number_of_digits_after_decimal_point()
+ .to_string(),
+ value: item.amount.to_owned(),
+ },
+ }),
+ cancel: None,
+ refund: None,
+ },
+ });
+
+ Ok(Self {
+ version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(),
+ merchant_code: auth.merchant_code.clone(),
+ submit: None,
+ reply: None,
+ inquiry: None,
+ modify,
+ })
+ }
+}
+
+impl TryFrom<&PaymentsCancelRouterData> for PaymentService {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &PaymentsCancelRouterData) -> Result<Self, Self::Error> {
+ let auth = WorldpayxmlAuthType::try_from(&item.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let modify = Some(Modify {
+ order_modification: OrderModification {
+ order_code: item.request.connector_transaction_id.clone(),
+ capture: None,
+ cancel: Some(CancelRequest {}),
+ refund: None,
+ },
+ });
+
+ Ok(Self {
+ version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(),
+ merchant_code: auth.merchant_code.clone(),
+ submit: None,
+ reply: None,
+ inquiry: None,
+ modify,
+ })
+ }
+}
+
+impl<F> TryFrom<&WorldpayxmlRouterData<&RefundsRouterData<F>>> for PaymentService {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &WorldpayxmlRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ let auth = WorldpayxmlAuthType::try_from(&item.router_data.connector_auth_type)?;
+
+ let modify = Some(Modify {
+ order_modification: OrderModification {
+ order_code: item.router_data.request.connector_transaction_id.clone(),
+ capture: None,
+ cancel: None,
+ refund: Some(RefundRequest {
+ amount: WorldpayXmlAmount {
+ currency_code: item.router_data.request.currency.to_owned(),
+ exponent: item
+ .router_data
+ .request
+ .currency
+ .number_of_digits_after_decimal_point()
+ .to_string(),
+ value: item.amount.to_owned(),
+ },
+ }),
+ },
+ });
+
+ Ok(Self {
+ version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(),
+ merchant_code: auth.merchant_code.clone(),
+ submit: None,
+ reply: None,
+ inquiry: None,
+ modify,
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, PaymentService>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, PaymentService>,
+ ) -> Result<Self, Self::Error> {
+ let reply = item
+ .response
+ .reply
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply data".to_string()),
+ ))?;
+
+ if let Some(refund_received) = reply.ok.and_then(|ok| ok.refund_received) {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: refund_received.order_code,
+ refund_status: enums::RefundStatus::Pending,
+ }),
+ ..item.data
+ })
+ } else {
+ let error = reply
+ .error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from(
+ "Either refund_received or error must be present in the response"
+ .to_string(),
+ ),
+ ))?;
+
+ Ok(Self {
+ response: Err(ErrorResponse {
+ code: error.code,
+ message: error.message.clone(),
+ reason: Some(error.message.clone()),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ }),
+ ..item.data
+ })
}
}
}
-//TODO: Fill the struct with respective fields
-// Auth Struct
pub struct WorldpayxmlAuthType {
- pub(super) api_key: Secret<String>,
+ pub(super) api_username: Secret<String>,
+ pub(super) api_password: Secret<String>,
+ pub(super) merchant_code: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for WorldpayxmlAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_owned(),
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self {
+ api_username: api_key.to_owned(),
+ api_password: key1.to_owned(),
+ merchant_code: api_secret.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-// PaymentsResponse
-//TODO: Append the remaining status flags
+
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum WorldpayxmlPaymentStatus {
@@ -101,128 +588,545 @@ pub enum WorldpayxmlPaymentStatus {
Processing,
}
-impl From<WorldpayxmlPaymentStatus> for common_enums::AttemptStatus {
- fn from(item: WorldpayxmlPaymentStatus) -> Self {
- match item {
- WorldpayxmlPaymentStatus::Succeeded => Self::Charged,
- WorldpayxmlPaymentStatus::Failed => Self::Failure,
- WorldpayxmlPaymentStatus::Processing => Self::Authorizing,
+fn get_attempt_status(
+ is_auto_capture: bool,
+ last_event: LastEvent,
+ previous_status: Option<&common_enums::AttemptStatus>,
+) -> Result<common_enums::AttemptStatus, errors::ConnectorError> {
+ match last_event {
+ LastEvent::Authorised => {
+ if is_auto_capture {
+ Ok(common_enums::AttemptStatus::Pending)
+ } else if previous_status == Some(&common_enums::AttemptStatus::CaptureInitiated)
+ && !is_auto_capture
+ {
+ Ok(common_enums::AttemptStatus::CaptureInitiated)
+ } else if previous_status == Some(&common_enums::AttemptStatus::VoidInitiated)
+ && !is_auto_capture
+ {
+ Ok(common_enums::AttemptStatus::VoidInitiated)
+ } else {
+ Ok(common_enums::AttemptStatus::Authorized)
+ }
}
+ LastEvent::Refused => Ok(common_enums::AttemptStatus::Failure),
+ LastEvent::Cancelled => Ok(common_enums::AttemptStatus::Voided),
+ LastEvent::Captured | LastEvent::Settled => Ok(common_enums::AttemptStatus::Charged),
+ LastEvent::SentForAuthorisation => Ok(common_enums::AttemptStatus::Authorizing),
+ LastEvent::Refunded
+ | LastEvent::SentForRefund
+ | LastEvent::RefundRequested
+ | LastEvent::RefundFailed => Err(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Invalid LastEvent".to_string()),
+ )),
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct WorldpayxmlPaymentsResponse {
- status: WorldpayxmlPaymentStatus,
- id: String,
+fn get_refund_status(last_event: LastEvent) -> Result<enums::RefundStatus, errors::ConnectorError> {
+ match last_event {
+ LastEvent::Refunded => Ok(enums::RefundStatus::Success),
+ LastEvent::SentForRefund | LastEvent::RefundRequested => Ok(enums::RefundStatus::Pending),
+ LastEvent::RefundFailed => Ok(enums::RefundStatus::Failure),
+ LastEvent::Captured | LastEvent::Settled => Ok(enums::RefundStatus::Pending),
+ LastEvent::Authorised
+ | LastEvent::Refused
+ | LastEvent::Cancelled
+ | LastEvent::SentForAuthorisation => Err(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Invalid LastEvent".to_string()),
+ )),
+ }
}
-impl<F, T> TryFrom<ResponseRouterData<F, WorldpayxmlPaymentsResponse, T, PaymentsResponseData>>
- for RouterData<F, T, PaymentsResponseData>
+impl<F> TryFrom<ResponseRouterData<F, PaymentService, PaymentsSyncData, PaymentsResponseData>>
+ for RouterData<F, PaymentsSyncData, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: ResponseRouterData<F, WorldpayxmlPaymentsResponse, T, PaymentsResponseData>,
+ item: ResponseRouterData<F, PaymentService, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- charges: None,
- }),
- ..item.data
- })
- }
-}
+ let is_auto_capture = item.data.request.is_auto_capture()?;
+ let reply = item
+ .response
+ .reply
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply data".to_string()),
+ ))?;
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
-pub struct WorldpayxmlRefundRequest {
- pub amount: StringMinorUnit,
+ validate_reply(&reply)?;
+ if let Some(order_status) = reply.order_status {
+ validate_order_status(&order_status)?;
+
+ if let Some(payment_data) = order_status.payment {
+ let status = get_attempt_status(
+ is_auto_capture,
+ payment_data.last_event,
+ Some(&item.data.status),
+ )?;
+ let response = process_payment_response(
+ status,
+ &payment_data,
+ item.http_code,
+ order_status.order_code.clone(),
+ )
+ .map_err(|err| *err);
+
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ } else {
+ order_status.error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Either order_status.payment or order_status.error must be present in the response".to_string()),
+ ))?;
+ // Handle API errors unrelated to the payment to prevent failing the payment.
+ Ok(Self {
+ status: item.data.status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ order_status.order_code.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(order_status.order_code.clone()),
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+ } else {
+ // Handle API errors unrelated to the payment to prevent failing the payment
+ Ok(Self {
+ status: item.data.status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: item.data.request.connector_transaction_id.clone(),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+ }
}
-impl<F> TryFrom<&WorldpayxmlRouterData<&RefundsRouterData<F>>> for WorldpayxmlRefundRequest {
+impl TryFrom<&PaymentsSyncRouterData> for PaymentService {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &WorldpayxmlRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ fn try_from(item: &PaymentsSyncRouterData) -> Result<Self, Self::Error> {
+ let auth = WorldpayxmlAuthType::try_from(&item.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let order_code = item
+ .request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+
+ let inquiry = Some(Inquiry {
+ order_inquiry: OrderInquiry { order_code },
+ });
+
Ok(Self {
- amount: item.amount.to_owned(),
+ version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(),
+ merchant_code: auth.merchant_code.clone(),
+ submit: None,
+ reply: None,
+ inquiry,
+ modify: None,
})
}
}
-// Type definition for Refund Response
+impl<F> TryFrom<ResponseRouterData<F, PaymentService, PaymentsAuthorizeData, PaymentsResponseData>>
+ for RouterData<F, PaymentsAuthorizeData, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, PaymentService, PaymentsAuthorizeData, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let is_auto_capture = item.data.request.is_auto_capture()?;
+ let reply = item
+ .response
+ .reply
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply data".to_string()),
+ ))?;
+
+ validate_reply(&reply)?;
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default, Deserialize, Clone)]
-pub enum RefundStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
-}
+ if let Some(order_status) = reply.order_status {
+ validate_order_status(&order_status)?;
-impl From<RefundStatus> for enums::RefundStatus {
- fn from(item: RefundStatus) -> Self {
- match item {
- RefundStatus::Succeeded => Self::Success,
- RefundStatus::Failed => Self::Failure,
- RefundStatus::Processing => Self::Pending,
- //TODO: Review mapping
+ if let Some(payment_data) = order_status.payment {
+ let status = get_attempt_status(is_auto_capture, payment_data.last_event, None)?;
+ let response = process_payment_response(
+ status,
+ &payment_data,
+ item.http_code,
+ order_status.order_code.clone(),
+ )
+ .map_err(|err| *err);
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ } else {
+ let error =
+ order_status.error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Either order_status.payment or order_status.error must be present in the response".to_string()),
+ ))?;
+
+ Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(ErrorResponse {
+ code: error.code,
+ message: error.message.clone(),
+ reason: Some(error.message.clone()),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: Some(order_status.order_code),
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ }),
+ ..item.data
+ })
+ }
+ } else {
+ let error = reply
+ .error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply.error".to_string()),
+ ))?;
+ Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(ErrorResponse {
+ code: error.code,
+ message: error.message.clone(),
+ reason: Some(error.message.clone()),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ }),
+ ..item.data
+ })
}
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct RefundResponse {
- id: String,
- status: RefundStatus,
+impl<F> TryFrom<ResponseRouterData<F, PaymentService, PaymentsCaptureData, PaymentsResponseData>>
+ for RouterData<F, PaymentsCaptureData, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, PaymentService, PaymentsCaptureData, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let reply = item
+ .response
+ .reply
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply data".to_string()),
+ ))?;
+
+ if let Some(capture_received) = reply.ok.and_then(|ok| ok.capture_received) {
+ Ok(Self {
+ // Capture status will be updated via Psync
+ status: common_enums::AttemptStatus::CaptureInitiated,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ capture_received.order_code.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(capture_received.order_code.clone()),
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ } else {
+ let error = reply
+ .error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from(
+ "Either capture_received or error must be present in the response"
+ .to_string(),
+ ),
+ ))?;
+
+ Ok(Self {
+ status: common_enums::AttemptStatus::CaptureFailed,
+ response: Err(ErrorResponse {
+ code: error.code,
+ message: error.message.clone(),
+ reason: Some(error.message.clone()),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ }),
+ ..item.data
+ })
+ }
+ }
}
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+impl<F> TryFrom<ResponseRouterData<F, PaymentService, PaymentsCancelData, PaymentsResponseData>>
+ for RouterData<F, PaymentsCancelData, PaymentsResponseData>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<Execute, RefundResponse>,
+ item: ResponseRouterData<F, PaymentService, PaymentsCancelData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
- }),
- ..item.data
- })
+ let reply = item
+ .response
+ .reply
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply data".to_string()),
+ ))?;
+
+ if let Some(cancel_received) = reply.ok.and_then(|ok| ok.cancel_received) {
+ Ok(Self {
+ // Cancel status will be updated via Psync
+ status: common_enums::AttemptStatus::VoidInitiated,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ cancel_received.order_code.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(cancel_received.order_code.clone()),
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ } else {
+ let error = reply
+ .error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from(
+ "Either cancel_received or error must be present in the response"
+ .to_string(),
+ ),
+ ))?;
+
+ Ok(Self {
+ status: common_enums::AttemptStatus::VoidFailed,
+ response: Err(ErrorResponse {
+ code: error.code,
+ message: error.message.clone(),
+ reason: Some(error.message.clone()),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ }),
+ ..item.data
+ })
+ }
}
}
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+#[derive(Default, Debug, Serialize)]
+pub struct WorldpayxmlRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, PaymentService>> for RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<RSync, RefundResponse>,
+ item: RefundsResponseRouterData<RSync, PaymentService>,
) -> Result<Self, Self::Error> {
+ let reply = item
+ .response
+ .reply
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Missing reply data".to_string()),
+ ))?;
+
+ validate_reply(&reply)?;
+
+ if let Some(order_status) = reply.order_status {
+ validate_order_status(&order_status)?;
+
+ if let Some(payment_data) = order_status.payment {
+ let status = get_refund_status(payment_data.last_event)?;
+ let response = if connector_utils::is_refund_failure(status) {
+ let error_code = payment_data
+ .return_code
+ .as_ref()
+ .map(|code| code.code.clone());
+ let error_message = payment_data
+ .return_code
+ .as_ref()
+ .map(|code| code.description.clone());
+
+ Err(ErrorResponse {
+ code: error_code.unwrap_or(consts::NO_ERROR_CODE.to_string()),
+ message: error_message
+ .clone()
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ reason: error_message.clone(),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ })
+ } else {
+ Ok(RefundsResponseData {
+ connector_refund_id: order_status.order_code,
+ refund_status: status,
+ })
+ };
+
+ Ok(Self {
+ response,
+ ..item.data
+ })
+ } else {
+ order_status.error
+ .ok_or(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from("Either order_status.payment or order_status.error must be present in the response".to_string()),
+ ))?;
+ // Return TransactionResponse for API errors unrelated to the payment to prevent failing the payment.
+ let response = Ok(RefundsResponseData {
+ connector_refund_id: order_status.order_code,
+ refund_status: enums::RefundStatus::Pending,
+ });
+ Ok(Self {
+ response,
+ ..item.data
+ })
+ }
+ } else {
+ // Return TransactionResponse for API errors unrelated to the payment to prevent failing the payment
+ let response = Ok(RefundsResponseData {
+ connector_refund_id: item.data.request.connector_transaction_id.clone(),
+ refund_status: enums::RefundStatus::Pending,
+ });
+
+ Ok(Self {
+ response,
+ ..item.data
+ })
+ }
+ }
+}
+
+impl TryFrom<&RefundSyncRouterData> for PaymentService {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &RefundSyncRouterData) -> Result<Self, Self::Error> {
+ let auth = WorldpayxmlAuthType::try_from(&item.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let order_code = item.request.connector_transaction_id.clone();
+
+ let inquiry = Some(Inquiry {
+ order_inquiry: OrderInquiry { order_code },
+ });
+
Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
- }),
- ..item.data
+ version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(),
+ merchant_code: auth.merchant_code.clone(),
+ submit: None,
+ reply: None,
+ inquiry,
+ modify: None,
})
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
-pub struct WorldpayxmlErrorResponse {
- pub status_code: u16,
- pub code: String,
- pub message: String,
- pub reason: Option<String>,
+fn validate_reply(reply: &Reply) -> Result<(), errors::ConnectorError> {
+ if (reply.error.is_some() && reply.order_status.is_some())
+ || (reply.error.is_none() && reply.order_status.is_none())
+ {
+ Err(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from(
+ "Either reply.error_data or reply.order_data must be present in the response"
+ .to_string(),
+ ),
+ ))
+ } else {
+ Ok(())
+ }
+}
+
+fn validate_order_status(order_status: &OrderStatus) -> Result<(), errors::ConnectorError> {
+ if (order_status.payment.is_some() && order_status.error.is_some())
+ || (order_status.payment.is_none() && order_status.error.is_none())
+ {
+ Err(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from(
+ "Either order_status.payment or order_status.error must be present in the response"
+ .to_string(),
+ ),
+ ))
+ } else {
+ Ok(())
+ }
+}
+
+fn process_payment_response(
+ status: common_enums::AttemptStatus,
+ payment_data: &Payment,
+ http_code: u16,
+ order_code: String,
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
+ if connector_utils::is_payment_failure(status) {
+ let error_code = payment_data
+ .return_code
+ .as_ref()
+ .map(|code| code.code.clone());
+ let error_message = payment_data
+ .return_code
+ .as_ref()
+ .map(|code| code.description.clone());
+
+ Err(Box::new(ErrorResponse {
+ code: error_code.unwrap_or(consts::NO_ERROR_CODE.to_string()),
+ message: error_message.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ reason: None,
+ status_code: http_code,
+ attempt_status: None,
+ connector_transaction_id: Some(order_code.clone()),
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ }))
+ } else {
+ Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(order_code.clone()),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(order_code.clone()),
+ incremental_authorization_allowed: None,
+ charges: None,
+ })
+ }
}
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 7a210717fd..154315c6c0 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -67,10 +67,14 @@ use hyperswitch_domain_models::{
use hyperswitch_interfaces::{api, consts, errors, types::Response};
use image::{DynamicImage, ImageBuffer, ImageFormat, Luma, Rgba};
use masking::{ExposeInterface, PeekInterface, Secret};
+use quick_xml::{
+ events::{BytesDecl, BytesText, Event},
+ Writer,
+};
use rand::Rng;
use regex::Regex;
use router_env::logger;
-use serde::Deserialize;
+use serde::{Deserialize, Serialize};
use serde_json::Value;
use time::PrimitiveDateTime;
use unicode_normalization::UnicodeNormalization;
@@ -6436,3 +6440,42 @@ impl SplitPaymentData for SetupMandateRequestData {
None
}
}
+
+pub struct XmlSerializer;
+impl XmlSerializer {
+ pub fn serialize_to_xml_bytes<T: Serialize>(
+ item: &T,
+ xml_version: &str,
+ xml_encoding: Option<&str>,
+ xml_standalone: Option<&str>,
+ xml_doc_type: &str,
+ ) -> Result<Vec<u8>, error_stack::Report<errors::ConnectorError>> {
+ let mut xml_bytes = Vec::new();
+ let mut writer = Writer::new(std::io::Cursor::new(&mut xml_bytes));
+
+ writer
+ .write_event(Event::Decl(BytesDecl::new(
+ xml_version,
+ xml_encoding,
+ xml_standalone,
+ )))
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to write XML declaration")?;
+
+ writer
+ .write_event(Event::DocType(BytesText::from_escaped(xml_doc_type)))
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to write the XML declaration")?;
+
+ let xml_body = quick_xml::se::to_string(&item)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to serialize the XML body")?;
+
+ writer
+ .write_event(Event::Text(BytesText::from_escaped(xml_body)))
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to serialize the XML body")?;
+
+ Ok(xml_bytes)
+ }
+}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 2f54c92d6c..a97ff2cb68 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1717,10 +1717,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
worldpay::transformers::WorldpayAuthType::try_from(self.auth_type)?;
Ok(())
}
- // api_enums::Connector::Worldpayxml => {
- // worldpayxml::transformers::WorldpayxmlAuthType::try_from(self.auth_type)?;
- // Ok(())
- // },
+ api_enums::Connector::Worldpayxml => {
+ worldpayxml::transformers::WorldpayxmlAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Xendit => {
xendit::transformers::XenditAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 7f501d3a9e..3328c62b73 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -565,8 +565,9 @@ impl ConnectorData {
enums::Connector::Worldpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Worldpay::new())))
}
- // enums::Connector::Worldpayxml => { Ok(ConnectorEnum::Old(Box::new(connector::Worldpayxml)))
- // },
+ enums::Connector::Worldpayxml => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Worldpayxml::new())))
+ }
enums::Connector::Xendit => {
Ok(ConnectorEnum::Old(Box::new(connector::Xendit::new())))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index daa3eacbe4..fadaf943be 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -340,7 +340,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Wise => Self::Wise,
api_enums::Connector::Worldline => Self::Worldline,
api_enums::Connector::Worldpay => Self::Worldpay,
- // api_enums::Connector::Worldpayxml => Self::Worldpayxml,
+ api_enums::Connector::Worldpayxml => Self::Worldpayxml,
api_enums::Connector::Xendit => Self::Xendit,
api_enums::Connector::Zen => Self::Zen,
api_enums::Connector::Zsl => Self::Zsl,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 6b73b67d1a..e9288c319a 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -32,6 +32,7 @@ import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";
import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js";
import { connectorDetails as wellsfargoConnectorDetails } from "./WellsFargo.js";
import { connectorDetails as worldpayConnectorDetails } from "./WorldPay.js";
+import { connectorDetails as worldpayxmlConnectorDetails } from "./Worldpayxml.js";
import { connectorDetails as xenditConnectorDetails } from "./Xendit.js";
import { connectorDetails as archipelConnectorDetails } from "./Archipel.js";
@@ -66,6 +67,7 @@ const connectorDetails = {
trustpay: trustpayConnectorDetails,
wellsfargo: wellsfargoConnectorDetails,
worldpay: worldpayConnectorDetails,
+ worldpayxml: worldpayxmlConnectorDetails,
xendit: xenditConnectorDetails,
archipel: archipelConnectorDetails,
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js b/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js
new file mode 100644
index 0000000000..590efeb478
--- /dev/null
+++ b/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js
@@ -0,0 +1,334 @@
+import { customerAcceptance } from "./Commons";
+import { getCustomExchange } from "./Modifiers";
+
+const successfulNo3DSCardDetails = {
+ card_number: "4444333322221111",
+ card_exp_month: "01",
+ card_exp_year: "27",
+ card_holder_name: "AUTHORISED",
+ card_cvc: "123",
+};
+
+const successfulThreeDSTestCardDetails = {
+ card_number: "4242424242424242",
+ card_exp_month: "01",
+ card_exp_year: "27",
+ card_holder_name: "Joseph",
+ card_cvc: "123",
+};
+
+export const connectorDetails = {
+ card_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "USD",
+ amount: 5000,
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ PaymentIntentWithShippingCost: {
+ Request: {
+ currency: "USD",
+ amount: 5000,
+ shipping_cost: 50,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ amount: 5000,
+ shipping_cost: 50,
+ },
+ },
+ },
+ PaymentConfirmWithShippingCost: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ shipping_cost: 50,
+ amount_received: null,
+ amount: 5000,
+ net_amount: 5050,
+ },
+ },
+ },
+ "3DSManualCapture": getCustomExchange({
+ Request: {
+ amount: 5000,
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ }),
+ "3DSAutoCapture": getCustomExchange({
+ Request: {
+ payment_method: "card",
+ amount: 5000,
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ }),
+ No3DSManualCapture: {
+ Request: {
+ description: "Test description",
+ payment_method: "card",
+ amount: 5000,
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ No3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ amount: 5000,
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ amount_received: null,
+ },
+ },
+ },
+ Capture: {
+ Request: {
+ amount_to_capture: 5000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ amount: 5000,
+ amount_received: null,
+ },
+ },
+ },
+ PartialCapture: {
+ Request: {
+ amount_to_capture: 2000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ amount: 5000,
+ amount_received: null,
+ },
+ },
+ },
+ Void: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "cancelled",
+ },
+ },
+ },
+ ZeroAuthMandate: {
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Worldpayxml is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ ZeroAuthPaymentIntent: {
+ Request: {
+ amount: 0,
+ setup_future_usage: "off_session",
+ currency: "USD",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "off_session",
+ },
+ },
+ },
+ ZeroAuthConfirmPayment: {
+ Request: {
+ payment_type: "setup_mandate",
+ payment_method: "card",
+ payment_method_type: "credit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Worldpayxml is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ amount: 5000,
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ amount: 5000,
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ VoidAfterConfirm: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ amount: 5000,
+ },
+ },
+ },
+ manualPaymentPartialRefund : {
+ Request: {
+ amount: 5000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
+ code: "IR_14",
+ },
+ },
+ },
+ },
+ manualPaymentRefund: {
+ Request: {
+ amount: 5000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
+ code: "IR_14",
+ },
+ },
+ },
+ },
+ MandateMultiUseNo3DSAutoCapture: getCustomExchange({
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: customerAcceptance,
+ setup_future_usage: "off_session",
+ },
+ }),
+ Refund: {
+ Request: {
+ amount: 5000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
+ code: "IR_14",
+ },
+ },
+ },
+ },
+ PartialRefund: {
+ Request: {
+ amount: 2000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
+ code: "IR_14",
+ },
+ },
+ },
+ },
+ },
+};