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

revert(connector): [Worldpay] add root CA certificate (#8224)

Kashifdab4058bfc94
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 40960da0c1..4cb4e3d443 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -4597,11 +4597,10 @@ merchant_secret="Source verification key"
payment_method_type = "google_pay"
[[worldpay.wallet]]
payment_method_type = "apple_pay"
-[worldpay.connector_auth.MultiAuthKey]
+[worldpay.connector_auth.SignatureKey]
key1="Username"
api_key="Password"
api_secret="Merchant Identifier"
-key2="Worldpay's CA Certificate"
[worldpay.connector_webhook_details]
merchant_secret="Source verification key"
[worldpay.metadata.merchant_name]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index bb9e84f46f..e2a5158920 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -3296,11 +3296,10 @@ merchant_secret="Source verification key"
payment_method_type = "google_pay"
[[worldpay.wallet]]
payment_method_type = "apple_pay"
-[worldpay.connector_auth.MultiAuthKey]
+[worldpay.connector_auth.SignatureKey]
key1="Username"
api_key="Password"
api_secret="Merchant Identifier"
-key2="Worldpay's CA Certificate"
[worldpay.metadata.merchant_name]
name="merchant_name"
label="Name of the merchant to de displayed during 3DS challenge"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 8a7e27f6b6..9e9b58970b 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -4557,11 +4557,10 @@ merchant_secret="Source verification key"
payment_method_type = "google_pay"
[[worldpay.wallet]]
payment_method_type = "apple_pay"
-[worldpay.connector_auth.MultiAuthKey]
+[worldpay.connector_auth.SignatureKey]
key1="Username"
api_key="Password"
api_secret="Merchant Identifier"
-key2="Worldpay's CA Certificate"
[worldpay.connector_webhook_details]
merchant_secret="Source verification key"
[worldpay.metadata.merchant_name]
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
index 0d9a79ed5e..009a02f7ef 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
@@ -233,15 +233,12 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
req: &SetupMandateRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::SetupMandateType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::SetupMandateType::get_headers(self, req, connectors)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.set_body(types::SetupMandateType::get_request_body(
self, req, connectors,
)?)
@@ -339,15 +336,12 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Wo
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(PaymentsVoidType::get_headers(self, req, connectors)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.build(),
))
}
@@ -448,15 +442,12 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.build(),
))
}
@@ -588,8 +579,6 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
@@ -598,7 +587,6 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.headers(types::PaymentsCaptureType::get_headers(
self, req, connectors,
)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.set_body(types::PaymentsCaptureType::get_request_body(
self, req, connectors,
)?)
@@ -716,8 +704,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
@@ -728,7 +714,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.headers(types::PaymentsAuthorizeType::get_headers(
self, req, connectors,
)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
@@ -835,8 +820,6 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
req: &PaymentsCompleteAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsCompleteAuthorizeType::get_url(
@@ -845,7 +828,6 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
.headers(types::PaymentsCompleteAuthorizeType::get_headers(
self, req, connectors,
)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
self, req, connectors,
)?)
@@ -949,8 +931,6 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpa
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::RefundExecuteType::get_url(self, req, connectors)?)
@@ -958,7 +938,6 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Worldpa
.headers(types::RefundExecuteType::get_headers(
self, req, connectors,
)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.set_body(types::RefundExecuteType::get_request_body(
self, req, connectors,
)?)
@@ -1049,15 +1028,12 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpay
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let auth = worldpay::WorldpayAuthType::try_from(&req.connector_auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
- .add_ca_certificate_pem(auth.ca_certificate)
.build(),
))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index 84d6e13cde..20b21be770 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -562,7 +562,6 @@ impl<T: WorldpayPaymentsRequestData> TryFrom<(&WorldpayRouterData<&T>, &Secret<S
pub struct WorldpayAuthType {
pub(super) api_key: Secret<String>,
pub(super) entity_id: Secret<String>,
- pub(super) ca_certificate: Option<Secret<String>>,
}
impl TryFrom<&ConnectorAuthType> for WorldpayAuthType {
@@ -576,7 +575,6 @@ impl TryFrom<&ConnectorAuthType> for WorldpayAuthType {
Ok(Self {
api_key: Secret::new(auth_header),
entity_id: Secret::new("default".to_string()),
- ca_certificate: None,
})
}
ConnectorAuthType::SignatureKey {
@@ -589,21 +587,6 @@ impl TryFrom<&ConnectorAuthType> for WorldpayAuthType {
Ok(Self {
api_key: Secret::new(auth_header),
entity_id: api_secret.clone(),
- ca_certificate: None,
- })
- }
- ConnectorAuthType::MultiAuthKey {
- api_key,
- key1,
- api_secret,
- key2,
- } => {
- let auth_key = format!("{}:{}", key1.peek(), api_key.peek());
- let auth_header = format!("Basic {}", BASE64_ENGINE.encode(auth_key));
- Ok(Self {
- api_key: Secret::new(auth_header),
- entity_id: api_secret.clone(),
- ca_certificate: Some(key2.clone()),
})
}
_ => Err(errors::ConnectorError::FailedToObtainAuthType)?,