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(connectors): [Worldpayvantiv] add NTI flow and refactor sync flows (#8495)

AkshayaFoigerf8dc3ecfe6a9
diff --git a/config/config.example.toml b/config/config.example.toml
index f9b55b7329..f243e99bcb 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -299,6 +299,7 @@ wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivprelive.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
zsl.base_url = "https://api.sitoffalb.net/"
@@ -513,8 +514,8 @@ wallet.google_pay = { connector_list = "bankofamerica,authorizedotnet" }
bank_redirect.giropay = { connector_list = "globalpay" }
[mandates.supported_payment_methods]
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
wallet.paypal = { connector_list = "adyen,novalnet" } # Mandate supported payment method type and connector for wallets
pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
bank_debit.ach = { connector_list = "gocardless,adyen" } # Mandate supported payment method type and connector for bank_debit
@@ -1056,7 +1057,7 @@ webhook_source_verification_key= "" # webhook source verification key to verify
connector_list = "adyen,cybersource" # Supported connectors for network tokenization
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay" # Supported connectors for network transaction id
+connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv" # Supported connectors for network transaction id
[grpc_client.dynamic_routing_client] # Dynamic Routing Client Configuration
host = "localhost" # Client Host
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index f4c3e3815d..382e0117f9 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -134,6 +134,7 @@ wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivprelive.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
zen.base_url = "https://api.zen-test.com/"
@@ -209,8 +210,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
@@ -237,7 +238,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup
card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay"
+connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
[payouts]
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 8ed1c92c48..e740b6aa76 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -138,6 +138,7 @@ wise.base_url = "https://api.wise.com/"
worldline.base_url = "https://eu.api-ingenico.com/"
worldpay.base_url = "https://access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivcnp.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivcnp.com"
worldpayxml.base_url = "https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
zen.base_url = "https://api.zen.com/"
@@ -209,8 +210,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
@@ -237,7 +238,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup
card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,stripe"
+connector_list = "adyen,archipel,stripe,worldpayvantiv"
[payouts]
payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index e09aa5f88f..10a2fccb1f 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -138,6 +138,7 @@ wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivprelive.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
zen.base_url = "https://api.zen-test.com/"
@@ -216,8 +217,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
@@ -244,7 +245,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup
card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay"
+connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
[payouts]
diff --git a/config/development.toml b/config/development.toml
index 3dac3fb116..dfe5f1fcc8 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -324,6 +324,7 @@ wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivprelive.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
@@ -937,8 +938,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
@@ -965,7 +966,7 @@ card.credit = { connector_list = "cybersource" }
card.debit = { connector_list = "cybersource" }
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay"
+connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
[connector_request_reference_id_config]
merchant_ids_send_payment_id_as_connector_request_id = []
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 484dd76097..e9b011b039 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -225,6 +225,7 @@ wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivprelive.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
zen.base_url = "https://api.zen-test.com/"
@@ -865,8 +866,8 @@ wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotn
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo" }
wallet.samsung_pay = { connector_list = "cybersource" }
wallet.paypal = { connector_list = "adyen,novalnet,authorizedotnet" }
-card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo" }
-card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo" }
+card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv" }
+card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv" }
bank_debit.ach = { connector_list = "gocardless,adyen" }
bank_debit.becs = { connector_list = "gocardless" }
bank_debit.bacs = { connector_list = "adyen" }
@@ -880,7 +881,7 @@ card.credit = { connector_list = "cybersource" }
card.debit = { connector_list = "cybersource" }
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay"
+connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
[connector_customer]
connector_list = "adyen,facilitapay,gocardless,hyperswitch_vault,stax,stripe"
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
index 0cd1f236e5..97f0aef3ce 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
@@ -2,14 +2,18 @@ pub mod transformers;
use std::sync::LazyLock;
+use base64::Engine;
use common_utils::{
+ consts::BASE64_ENGINE,
errors::CustomResult,
+ ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
-use error_stack::report;
+use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
- router_data::{AccessToken, ErrorResponse, RouterData},
+ payment_method_data::PaymentMethodData,
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
@@ -35,11 +39,13 @@ use hyperswitch_interfaces::{
ConnectorValidation,
},
configs::Connectors,
+ consts::NO_ERROR_CODE,
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
};
+use masking::{Mask, PeekInterface};
use transformers as worldpayvantiv;
use crate::{constants::headers, types::ResponseRouterData, utils as connector_utils};
@@ -110,6 +116,20 @@ impl ConnectorCommon for Worldpayvantiv {
connectors.worldpayvantiv.base_url.as_ref()
}
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = worldpayvantiv::WorldpayvantivAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let auth_key = format!("{}:{}", auth.user.peek(), auth.password.peek());
+ let auth_header = format!("Basic {}", BASE64_ENGINE.encode(auth_key));
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth_header.into_masked(),
+ )])
+ }
+
fn build_error_response(
&self,
res: Response,
@@ -144,7 +164,15 @@ impl ConnectorCommon for Worldpayvantiv {
}
impl ConnectorValidation for Worldpayvantiv {
- //TODO: implement functions when support enabled
+ fn validate_mandate_payment(
+ &self,
+ pm_type: Option<api_models::enums::PaymentMethodType>,
+ pm_data: PaymentMethodData,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ let mandate_supported_pmd =
+ std::collections::HashSet::from([connector_utils::PaymentMethodDataType::Card]);
+ connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
+ }
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Worldpayvantiv {
@@ -270,38 +298,28 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
fn get_headers(
&self,
req: &PaymentsSyncRouterData,
- connectors: &Connectors,
+ _connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
- self.build_headers(req, connectors)
+ self.get_auth_header(&req.connector_auth_type)
}
fn get_content_type(&self) -> &'static str {
- self.common_get_content_type()
+ "application/json"
}
fn get_url(
&self,
- _req: &PaymentsSyncRouterData,
+ req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Ok(self.base_url(connectors).to_owned())
- }
-
- fn get_request_body(
- &self,
- req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
- ) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_req_object = worldpayvantiv::CnpOnlineRequest::try_from(req)?;
- router_env::logger::info!(raw_connector_request=?connector_req_object);
- let connector_req = connector_utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayvantiv::worldpayvantiv_constants::XML_VERSION,
- Some(worldpayvantiv::worldpayvantiv_constants::XML_ENCODING),
- None,
- None,
- )?;
- Ok(RequestContent::RawBytes(connector_req))
+ Ok(format!(
+ "{}/reports/dtrPaymentStatus/{}",
+ connectors.worldpayvantiv.secondary_base_url.to_owned(),
+ req.request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?
+ ))
}
fn build_request(
@@ -311,13 +329,10 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Post)
+ .method(Method::Get)
.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(),
))
}
@@ -328,8 +343,10 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: worldpayvantiv::CnpOnlineResponse =
- connector_utils::deserialize_xml_to_struct(&res.response)?;
+ let response: worldpayvantiv::VantivSyncResponse = res
+ .response
+ .parse_struct("VantivSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -344,7 +361,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- self.build_error_response(res, event_builder)
+ handle_vantiv_json_error_response(res, event_builder)
}
}
@@ -622,40 +639,25 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayv
fn get_headers(
&self,
req: &RefundSyncRouterData,
- connectors: &Connectors,
+ _connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
- self.build_headers(req, connectors)
+ self.get_auth_header(&req.connector_auth_type)
}
fn get_content_type(&self) -> &'static str {
- self.common_get_content_type()
+ "application/json"
}
fn get_url(
&self,
- _req: &RefundSyncRouterData,
+ req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Ok(self.base_url(connectors).to_owned())
- }
-
- fn get_request_body(
- &self,
- req: &RefundSyncRouterData,
- _connectors: &Connectors,
- ) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_req_object = worldpayvantiv::CnpOnlineRequest::try_from(req)?;
- router_env::logger::info!(raw_connector_request=?connector_req_object);
-
- let connector_req = connector_utils::XmlSerializer::serialize_to_xml_bytes(
- &connector_req_object,
- worldpayvantiv::worldpayvantiv_constants::XML_VERSION,
- Some(worldpayvantiv::worldpayvantiv_constants::XML_ENCODING),
- None,
- None,
- )?;
-
- Ok(RequestContent::RawBytes(connector_req))
+ Ok(format!(
+ "{}/reports/dtrPaymentStatus/{}",
+ connectors.worldpayvantiv.secondary_base_url.to_owned(),
+ req.request.connector_transaction_id
+ ))
}
fn build_request(
@@ -665,13 +667,10 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayv
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Post)
+ .method(Method::Get)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
- .set_body(types::RefundSyncType::get_request_body(
- self, req, connectors,
- )?)
.build(),
))
}
@@ -682,8 +681,11 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayv
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
- let response: worldpayvantiv::CnpOnlineResponse =
- connector_utils::deserialize_xml_to_struct(&res.response)?;
+ let response: worldpayvantiv::VantivSyncResponse = res
+ .response
+ .parse_struct("VantivSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -698,7 +700,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayv
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- self.build_error_response(res, event_builder)
+ handle_vantiv_json_error_response(res, event_builder)
}
}
@@ -749,7 +751,7 @@ static WORLDPAYVANTIV_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethod
common_enums::PaymentMethod::Card,
common_enums::PaymentMethodType::Credit,
PaymentMethodDetails {
- mandates: common_enums::FeatureStatus::NotSupported,
+ mandates: common_enums::FeatureStatus::Supported,
refunds: common_enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: Some(
@@ -768,7 +770,7 @@ static WORLDPAYVANTIV_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethod
common_enums::PaymentMethod::Card,
common_enums::PaymentMethodType::Debit,
PaymentMethodDetails {
- mandates: common_enums::FeatureStatus::NotSupported,
+ mandates: common_enums::FeatureStatus::Supported,
refunds: common_enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: Some(
@@ -806,3 +808,38 @@ impl ConnectorSpecifications for Worldpayvantiv {
Some(&WORLDPAYVANTIV_SUPPORTED_WEBHOOK_FLOWS)
}
}
+
+fn handle_vantiv_json_error_response(
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: Result<worldpayvantiv::VantivSyncErrorResponse, _> = res
+ .response
+ .parse_struct("VantivSyncErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed);
+
+ match response {
+ Ok(response_data) => {
+ event_builder.map(|i| i.set_response_body(&response_data));
+ router_env::logger::info!(connector_response=?response_data);
+ let error_reason = response_data.error_messages.join(" & ");
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: NO_ERROR_CODE.to_string(),
+ message: error_reason.clone(),
+ reason: Some(error_reason.clone()),
+ attempt_status: None,
+ connector_transaction_id: None,
+ network_decline_code: None,
+ network_advice_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);
+ connector_utils::handle_json_response_deserialization_failure(res, "worldpayvantiv")
+ }
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
index 80e2361b32..defbeb2fe4 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
@@ -11,19 +11,16 @@ use hyperswitch_domain_models::{
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
- PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+ RefundsRouterData,
},
};
-use hyperswitch_interfaces::errors;
-use masking::Secret;
+use hyperswitch_interfaces::{consts, errors};
+use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
- utils::{
- self as connector_utils, CardData, PaymentsAuthorizeRequestData, RefundsRequestData,
- RouterData as _,
- },
+ utils::{self as connector_utils, CardData, PaymentsAuthorizeRequestData, RouterData as _},
};
pub mod worldpayvantiv_constants {
@@ -119,8 +116,6 @@ pub struct CnpOnlineRequest {
pub void: Option<Void>,
#[serde(skip_serializing_if = "Option::is_none")]
pub credit: Option<RefundRequest>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub query_transaction: Option<TransactionQuery>,
}
#[derive(Debug, Serialize)]
@@ -153,15 +148,23 @@ pub struct Capture {
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BillToAddressData {
- pub name: Secret<String>,
+ pub name: Option<Secret<String>>,
pub address_line1: Option<Secret<String>>,
pub city: Option<String>,
pub state: Option<Secret<String>>,
pub zip: Option<Secret<String>>,
pub email: Option<common_utils::pii::Email>,
+ pub country: Option<common_enums::CountryAlpha2>,
pub phone: Option<Secret<String>>,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub enum VantivProcessingType {
+ InitialCOF,
+ MerchantInitiatedCOF,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Authorization {
@@ -176,6 +179,10 @@ pub struct Authorization {
pub order_source: OrderSource,
pub bill_to_address: Option<BillToAddressData>,
pub card: WorldpayvantivCardData,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub processing_type: Option<VantivProcessingType>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub original_network_transaction_id: Option<Secret<String>>,
}
#[derive(Debug, Serialize)]
@@ -192,6 +199,10 @@ pub struct Sale {
pub order_source: OrderSource,
pub bill_to_address: Option<BillToAddressData>,
pub card: WorldpayvantivCardData,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub processing_type: Option<VantivProcessingType>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub original_network_transaction_id: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -207,18 +218,6 @@ pub struct RefundRequest {
pub amount: MinorUnit,
}
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TransactionQuery {
- #[serde(rename = "@reportGroup")]
- pub report_group: String,
- #[serde(rename = "@id")]
- pub id: String,
- #[serde(rename = "@customerId")]
- pub customer_id: Option<String>,
- pub orig_cnp_txn_id: String,
-}
-
#[derive(Debug, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum OrderSource {
@@ -232,7 +231,8 @@ pub struct WorldpayvantivCardData {
pub card_type: WorldpayvativCardType,
pub number: cards::CardNumber,
pub exp_date: Secret<String>,
- pub card_validation_num: Secret<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub card_validation_num: Option<Secret<String>>,
}
#[derive(Debug, Clone, Serialize)]
@@ -306,276 +306,84 @@ impl TryFrom<&PaymentMethodData> for WorldpayvantivCardData {
card_type,
number: card.card_number.clone(),
exp_date,
- card_validation_num: card.card_cvc.clone(),
+ card_validation_num: Some(card.card_cvc.clone()),
})
}
- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
- }
- }
-}
-
-impl TryFrom<&PaymentsSyncRouterData> for CnpOnlineRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &PaymentsSyncRouterData) -> Result<Self, Self::Error> {
- let report_group_metadata: WorldpayvantivPaymentMetadata =
- connector_utils::to_connector_meta(item.request.connector_meta.clone())?;
- let report_group = report_group_metadata.report_group.clone().ok_or(
- errors::ConnectorError::RequestEncodingFailedWithReason(
- "Failed to obtain report_group from metadata".to_string(),
- ),
- )?;
- let api_call_id = format!("psync_{:?}", connector_utils::generate_12_digit_number());
- let query_transaction = Some(TransactionQuery {
- id: api_call_id,
- report_group,
- customer_id: item
- .customer_id
- .clone()
- .map(|customer_id| customer_id.get_string_repr().to_string()),
- orig_cnp_txn_id: item
- .request
- .connector_transaction_id
- .get_connector_transaction_id()
- .change_context(errors::ConnectorError::MissingConnectorTransactionID)?,
- });
+ PaymentMethodData::CardDetailsForNetworkTransactionId(card_data) => {
+ let card_type = match card_data.card_network.clone() {
+ Some(card_type) => WorldpayvativCardType::try_from(card_type)?,
+ None => WorldpayvativCardType::try_from(&card_data.get_card_issuer()?)?,
+ };
- let worldpayvantiv_auth_type = WorldpayvantivAuthType::try_from(&item.connector_auth_type)?;
- let authentication = Authentication {
- user: worldpayvantiv_auth_type.user,
- password: worldpayvantiv_auth_type.password,
- };
+ let exp_date = card_data.get_expiry_date_as_mmyy()?;
- Ok(Self {
- version: worldpayvantiv_constants::WORLDPAYVANTIV_VERSION.to_string(),
- xmlns: worldpayvantiv_constants::XMLNS.to_string(),
- merchant_id: worldpayvantiv_auth_type.merchant_id,
- authentication,
- authorization: None,
- sale: None,
- capture: None,
- void: None,
- credit: None,
- query_transaction,
- })
+ Ok(Self {
+ card_type,
+ number: card_data.card_number.clone(),
+ exp_date,
+ card_validation_num: None,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
}
}
-impl<F> TryFrom<ResponseRouterData<F, CnpOnlineResponse, PaymentsSyncData, PaymentsResponseData>>
+impl<F> TryFrom<ResponseRouterData<F, VantivSyncResponse, PaymentsSyncData, PaymentsResponseData>>
for RouterData<F, PaymentsSyncData, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: ResponseRouterData<F, CnpOnlineResponse, PaymentsSyncData, PaymentsResponseData>,
+ item: ResponseRouterData<F, VantivSyncResponse, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- let connector_transaction_id = item
- .data
- .request
- .connector_transaction_id
- .get_connector_transaction_id()
- .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
-
- match item
- .response
- .query_transaction_response
- .and_then(|query_transaction_response| {
- query_transaction_response
- .results
- .and_then(|query_response| query_response.first().cloned())
- }) {
- Some(result) => {
- if let Some(void_response) = &result.void_response {
- let status = get_attempt_status(
- WorldpayvantivPaymentFlow::Void,
- void_response.response,
- )?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: void_response.response.to_string(),
- message: void_response.message.clone(),
- reason: Some(void_response.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
- })
- } else {
- Ok(Self {
- status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- connector_transaction_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
- })
- }
- } else if let Some(capture_response) = &result.capture_response {
- let status = get_attempt_status(
- WorldpayvantivPaymentFlow::Capture,
- capture_response.response,
- )?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: capture_response.response.to_string(),
- message: capture_response.message.clone(),
- reason: Some(capture_response.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
- })
- } else {
- Ok(Self {
- status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- connector_transaction_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
- })
- }
- } else if let Some(sale_response) = &result.sale_response {
- let status = get_attempt_status(
- WorldpayvantivPaymentFlow::Sale,
- sale_response.response_code,
- )?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: sale_response.response_code.to_string(),
- message: sale_response.message.clone(),
- reason: Some(sale_response.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
- })
- } else {
- Ok(Self {
- status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- connector_transaction_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
- })
- }
- } else if let Some(authorization_response) = &result.authorization_response {
- let status = get_attempt_status(
- WorldpayvantivPaymentFlow::Auth,
- authorization_response.response_code,
- )?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: authorization_response.response_code.to_string(),
- message: authorization_response.message.clone(),
- reason: Some(authorization_response.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
- })
- } else {
- Ok(Self {
- status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- connector_transaction_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
- })
- }
- } else {
- // In case of Psync failure
- Ok(Self {
- status: item.data.status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- connector_transaction_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
- })
- }
- }
- None => {
- // In case of 2xx Psync failure
- Ok(Self {
- status: item.data.status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(connector_transaction_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 status = get_attempt_status_for_psync(item.response.payment_status, item.data.status)?;
+
+ if connector_utils::is_payment_failure(status) {
+ let error_code = item
+ .response
+ .payment_detail
+ .as_ref()
+ .and_then(|detail| detail.response_reason_code.clone())
+ .unwrap_or(consts::NO_ERROR_CODE.to_string());
+ let error_message = item
+ .response
+ .payment_detail
+ .as_ref()
+ .and_then(|detail| detail.response_reason_message.clone())
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string());
+
+ Ok(Self {
+ status,
+ response: Err(ErrorResponse {
+ code: error_code.clone(),
+ 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
+ })
+ } else {
+ Ok(Self {
+ status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.payment_id.to_string(),
+ ),
+ 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
+ })
}
}
}
@@ -583,18 +391,19 @@ impl<F> TryFrom<ResponseRouterData<F, CnpOnlineResponse, PaymentsSyncData, Payme
fn get_bill_to_address(item: &PaymentsAuthorizeRouterData) -> Option<BillToAddressData> {
let billing_address = item.get_optional_billing();
billing_address.and_then(|billing_address| {
- billing_address.address.clone().and_then(|address| {
- let full_name = address.get_optional_full_name();
- full_name.map(|name| BillToAddressData {
- name,
+ billing_address
+ .address
+ .clone()
+ .map(|address| BillToAddressData {
+ name: address.get_optional_full_name(),
address_line1: item.get_optional_billing_line1(),
city: item.get_optional_billing_city(),
state: item.get_optional_billing_state(),
zip: item.get_optional_billing_zip(),
email: item.get_optional_billing_email(),
+ country: item.get_optional_billing_country(),
phone: item.get_optional_billing_phone_number(),
})
- })
})
}
@@ -657,6 +466,9 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl
.map(|customer_id| customer_id.get_string_repr().to_string());
let bill_to_address = get_bill_to_address(item.router_data);
+ let (processing_type, original_network_transaction_id) =
+ get_processing_info(&item.router_data.request);
+
let (authorization, sale) = if item.router_data.request.is_auto_capture()? {
(
None,
@@ -669,6 +481,8 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl
order_source: OrderSource::Ecommerce,
bill_to_address,
card: card.clone(),
+ processing_type,
+ original_network_transaction_id,
}),
)
} else {
@@ -682,6 +496,8 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl
order_source: OrderSource::Ecommerce,
bill_to_address,
card: card.clone(),
+ processing_type,
+ original_network_transaction_id,
}),
None,
)
@@ -697,11 +513,26 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl
capture: None,
void: None,
credit: None,
- query_transaction: None,
})
}
}
+fn get_processing_info(
+ request: &PaymentsAuthorizeData,
+) -> (Option<VantivProcessingType>, Option<Secret<String>>) {
+ match (
+ request.is_customer_initiated_mandate_payment(),
+ request.get_optional_network_transaction_id(),
+ ) {
+ (true, _) => (Some(VantivProcessingType::InitialCOF), None),
+ (false, Some(network_transaction_id)) => (
+ Some(VantivProcessingType::MerchantInitiatedCOF),
+ Some(Secret::new(network_transaction_id.to_string())),
+ ),
+ _ => (None, None),
+ }
+}
+
impl TryFrom<&WorldpayvantivRouterData<&PaymentsCaptureRouterData>> for CnpOnlineRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
@@ -739,7 +570,6 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsCaptureRouterData>> for CnpOnlin
capture,
void: None,
credit: None,
- query_transaction: None,
})
}
}
@@ -792,53 +622,14 @@ impl<F> TryFrom<&WorldpayvantivRouterData<&RefundsRouterData<F>>> for CnpOnlineR
capture: None,
void: None,
credit,
- query_transaction: None,
})
}
}
-impl TryFrom<&RefundSyncRouterData> for CnpOnlineRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &RefundSyncRouterData) -> Result<Self, Self::Error> {
- let report_group_metadata: WorldpayvantivPaymentMetadata =
- connector_utils::to_connector_meta(item.request.connector_metadata.clone())?;
- let report_group = report_group_metadata.report_group.clone().ok_or(
- errors::ConnectorError::RequestEncodingFailedWithReason(
- "Failed to obtain report_group from metadata".to_string(),
- ),
- )?;
- let customer_id = item
- .customer_id
- .clone()
- .map(|customer_id| customer_id.get_string_repr().to_string());
-
- let api_call_id = format!("rsync_{:?}", connector_utils::generate_12_digit_number());
- let query_transaction = Some(TransactionQuery {
- id: api_call_id,
- report_group,
- customer_id,
- orig_cnp_txn_id: item.request.get_connector_refund_id()?,
- });
-
- let worldpayvantiv_auth_type = WorldpayvantivAuthType::try_from(&item.connector_auth_type)?;
- let authentication = Authentication {
- user: worldpayvantiv_auth_type.user,
- password: worldpayvantiv_auth_type.password,
- };
-
- Ok(Self {
- version: worldpayvantiv_constants::WORLDPAYVANTIV_VERSION.to_string(),
- xmlns: worldpayvantiv_constants::XMLNS.to_string(),
- merchant_id: worldpayvantiv_auth_type.merchant_id,
- authentication,
- authorization: None,
- sale: None,
- capture: None,
- void: None,
- credit: None,
- query_transaction,
- })
- }
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct VantivSyncErrorResponse {
+ pub error_messages: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -855,7 +646,46 @@ pub struct CnpOnlineResponse {
pub capture_response: Option<CaptureResponse>,
pub void_response: Option<VoidResponse>,
pub credit_response: Option<CreditResponse>,
- pub query_transaction_response: Option<QueryTransactionResponse>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct VantivSyncResponse {
+ pub payment_id: u64,
+ pub request_uuid: String,
+ pub payment_status: PaymentStatus,
+ pub payment_detail: Option<PaymentDetail>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentDetail {
+ pub payment_id: Option<u64>,
+ pub batch_id: Option<u64>,
+ pub session_id: Option<u64>,
+ pub response_reason_code: Option<String>,
+ pub response_reason_message: Option<String>,
+ pub reject_type: Option<String>,
+ pub dupe_txn_id: Option<u64>,
+ pub amount: Option<String>,
+ pub purchase_currency: Option<String>,
+ pub post_day: Option<String>,
+ pub reported_timestamp: Option<String>,
+ pub payment_type: Option<String>,
+ pub merchant_order_number: Option<String>,
+ pub merchant_txn_id: Option<String>,
+ pub parent_id: Option<u64>,
+ pub reporting_group: Option<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PaymentStatus {
+ NotYetProcessed,
+ ProcessedSuccessfully,
+ TransactionDeclined,
+ StatusUnavailable,
+ PaymentStatusNotFound,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -869,7 +699,7 @@ pub struct CaptureResponse {
pub customer_id: Option<String>,
#[serde(rename = "cnpTxnId")]
pub cnp_txn_id: String,
- pub response: WorldpayvantivResponseCode,
+ pub response: String,
pub response_time: String,
pub message: String,
pub location: Option<String>,
@@ -878,8 +708,8 @@ pub struct CaptureResponse {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct FraudResult {
- pub avs_result: String,
- pub card_validation_result: String,
+ pub avs_result: Option<String>,
+ pub card_validation_result: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
@@ -894,7 +724,7 @@ pub struct AuthorizationResponse {
pub cnp_txn_id: String,
pub order_id: String,
#[serde(rename = "response")]
- pub response_code: WorldpayvantivResponseCode,
+ pub response_code: String,
pub message: String,
pub response_time: String,
pub auth_code: Option<Secret<String>>,
@@ -914,7 +744,7 @@ pub struct SaleResponse {
pub cnp_txn_id: String,
pub order_id: String,
#[serde(rename = "response")]
- pub response_code: WorldpayvantivResponseCode,
+ pub response_code: String,
pub message: String,
pub response_time: String,
pub auth_code: Option<Secret<String>>,
@@ -932,40 +762,13 @@ pub struct VoidResponse {
#[serde(rename = "@customerId")]
pub customer_id: Option<String>,
pub cnp_txn_id: String,
- pub response: WorldpayvantivResponseCode,
+ pub response: String,
pub response_time: String,
pub post_date: String,
pub message: String,
pub location: Option<String>,
}
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct QueryTransactionResponse {
- #[serde(rename = "@id")]
- pub id: String,
- #[serde(rename = "@reportGroup")]
- pub report_group: String,
- #[serde(rename = "@customerId")]
- pub customer_id: Option<String>,
- pub response: WorldpayvantivResponseCode,
- pub response_time: String,
- pub message: String,
- pub match_count: u32,
- #[serde(rename = "results_max10")]
- pub results: Option<Vec<ResultsMax10>>,
- pub location: String,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct ResultsMax10 {
- pub authorization_response: Option<AuthorizationResponse>,
- pub sale_response: Option<SaleResponse>,
- pub capture_response: Option<CaptureResponse>,
- pub void_response: Option<VoidResponse>,
- pub credit_response: Option<CreditResponse>,
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CreditResponse {
@@ -976,7 +779,7 @@ pub struct CreditResponse {
#[serde(rename = "@customerId")]
pub customer_id: Option<String>,
pub cnp_txn_id: String,
- pub response: WorldpayvantivResponseCode,
+ pub response: String,
pub response_time: String,
pub message: String,
pub location: Option<String>,
@@ -992,46 +795,20 @@ where
item: ResponseRouterData<F, CnpOnlineResponse, PaymentsCaptureData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
match item.response.capture_response {
- Some(capture_response) => {
- let status = get_attempt_status(
- WorldpayvantivPaymentFlow::Capture,
- capture_response.response,
- )?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: capture_response.response.to_string(),
- message: capture_response.message.clone(),
- reason: Some(capture_response.message.clone()),
- status_code: item.http_code,
- attempt_status: None,
- connector_transaction_id: Some(capture_response.cnp_txn_id),
- network_advice_code: None,
- network_decline_code: None,
- network_error_message: None,
- }),
- ..item.data
- })
- } else {
- Ok(Self {
- status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- capture_response.cnp_txn_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
- })
- }
- }
+ Some(capture_response) => Ok(Self {
+ status: common_enums::AttemptStatus::CaptureInitiated,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(capture_response.cnp_txn_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
+ }),
None => Ok(Self {
status: common_enums::AttemptStatus::CaptureFailed,
response: Err(ErrorResponse {
@@ -1059,45 +836,22 @@ impl<F> TryFrom<ResponseRouterData<F, CnpOnlineResponse, PaymentsCancelData, Pay
item: ResponseRouterData<F, CnpOnlineResponse, PaymentsCancelData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
match item.response.void_response {
- Some(void_response) => {
- let status =
- get_attempt_status(WorldpayvantivPaymentFlow::Void, void_response.response)?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: void_response.response.to_string(),
- message: void_response.message.clone(),
- reason: Some(void_response.message.clone()),
- status_code: item.http_code,
- attempt_status: None,
- connector_transaction_id: Some(void_response.cnp_txn_id),
- network_advice_code: None,
- network_decline_code: None,
- network_error_message: None,
- }),
- ..item.data
- })
- } else {
- Ok(Self {
- status,
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(
- void_response.cnp_txn_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
- })
- }
- }
+ Some(void_response) => Ok(Self {
+ status: common_enums::AttemptStatus::VoidInitiated,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(void_response.cnp_txn_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
+ }),
None => Ok(Self {
+ // Incase of API failure
status: common_enums::AttemptStatus::VoidFailed,
response: Err(ErrorResponse {
code: item.response.response_code,
@@ -1122,33 +876,14 @@ impl TryFrom<RefundsResponseRouterData<Execute, CnpOnlineResponse>> for RefundsR
item: RefundsResponseRouterData<Execute, CnpOnlineResponse>,
) -> Result<Self, Self::Error> {
match item.response.credit_response {
- Some(credit_response) => {
- let refund_status = get_refund_status(credit_response.response)?;
- if connector_utils::is_refund_failure(refund_status) {
- Ok(Self {
- response: Err(ErrorResponse {
- code: credit_response.response.to_string(),
- message: credit_response.message.clone(),
- reason: Some(credit_response.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
- })
- } else {
- Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: credit_response.cnp_txn_id,
- refund_status,
- }),
- ..item.data
- })
- }
- }
+ Some(credit_response) => Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: credit_response.cnp_txn_id,
+
+ refund_status: common_enums::RefundStatus::Pending,
+ }),
+ ..item.data
+ }),
None => Ok(Self {
response: Err(ErrorResponse {
code: item.response.response_code,
@@ -1200,7 +935,6 @@ impl TryFrom<&PaymentsCancelRouterData> for CnpOnlineRequest {
capture: None,
void,
credit: None,
- query_transaction: None,
})
}
}
@@ -1215,89 +949,55 @@ impl<F>
) -> Result<Self, Self::Error> {
match (item.response.sale_response, item.response.authorization_response) {
(Some(sale_response), None) => {
- let status = get_attempt_status(WorldpayvantivPaymentFlow::Sale, sale_response.response_code)?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: sale_response.response_code.to_string(),
- message: sale_response.message.clone(),
- reason: Some(sale_response.message.clone()),
- status_code: item.http_code,
- attempt_status: None,
- connector_transaction_id: Some(sale_response.order_id),
- network_advice_code: None,
- network_decline_code: None,
- network_error_message: None,
- }),
- ..item.data
- })
- } else {
let report_group = WorldpayvantivPaymentMetadata {
report_group: Some(sale_response.report_group.clone()),
};
let connector_metadata = Some(report_group.encode_to_value()
.change_context(errors::ConnectorError::ResponseHandlingFailed)?);
+ let network_txn_id = sale_response.network_transaction_id.map(|network_transaction_id| network_transaction_id.expose());
+
Ok(Self {
- status,
+ status: common_enums::AttemptStatus::Pending,
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(sale_response.cnp_txn_id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata,
- network_txn_id: None,
+ network_txn_id,
connector_response_reference_id: Some(sale_response.order_id),
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
- }
},
(None, Some(auth_response)) => {
- let status = get_attempt_status(WorldpayvantivPaymentFlow::Auth, auth_response.response_code)?;
- if connector_utils::is_payment_failure(status) {
- Ok(Self {
- status,
- response: Err(ErrorResponse {
- code: auth_response.response_code.to_string(),
- message: auth_response.message.clone(),
- reason: Some(auth_response.message.clone()),
- status_code: item.http_code,
- attempt_status: None,
- connector_transaction_id: Some(auth_response.order_id),
- network_advice_code: None,
- network_decline_code: None,
- network_error_message: None,
- }),
- ..item.data
- })
- } else {
let report_group = WorldpayvantivPaymentMetadata {
report_group: Some(auth_response.report_group.clone()),
};
let connector_metadata = Some(report_group.encode_to_value()
.change_context(errors::ConnectorError::ResponseHandlingFailed)?);
+ let network_txn_id = auth_response.network_transaction_id.map(|network_transaction_id| network_transaction_id.expose());
+
Ok(Self {
- status,
+ status: common_enums::AttemptStatus::Authorizing,
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(auth_response.cnp_txn_id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata,
- network_txn_id: None,
+ network_txn_id,
connector_response_reference_id: Some(auth_response.order_id),
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
- }
},
- (None, None) => { Ok(Self {
- status: common_enums::AttemptStatus::Failure,
+ (None, None) => { // Incase of API failure
+ Ok(Self {status: common_enums::AttemptStatus::Failure,
response: Err(ErrorResponse {
code: item.response.response_code.clone(),
message: item.response.message.clone(),
@@ -1319,1355 +1019,89 @@ impl<F>
}
}
-impl TryFrom<RefundsResponseRouterData<RSync, CnpOnlineResponse>> for RefundsRouterData<RSync> {
+impl TryFrom<RefundsResponseRouterData<RSync, VantivSyncResponse>> for RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<RSync, CnpOnlineResponse>,
+ item: RefundsResponseRouterData<RSync, VantivSyncResponse>,
) -> Result<Self, Self::Error> {
- match item
- .response
- .query_transaction_response
- .and_then(|query_transaction_response| {
- query_transaction_response
- .results
- .and_then(|results| results.first().cloned())
- }) {
- Some(results) => {
- if let Some(refund_response) = &results.credit_response {
- let refund_status = get_refund_status(refund_response.response)?;
- if connector_utils::is_refund_failure(refund_status) {
- Ok(Self {
- response: Err(ErrorResponse {
- code: refund_response.response.to_string(),
- message: refund_response.message.clone(),
- reason: Some(refund_response.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
- })
- } else {
- Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: item
- .data
- .request
- .connector_refund_id
- .clone()
- .ok_or(errors::ConnectorError::MissingConnectorRefundID)?,
- refund_status,
- }),
- ..item.data
- })
- }
- } else {
- Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: item
- .data
- .request
- .connector_refund_id
- .clone()
- .ok_or(errors::ConnectorError::MissingConnectorRefundID)?,
- refund_status: common_enums::RefundStatus::Pending,
- }),
- ..item.data
- })
- }
- }
- None => Ok(Self {
+ let refund_status = get_refund_status_for_rsync(item.response.payment_status)?;
+ if connector_utils::is_refund_failure(refund_status) {
+ let error_code = item
+ .response
+ .payment_detail
+ .as_ref()
+ .and_then(|detail| detail.response_reason_code.clone())
+ .unwrap_or(consts::NO_ERROR_CODE.to_string());
+ let error_message = item
+ .response
+ .payment_detail
+ .as_ref()
+ .and_then(|detail| detail.response_reason_message.clone())
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string());
+
+ Ok(Self {
+ response: Err(ErrorResponse {
+ code: error_code.clone(),
+ 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
+ })
+ } else {
+ Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item
- .data
- .request
- .connector_refund_id
- .clone()
- .ok_or(errors::ConnectorError::MissingConnectorRefundID)?,
- refund_status: common_enums::RefundStatus::Pending,
+ connector_refund_id: item.response.payment_id.to_string(),
+ refund_status,
}),
..item.data
- }),
+ })
}
}
}
-#[derive(Debug, strum::Display, Serialize, Deserialize, PartialEq, Clone, Copy)]
-pub enum WorldpayvantivResponseCode {
- #[serde(rename = "001")]
- TransactionReceived,
- #[serde(rename = "000")]
- Approved,
- #[serde(rename = "010")]
- PartiallyApproved,
- #[serde(rename = "011")]
- OfflineApproval,
- #[serde(rename = "013")]
- OfflineApprovalUnableToGoOnline,
- #[serde(rename = "014")]
- InquirySuccessful,
- #[serde(rename = "015")]
- PendingShopperCheckoutCompletion,
- #[serde(rename = "016")]
- ShopperCheckoutExpired,
- #[serde(rename = "100")]
- ProcessingNetworkUnavailable,
- #[serde(rename = "101")]
- IssuerUnavailable,
- #[serde(rename = "102")]
- ReSubmitTransaction,
- #[serde(rename = "103")]
- MerchantNotConfiguredForProcessingAtThisSite,
- #[serde(rename = "108")]
- TryAgainLater,
- #[serde(rename = "110")]
- InsufficientFunds,
- #[serde(rename = "111")]
- AuthorizationAmountHasAlreadyBeenDepleted,
- #[serde(rename = "112")]
- InsufficientFundsRetryAfter1Hour,
- #[serde(rename = "113")]
- InsufficientFundsRetryAfter24Hour,
- #[serde(rename = "114")]
- InsufficientFundsRetryAfter2Days,
- #[serde(rename = "115")]
- InsufficientFundsRetryAfter4Days,
- #[serde(rename = "116")]
- InsufficientFundsRetryAfter6Days,
- #[serde(rename = "117")]
- InsufficientFundsRetryAfter8Days,
- #[serde(rename = "118")]
- InsufficientFundsRetryAfter10Days,
- #[serde(rename = "120")]
- CallIssuer,
- #[serde(rename = "121")]
- CallAmex,
- #[serde(rename = "122")]
- CallDinersClub,
- #[serde(rename = "123")]
- CallDiscover,
- #[serde(rename = "124")]
- CallJbs,
- #[serde(rename = "125")]
- CallVisaMastercard,
- #[serde(rename = "126")]
- CallIssuerUpdateCardholderData,
- #[serde(rename = "127")]
- ExceedsApprovalAmountLimit,
- #[serde(rename = "130")]
- CallIndicatedNumber,
- #[serde(rename = "131")]
- UnacceptablePinTransactionDeclinedRetry,
- #[serde(rename = "132")]
- PinNotChanged,
- #[serde(rename = "137")]
- ConsumerMultiUseVirtualCardNumberSoftDecline,
- #[serde(rename = "138")]
- ConsumerNonReloadablePrepaidCardSoftDecline,
- #[serde(rename = "139")]
- ConsumerSingleUseVirtualCardNumberSoftDecline,
- #[serde(rename = "140")]
- UpdateCardholderData,
- #[serde(rename = "141")]
- ConsumerNonReloadablePrepaidCardApproved,
- #[serde(rename = "142")]
- ConsumerSingleUseVirtualCardNumberApproved,
- #[serde(rename = "143")]
- MerchantDoesntQualifyForProductCode,
- #[serde(rename = "145")]
- Lifecycle,
- #[serde(rename = "146")]
- Policy,
- #[serde(rename = "147")]
- FraudSecurity,
- #[serde(rename = "148")]
- InvalidOrExpiredCardContactCardholderToUpdate,
- #[serde(rename = "149")]
- InvalidTransactionOrCardRestrictionVerifyInformationAndResubmit,
- #[serde(rename = "150")]
- OriginalTransactionFound,
- #[serde(rename = "151")]
- OriginalTransactionNotFound,
- #[serde(rename = "152")]
- OriginalTransactionFoundButResponseNotYetAvailable,
- #[serde(rename = "153")]
- QueryTransactionNotEnabled,
- #[serde(rename = "154")]
- AtLeastOneOfOrigIdOrOrigCnpTxnIdIsRequired,
- #[serde(rename = "155")]
- OrigCnpTxnIdIsRequiredWhenShowStatusOnlyIsUsed,
- #[serde(rename = "156")]
- IncrementalAuthNotSupported,
- #[serde(rename = "157")]
- SetAuthIndicatorToIncremental,
- #[serde(rename = "158")]
- IncrementalValueForAuthIndicatorNotAllowedInThisAuthStructure,
- #[serde(rename = "159")]
- CannotRequestAnIncrementalAuthIfOriginalAuthNotSetToEstimated,
- #[serde(rename = "161")]
- TransactionMustReferenceTheEstimatedAuth,
- #[serde(rename = "162")]
- IncrementedAuthExceedsMaxTransactionAmount,
- #[serde(rename = "170")]
- SubmittedMccNotAllowed,
- #[serde(rename = "191")]
- TheMerchantIsNotRegisteredInTheUpdateProgram,
- #[serde(rename = "192")]
- MerchantNotCertifiedEnabledForIias,
- #[serde(rename = "206")]
- IssuerGeneratedError,
- #[serde(rename = "207")]
- PickupCardOtherThanLostStolen,
- #[serde(rename = "209")]
- InvalidAmountHardDecline,
- #[serde(rename = "211")]
- ReversalUnsuccessful,
- #[serde(rename = "212")]
- MissingData,
- #[serde(rename = "213")]
- PickupCardLostCard,
- #[serde(rename = "214")]
- PickupCardStolenCard,
- #[serde(rename = "215")]
- RestrictedCard,
- #[serde(rename = "216")]
- InvalidDeactivate,
- #[serde(rename = "217")]
- CardAlreadyActive,
- #[serde(rename = "218")]
- CardNotActive,
- #[serde(rename = "219")]
- CardAlreadyDeactivate,
- #[serde(rename = "221")]
- OverMaxBalance,
- #[serde(rename = "222")]
- InvalidActivate,
- #[serde(rename = "223")]
- NoTransactionFoundForReversal,
- #[serde(rename = "226")]
- IncorrectCvv,
- #[serde(rename = "229")]
- IllegalTransaction,
- #[serde(rename = "251")]
- DuplicateTransaction,
- #[serde(rename = "252")]
- SystemError,
- #[serde(rename = "253")]
- DeconvertedBin,
- #[serde(rename = "254")]
- MerchantDepleted,
- #[serde(rename = "255")]
- GiftCardEscheated,
- #[serde(rename = "256")]
- InvalidReversalTypeForCreditCardTransaction,
- #[serde(rename = "257")]
- SystemErrorMessageFormatError,
- #[serde(rename = "258")]
- SystemErrorCannotProcess,
- #[serde(rename = "271")]
- RefundRejectedDueToPendingDepositStatus,
- #[serde(rename = "272")]
- RefundRejectedDueToDeclinedDepositStatus,
- #[serde(rename = "273")]
- RefundRejectedByTheProcessingNetwork,
- #[serde(rename = "284")]
- CaptureCreditAndAuthReversalTagsCannotBeUsedForGiftCardTransactions,
- #[serde(rename = "301")]
- InvalidAccountNumber,
- #[serde(rename = "302")]
- AccountNumberDoesNotMatchPaymentType,
- #[serde(rename = "303")]
- PickUpCard,
- #[serde(rename = "304")]
- LostStolenCard,
- #[serde(rename = "305")]
- ExpiredCard,
- #[serde(rename = "306")]
- AuthorizationHasExpiredNoNeedToReverse,
- #[serde(rename = "307")]
- RestrictedCardSoftDecline,
- #[serde(rename = "308")]
- RestrictedCardChargeback,
- #[serde(rename = "309")]
- RestrictedCardPrepaidCardFilteringService,
- #[serde(rename = "310")]
- InvalidTrackData,
- #[serde(rename = "311")]
- DepositIsAlreadyReferencedByAChargeback,
- #[serde(rename = "312")]
- RestrictedCardInternationalCardFilteringService,
- #[serde(rename = "313")]
- InternationalFilteringForIssuingCardCountry,
- #[serde(rename = "315")]
- RestrictedCardAuthFraudVelocityFilteringService,
- #[serde(rename = "316")]
- AutomaticRefundAlreadyIssued,
- #[serde(rename = "317")]
- RestrictedCardCardUnderSanction,
- #[serde(rename = "318")]
- RestrictedCardAuthFraudAdviceFilteringService,
- #[serde(rename = "319")]
- RestrictedCardFraudAvsFilteringService,
- #[serde(rename = "320")]
- InvalidExpirationDate,
- #[serde(rename = "321")]
- InvalidMerchant,
- #[serde(rename = "322")]
- InvalidTransaction,
- #[serde(rename = "323")]
- NoSuchIssuer,
- #[serde(rename = "324")]
- InvalidPin,
- #[serde(rename = "325")]
- TransactionNotAllowedAtTerminal,
- #[serde(rename = "326")]
- ExceedsNumberOfPinEntries,
- #[serde(rename = "327")]
- CardholderTransactionNotPermitted,
- #[serde(rename = "328")]
- CardholderRequestedThatRecurringOrInstallmentPaymentBeStopped,
- #[serde(rename = "330")]
- InvalidPaymentType,
- #[serde(rename = "331")]
- InvalidPosCapabilityForCardholderAuthorizedTerminalTransaction,
- #[serde(rename = "332")]
- InvalidPosCardholderIdForCardholderAuthorizedTerminalTransaction,
- #[serde(rename = "335")]
- ThisMethodOfPaymentDoesNotSupportAuthorizationReversals,
- #[serde(rename = "336")]
- ReversalAmountDoesNotMatchAuthorizationAmount,
- #[serde(rename = "337")]
- TransactionDidNotConvertToPinless,
- #[serde(rename = "340")]
- InvalidAmountSoftDecline,
- #[serde(rename = "341")]
- InvalidHealthcareAmounts,
- #[serde(rename = "346")]
- InvalidBillingDescriptorPrefix,
- #[serde(rename = "347")]
- InvalidBillingDescriptor,
- #[serde(rename = "348")]
- InvalidReportGroup,
- #[serde(rename = "349")]
- DoNotHonor,
- #[serde(rename = "350")]
- GenericDecline, // Soft or Hard Decline
- #[serde(rename = "351")]
- DeclineRequestPositiveId,
- #[serde(rename = "352")]
- DeclineCvv2CidFail,
- #[serde(rename = "354")]
- ThreeDSecureTransactionNotSupportedByMerchant,
- #[serde(rename = "356")]
- InvalidPurchaseLevelIiiTheTransactionContainedBadOrMissingData,
- #[serde(rename = "357")]
- MissingHealthcareIiasTagForAnFsaTransaction,
- #[serde(rename = "358")]
- RestrictedByVantivDueToSecurityCodeMismatch,
- #[serde(rename = "360")]
- NoTransactionFoundWithSpecifiedTransactionId,
- #[serde(rename = "361")]
- AuthorizationNoLongerAvailable,
- #[serde(rename = "362")]
- TransactionNotVoidedAlreadySettled,
- #[serde(rename = "363")]
- AutoVoidOnRefund,
- #[serde(rename = "364")]
- InvalidAccountNumberOriginalOrNocUpdatedECheckAccountRequired,
- #[serde(rename = "365")]
- TotalCreditAmountExceedsCaptureAmount,
- #[serde(rename = "366")]
- ExceedTheThresholdForSendingRedeposits,
- #[serde(rename = "367")]
- DepositHasNotBeenReturnedForInsufficientNonSufficientFunds,
- #[serde(rename = "368")]
- InvalidCheckNumber,
- #[serde(rename = "369")]
- RedepositAgainstInvalidTransactionType,
- #[serde(rename = "370")]
- InternalSystemErrorCallVantiv,
- #[serde(rename = "371")]
- OriginalTransactionHasBeenProcessedFutureRedepositsCanceled,
- #[serde(rename = "372")]
- SoftDeclineAutoRecyclingInProgress,
- #[serde(rename = "373")]
- HardDeclineAutoRecyclingComplete,
- #[serde(rename = "375")]
- MerchantIsNotEnabledForSurcharging,
- #[serde(rename = "376")]
- ThisMethodOfPaymentDoesNotSupportSurcharging,
- #[serde(rename = "377")]
- SurchargeIsNotValidForDebitOrPrepaidCards,
- #[serde(rename = "378")]
- SurchargeCannotExceedsTheMaximumAllowedLimit,
- #[serde(rename = "379")]
- TransactionDeclinedByTheProcessingNetwork,
- #[serde(rename = "380")]
- SecondaryAmountCannotExceedTheSaleAmount,
- #[serde(rename = "381")]
- ThisMethodOfPaymentDoesNotSupportSecondaryAmount,
- #[serde(rename = "382")]
- SecondaryAmountCannotBeLessThanZero,
- #[serde(rename = "383")]
- PartialTransactionIsNotSupportedWhenIncludingASecondaryAmount,
- #[serde(rename = "384")]
- SecondaryAmountRequiredOnPartialRefundWhenUsedOnDeposit,
- #[serde(rename = "385")]
- SecondaryAmountNotAllowedOnRefundIfNotIncludedOnDeposit,
- #[serde(rename = "386")]
- ProcessingNetworkError,
- #[serde(rename = "401")]
- InvalidEMail,
- #[serde(rename = "466")]
- InvalidCombinationOfAccountFundingTransactionTypeAndMcc,
- #[serde(rename = "467")]
- InvalidAccountFundingTransactionTypeForThisMethodOfPayment,
- #[serde(rename = "468")]
- MissingOneOrMoreReceiverFieldsForAccountFundingTransaction,
- #[serde(rename = "469")]
- InvalidRecurringRequestSeeRecurringResponseForDetails,
- #[serde(rename = "470")]
- ApprovedRecurringSubscriptionCreated,
- #[serde(rename = "471")]
- ParentTransactionDeclinedRecurringSubscriptionNotCreated,
- #[serde(rename = "472")]
- InvalidPlanCode,
- #[serde(rename = "473")]
- ScheduledRecurringPaymentProcessed,
- #[serde(rename = "475")]
- InvalidSubscriptionId,
- #[serde(rename = "476")]
- AddOnCodeAlreadyExists,
- #[serde(rename = "477")]
- DuplicateAddOnCodesInRequests,
- #[serde(rename = "478")]
- NoMatchingAddOnCodeForTheSubscription,
- #[serde(rename = "480")]
- NoMatchingDiscountCodeForTheSubscription,
- #[serde(rename = "481")]
- DuplicateDiscountCodesInRequest,
- #[serde(rename = "482")]
- InvalidStartDate,
- #[serde(rename = "483")]
- MerchantNotRegisteredForRecurringEngine,
- #[serde(rename = "484")]
- InsufficientDataToUpdateSubscription,
- #[serde(rename = "485")]
- InvalidBillingDate,
- #[serde(rename = "486")]
- DiscountCodeAlreadyExists,
- #[serde(rename = "487")]
- PlanCodeAlreadyExists,
- #[serde(rename = "500")]
- TheAccountNumberWasChanged,
- #[serde(rename = "501")]
- TheAccountWasClosed,
- #[serde(rename = "502")]
- TheExpirationDateWasChanged,
- #[serde(rename = "503")]
- TheIssuingBankDoesNotParticipateInTheUpdateProgram,
- #[serde(rename = "504")]
- ContactTheCardholderForUpdatedInformation,
- #[serde(rename = "505")]
- NoMatchFound,
- #[serde(rename = "506")]
- NoChangesFound,
- #[serde(rename = "507")]
- TheCardholderHasOptedOutOfTheUpdateProgram,
- #[serde(rename = "521")]
- SoftDeclineCardReaderDecryptionServiceIsNotAvailable,
- #[serde(rename = "523")]
- SoftDeclineDecryptionFailed,
- #[serde(rename = "524")]
- HardDeclineInputDataIsInvalid,
- #[serde(rename = "530")]
- ApplePayKeyMismatch,
- #[serde(rename = "531")]
- ApplePayDecryptionFailed,
- #[serde(rename = "540")]
- HardDeclineDecryptionFailed,
- #[serde(rename = "550")]
- AdvancedFraudFilterScoreBelowThreshold,
- #[serde(rename = "555")]
- SuspectedFraud,
- #[serde(rename = "560")]
- SystemErrorContactWorldpayRepresentative,
- #[serde(rename = "561")]
- AmazonPayAmazonUnavailable,
- #[serde(rename = "562")]
- AmazonPayAmazonDeclined,
- #[serde(rename = "563")]
- AmazonPayInvalidToken,
- #[serde(rename = "564")]
- MerchantNotEnabledForAmazonPay,
- #[serde(rename = "565")]
- TransactionNotSupportedBlockedByIssuer,
- #[serde(rename = "566")]
- BlockedByCardholderContactCardholder,
- #[serde(rename = "601")]
- SoftDeclinePrimaryFundingSourceFailed,
- #[serde(rename = "602")]
- SoftDeclineBuyerHasAlternateFundingSource,
- #[serde(rename = "610")]
- HardDeclineInvalidBillingAgreementId,
- #[serde(rename = "611")]
- HardDeclinePrimaryFundingSourceFailed,
- #[serde(rename = "612")]
- HardDeclineIssueWithPaypalAccount,
- #[serde(rename = "613")]
- HardDeclinePayPalAuthorizationIdMissing,
- #[serde(rename = "614")]
- HardDeclineConfirmedEmailAddressIsNotAvailable,
- #[serde(rename = "615")]
- HardDeclinePayPalBuyerAccountDenied,
- #[serde(rename = "616")]
- HardDeclinePayPalBuyerAccountRestricted,
- #[serde(rename = "617")]
- HardDeclinePayPalOrderHasBeenVoidedExpiredOrCompleted,
- #[serde(rename = "618")]
- HardDeclineIssueWithPayPalRefund,
- #[serde(rename = "619")]
- HardDeclinePayPalCredentialsIssue,
- #[serde(rename = "620")]
- HardDeclinePayPalAuthorizationVoidedOrExpired,
- #[serde(rename = "621")]
- HardDeclineRequiredPayPalParameterMissing,
- #[serde(rename = "622")]
- HardDeclinePayPalTransactionIdOrAuthIdIsInvalid,
- #[serde(rename = "623")]
- HardDeclineExceededMaximumNumberOfPayPalAuthorizationAttempts,
- #[serde(rename = "624")]
- HardDeclineTransactionAmountExceedsMerchantsPayPalAccountLimit,
- #[serde(rename = "625")]
- HardDeclinePayPalFundingSourcesUnavailable,
- #[serde(rename = "626")]
- HardDeclineIssueWithPayPalPrimaryFundingSource,
- #[serde(rename = "627")]
- HardDeclinePayPalProfileDoesNotAllowThisTransactionType,
- #[serde(rename = "628")]
- InternalSystemErrorWithPayPalContactVantiv,
- #[serde(rename = "629")]
- HardDeclineContactPayPalConsumerForAnotherPaymentMethod,
- #[serde(rename = "637")]
- InvalidTerminalId,
- #[serde(rename = "640")]
- PinlessDebitProcessingNotSupportedForNonRecurringTransactions,
- #[serde(rename = "641")]
- PinlessDebitProcessingNotSupportedForPartialAuths,
- #[serde(rename = "642")]
- MerchantNotConfiguredForPinlessDebitProcessing,
- #[serde(rename = "651")]
- DeclineCustomerCancellation,
- #[serde(rename = "652")]
- DeclineReTryTransaction,
- #[serde(rename = "653")]
- DeclineUnableToLocateRecordOnFile,
- #[serde(rename = "654")]
- DeclineFileUpdateFieldEditError,
- #[serde(rename = "655")]
- RemoteFunctionUnknown,
- #[serde(rename = "656")]
- DeclinedExceedsWithdrawalFrequencyLimit,
- #[serde(rename = "657")]
- DeclineCardRecordNotAvailable,
- #[serde(rename = "658")]
- InvalidAuthorizationCode,
- #[serde(rename = "659")]
- ReconciliationError,
- #[serde(rename = "660")]
- PreferredDebitRoutingDenialCreditTransactionCanBeDebit,
- #[serde(rename = "661")]
- DeclinedCurrencyConversionCompleteNoAuthPerformed,
- #[serde(rename = "662")]
- DeclinedMultiCurrencyDccFail,
- #[serde(rename = "663")]
- DeclinedMultiCurrencyInvertFail,
- #[serde(rename = "664")]
- Invalid3DSecurePassword,
- #[serde(rename = "665")]
- InvalidSocialSecurityNumber,
- #[serde(rename = "666")]
- InvalidMothersMaidenName,
- #[serde(rename = "667")]
- EnrollmentInquiryDeclined,
- #[serde(rename = "668")]
- SocialSecurityNumberNotAvailable,
- #[serde(rename = "669")]
- MothersMaidenNameNotAvailable,
- #[serde(rename = "670")]
- PinAlreadyExistsOnDatabase,
- #[serde(rename = "701")]
- Under18YearsOld,
- #[serde(rename = "702")]
- BillToOutsideUsa,
- #[serde(rename = "703")]
- BillToAddressIsNotEqualToShipToAddress,
- #[serde(rename = "704")]
- DeclinedForeignCurrencyMustBeUsd,
- #[serde(rename = "705")]
- OnNegativeFile,
- #[serde(rename = "706")]
- BlockedAgreement,
- #[serde(rename = "707")]
- InsufficientBuyingPower, // Other
- #[serde(rename = "708")]
- InvalidData,
- #[serde(rename = "709")]
- InvalidDataDataElementsMissing,
- #[serde(rename = "710")]
- InvalidDataDataFormatError,
- #[serde(rename = "711")]
- InvalidDataInvalidTCVersion,
- #[serde(rename = "712")]
- DuplicateTransactionPaypalCredit,
- #[serde(rename = "713")]
- VerifyBillingAddress,
- #[serde(rename = "714")]
- InactiveAccount,
- #[serde(rename = "716")]
- InvalidAuth,
- #[serde(rename = "717")]
- AuthorizationAlreadyExistsForTheOrder,
- #[serde(rename = "730")]
- LodgingTransactionsAreNotAllowedForThisMcc,
- #[serde(rename = "731")]
- DurationCannotBeNegative,
- #[serde(rename = "732")]
- HotelFolioNumberCannotBeBlank,
- #[serde(rename = "733")]
- InvalidCheckInDate,
- #[serde(rename = "734")]
- InvalidCheckOutDate,
- #[serde(rename = "735")]
- InvalidCheckInOrCheckOutDate,
- #[serde(rename = "736")]
- CheckOutDateCannotBeBeforeCheckInDate,
- #[serde(rename = "737")]
- NumberOfAdultsCannotBeNegative,
- #[serde(rename = "738")]
- RoomRateCannotBeNegative,
- #[serde(rename = "739")]
- RoomTaxCannotBeNegative,
- #[serde(rename = "740")]
- DurationCanOnlyBeFrom0To99ForVisa,
- #[serde(rename = "801")]
- AccountNumberWasSuccessfullyRegistered,
- #[serde(rename = "802")]
- AccountNumberWasPreviouslyRegistered,
- #[serde(rename = "803")]
- ValidToken,
- #[serde(rename = "805")]
- CardValidationNumberUpdated,
- #[serde(rename = "820")]
- CreditCardNumberWasInvalid,
- #[serde(rename = "821")]
- MerchantIsNotAuthorizedForTokens,
- #[serde(rename = "822")]
- TokenWasNotFound,
- #[serde(rename = "823")]
- TokenInvalid,
- #[serde(rename = "825")]
- MerchantNotAuthorizedForECheckTokens,
- #[serde(rename = "826")]
- CheckoutIdWasInvalid,
- #[serde(rename = "827")]
- CheckoutIdWasNotFound,
- #[serde(rename = "828")]
- GenericCheckoutIdError,
- #[serde(rename = "835")]
- CaptureAmountCanNotBeMoreThanAuthorizedAmount,
- #[serde(rename = "850")]
- TaxBillingOnlyAllowedForMcc9311,
- #[serde(rename = "851")]
- Mcc9311RequiresTaxTypeElement,
- #[serde(rename = "852")]
- DebtRepaymentOnlyAllowedForViTransactionsOnMccs6012And6051,
- #[serde(rename = "861")]
- RoutingNumberDidNotMatchOneOnFileForToken,
- #[serde(rename = "877")]
- InvalidPayPageRegistrationId,
- #[serde(rename = "878")]
- ExpiredPayPageRegistrationId,
- #[serde(rename = "879")]
- MerchantIsNotAuthorizedForPayPage,
- #[serde(rename = "890")]
- MaximumNumberOfUpdatesForThisTokenExceeded,
- #[serde(rename = "891")]
- TooManyTokensCreatedForExistingNamespace,
- #[serde(rename = "895")]
- PinValidationNotPossible,
- #[serde(rename = "898")]
- GenericTokenRegistrationError,
- #[serde(rename = "899")]
- GenericTokenUseError,
- #[serde(rename = "900")]
- InvalidBankRoutingNumber,
- #[serde(rename = "901")]
- MissingName,
- #[serde(rename = "902")]
- InvalidName,
- #[serde(rename = "903")]
- MissingBillingCountryCode,
- #[serde(rename = "904")]
- InvalidIban,
- #[serde(rename = "905")]
- MissingEmailAddress,
- #[serde(rename = "906")]
- MissingMandateReference,
- #[serde(rename = "907")]
- InvalidMandateReference,
- #[serde(rename = "908")]
- MissingMandateUrl,
- #[serde(rename = "909")]
- InvalidMandateUrl,
- #[serde(rename = "911")]
- MissingMandateSignatureDate,
- #[serde(rename = "912")]
- InvalidMandateSignatureDate,
- #[serde(rename = "913")]
- RecurringMandateAlreadyExists,
- #[serde(rename = "914")]
- RecurringMandateWasNotFound,
- #[serde(rename = "915")]
- FinalRecurringWasAlreadyReceivedUsingThisMandate,
- #[serde(rename = "916")]
- IbanDidNotMatchOneOnFileForMandate,
- #[serde(rename = "917")]
- InvalidBillingCountry,
- #[serde(rename = "922")]
- ExpirationDateRequiredForInteracTransaction,
- #[serde(rename = "923")]
- TransactionTypeIsNotSupportedWithThisMethodOfPayment,
- #[serde(rename = "924")]
- UnreferencedOrphanRefundsAreNotAllowed,
- #[serde(rename = "939")]
- UnableToVoidATransactionWithAHeldState,
- #[serde(rename = "940")]
- ThisFundingInstructionResultsInANegativeAccountBalance,
- #[serde(rename = "941")]
- AccountBalanceInformationUnavailableAtThisTime,
- #[serde(rename = "942")]
- TheSubmittedCardIsNotEligibleForFastAccessFunding,
- #[serde(rename = "943")]
- TransactionCannotUseBothCcdPaymentInformationAndCtxPaymentInformation,
- #[serde(rename = "944")]
- ProcessingError,
- #[serde(rename = "945")]
- ThisFundingInstructionTypeIsInvalidForCanadianMerchants,
- #[serde(rename = "946")]
- CtxAndCcdRecordsAreNotAllowedForCanadianMerchants,
- #[serde(rename = "947")]
- CanadianAccountNumberCannotExceed12Digits,
- #[serde(rename = "948")]
- ThisFundingInstructionTypeIsInvalid,
- #[serde(rename = "950")]
- DeclineNegativeInformationOnFile,
- #[serde(rename = "951")]
- AbsoluteDecline,
- #[serde(rename = "952")]
- TheMerchantProfileDoesNotAllowTheRequestedOperation,
- #[serde(rename = "953")]
- TheAccountCannotAcceptAchTransactions,
- #[serde(rename = "954")]
- TheAccountCannotAcceptAchTransactionsOrSiteDrafts,
- #[serde(rename = "955")]
- AmountGreaterThanLimitSpecifiedInTheMerchantProfile,
- #[serde(rename = "956")]
- MerchantIsNotAuthorizedToPerformECheckVerificationTransactions,
- #[serde(rename = "957")]
- FirstNameAndLastNameRequiredForECheckVerifications,
- #[serde(rename = "958")]
- CompanyNameRequiredForCorporateAccountForECheckVerifications,
- #[serde(rename = "959")]
- PhoneNumberRequiredForECheckVerifications,
- #[serde(rename = "961")]
- CardBrandTokenNotSupported,
- #[serde(rename = "962")]
- PrivateLabelCardNotSupported,
- #[serde(rename = "965")]
- AllowedDailyDirectDebitCaptureECheckSaleLimitExceeded,
- #[serde(rename = "966")]
- AllowedDailyDirectDebitCreditECheckCreditLimitExceeded,
- #[serde(rename = "973")]
- AccountNotEligibleForRtp,
- #[serde(rename = "980")]
- SoftDeclineCustomerAuthenticationRequired,
- #[serde(rename = "981")]
- TransactionNotReversedVoidWorkflowNeedToBeInvoked,
- #[serde(rename = "982")]
- TransactionReversalNotSupportedForTheCoreMerchants,
- #[serde(rename = "983")]
- NoValidParentDepositOrParentRefundFound,
- #[serde(rename = "984")]
- TransactionReversalNotEnabledForVisa,
- #[serde(rename = "985")]
- TransactionReversalNotEnabledForMastercard,
- #[serde(rename = "986")]
- TransactionReversalNotEnabledForAmEx,
- #[serde(rename = "987")]
- TransactionReversalNotEnabledForDiscover,
- #[serde(rename = "988")]
- TransactionReversalNotSupported,
- #[serde(rename = "990")]
- FundingInstructionHeldPleaseContactYourRelationshipManager,
- #[serde(rename = "991")]
- MissingAddressInformation,
- #[serde(rename = "992")]
- CryptographicFailure,
- #[serde(rename = "993")]
- InvalidRegionCode,
- #[serde(rename = "994")]
- InvalidCountryCode,
- #[serde(rename = "995")]
- InvalidCreditAccount,
- #[serde(rename = "996")]
- InvalidCheckingAccount,
- #[serde(rename = "997")]
- InvalidSavingsAccount,
- #[serde(rename = "998")]
- InvalidUseOfMccCorrectAndReattempt,
- #[serde(rename = "999")]
- ExceedsRtpTransactionLimit,
-}
-
-#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy)]
-pub enum WorldpayvantivPaymentFlow {
- Sale,
- Auth,
- Capture,
- Void,
-}
-
-fn get_attempt_status(
- flow: WorldpayvantivPaymentFlow,
- response: WorldpayvantivResponseCode,
+fn get_attempt_status_for_psync(
+ vantiv_status: PaymentStatus,
+ previous_status: common_enums::AttemptStatus,
) -> Result<common_enums::AttemptStatus, errors::ConnectorError> {
- match response {
- WorldpayvantivResponseCode::Approved
- | WorldpayvantivResponseCode::PartiallyApproved
- | WorldpayvantivResponseCode::OfflineApproval
- | WorldpayvantivResponseCode::OfflineApprovalUnableToGoOnline
- | WorldpayvantivResponseCode::ConsumerNonReloadablePrepaidCardApproved
- | WorldpayvantivResponseCode::ConsumerSingleUseVirtualCardNumberApproved
- | WorldpayvantivResponseCode::ScheduledRecurringPaymentProcessed
- | WorldpayvantivResponseCode::ApprovedRecurringSubscriptionCreated
- => match flow {
- WorldpayvantivPaymentFlow::Sale => Ok(common_enums::AttemptStatus::Charged),
- WorldpayvantivPaymentFlow::Auth => Ok(common_enums::AttemptStatus::Authorized),
- WorldpayvantivPaymentFlow::Capture => Ok(common_enums::AttemptStatus::Charged),
- WorldpayvantivPaymentFlow::Void => Ok(common_enums::AttemptStatus::Voided),
- }
- WorldpayvantivResponseCode::PendingShopperCheckoutCompletion
- | WorldpayvantivResponseCode::TransactionReceived => {
- Ok(common_enums::AttemptStatus::Pending)
- }
-
- WorldpayvantivResponseCode::ShopperCheckoutExpired
- | WorldpayvantivResponseCode::ProcessingNetworkUnavailable
- | WorldpayvantivResponseCode::IssuerUnavailable
- | WorldpayvantivResponseCode::ReSubmitTransaction
- | WorldpayvantivResponseCode::TryAgainLater
- | WorldpayvantivResponseCode::InsufficientFunds
- | WorldpayvantivResponseCode::AuthorizationAmountHasAlreadyBeenDepleted
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter1Hour
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter24Hour
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter2Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter4Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter6Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter8Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter10Days
- | WorldpayvantivResponseCode::CallIssuer
- | WorldpayvantivResponseCode::CallAmex
- | WorldpayvantivResponseCode::CallDinersClub
- | WorldpayvantivResponseCode::CallDiscover
- | WorldpayvantivResponseCode::CallJbs
- | WorldpayvantivResponseCode::CallVisaMastercard
- | WorldpayvantivResponseCode::CallIssuerUpdateCardholderData
- | WorldpayvantivResponseCode::ExceedsApprovalAmountLimit
- | WorldpayvantivResponseCode::CallIndicatedNumber
- | WorldpayvantivResponseCode::UnacceptablePinTransactionDeclinedRetry
- | WorldpayvantivResponseCode::PinNotChanged
- | WorldpayvantivResponseCode::ConsumerMultiUseVirtualCardNumberSoftDecline
- | WorldpayvantivResponseCode::ConsumerNonReloadablePrepaidCardSoftDecline
- | WorldpayvantivResponseCode::ConsumerSingleUseVirtualCardNumberSoftDecline
- | WorldpayvantivResponseCode::UpdateCardholderData
- | WorldpayvantivResponseCode::MerchantDoesntQualifyForProductCode
- | WorldpayvantivResponseCode::Lifecycle
- | WorldpayvantivResponseCode::Policy
- | WorldpayvantivResponseCode::FraudSecurity
- | WorldpayvantivResponseCode::InvalidOrExpiredCardContactCardholderToUpdate
- | WorldpayvantivResponseCode::InvalidTransactionOrCardRestrictionVerifyInformationAndResubmit
- | WorldpayvantivResponseCode::AtLeastOneOfOrigIdOrOrigCnpTxnIdIsRequired
- | WorldpayvantivResponseCode::OrigCnpTxnIdIsRequiredWhenShowStatusOnlyIsUsed
- | WorldpayvantivResponseCode::IncrementalAuthNotSupported
- | WorldpayvantivResponseCode::SetAuthIndicatorToIncremental
- | WorldpayvantivResponseCode::IncrementalValueForAuthIndicatorNotAllowedInThisAuthStructure
- | WorldpayvantivResponseCode::CannotRequestAnIncrementalAuthIfOriginalAuthNotSetToEstimated
- | WorldpayvantivResponseCode::TransactionMustReferenceTheEstimatedAuth
- | WorldpayvantivResponseCode::IncrementedAuthExceedsMaxTransactionAmount
- | WorldpayvantivResponseCode::SubmittedMccNotAllowed
- | WorldpayvantivResponseCode::MerchantNotCertifiedEnabledForIias
- | WorldpayvantivResponseCode::IssuerGeneratedError
- | WorldpayvantivResponseCode::PickupCardOtherThanLostStolen
- | WorldpayvantivResponseCode::InvalidAmountHardDecline
- | WorldpayvantivResponseCode::ReversalUnsuccessful
- | WorldpayvantivResponseCode::MissingData
- | WorldpayvantivResponseCode::PickupCardLostCard
- | WorldpayvantivResponseCode::PickupCardStolenCard
- | WorldpayvantivResponseCode::RestrictedCard
- | WorldpayvantivResponseCode::InvalidDeactivate
- | WorldpayvantivResponseCode::CardAlreadyActive
- | WorldpayvantivResponseCode::CardNotActive
- | WorldpayvantivResponseCode::CardAlreadyDeactivate
- | WorldpayvantivResponseCode::OverMaxBalance
- | WorldpayvantivResponseCode::InvalidActivate
- | WorldpayvantivResponseCode::NoTransactionFoundForReversal
- | WorldpayvantivResponseCode::IncorrectCvv
- | WorldpayvantivResponseCode::IllegalTransaction
- | WorldpayvantivResponseCode::DuplicateTransaction
- | WorldpayvantivResponseCode::SystemError
- | WorldpayvantivResponseCode::DeconvertedBin
- | WorldpayvantivResponseCode::MerchantDepleted
- | WorldpayvantivResponseCode::GiftCardEscheated
- | WorldpayvantivResponseCode::InvalidReversalTypeForCreditCardTransaction
- | WorldpayvantivResponseCode::SystemErrorMessageFormatError
- | WorldpayvantivResponseCode::SystemErrorCannotProcess
- | WorldpayvantivResponseCode::RefundRejectedDueToPendingDepositStatus
- | WorldpayvantivResponseCode::RefundRejectedDueToDeclinedDepositStatus
- | WorldpayvantivResponseCode::RefundRejectedByTheProcessingNetwork
- | WorldpayvantivResponseCode::CaptureCreditAndAuthReversalTagsCannotBeUsedForGiftCardTransactions
- | WorldpayvantivResponseCode::InvalidAccountNumber
- | WorldpayvantivResponseCode::AccountNumberDoesNotMatchPaymentType
- | WorldpayvantivResponseCode::PickUpCard
- | WorldpayvantivResponseCode::LostStolenCard
- | WorldpayvantivResponseCode::ExpiredCard
- | WorldpayvantivResponseCode::AuthorizationHasExpiredNoNeedToReverse
- | WorldpayvantivResponseCode::RestrictedCardSoftDecline
- | WorldpayvantivResponseCode::RestrictedCardChargeback
- | WorldpayvantivResponseCode::RestrictedCardPrepaidCardFilteringService
- | WorldpayvantivResponseCode::InvalidTrackData
- | WorldpayvantivResponseCode::DepositIsAlreadyReferencedByAChargeback
- | WorldpayvantivResponseCode::RestrictedCardInternationalCardFilteringService
- | WorldpayvantivResponseCode::InternationalFilteringForIssuingCardCountry
- | WorldpayvantivResponseCode::RestrictedCardAuthFraudVelocityFilteringService
- | WorldpayvantivResponseCode::AutomaticRefundAlreadyIssued
- | WorldpayvantivResponseCode::RestrictedCardAuthFraudAdviceFilteringService
- | WorldpayvantivResponseCode::RestrictedCardFraudAvsFilteringService
- | WorldpayvantivResponseCode::InvalidExpirationDate
- | WorldpayvantivResponseCode::InvalidMerchant
- | WorldpayvantivResponseCode::InvalidTransaction
- | WorldpayvantivResponseCode::NoSuchIssuer
- | WorldpayvantivResponseCode::InvalidPin
- | WorldpayvantivResponseCode::TransactionNotAllowedAtTerminal
- | WorldpayvantivResponseCode::ExceedsNumberOfPinEntries
- | WorldpayvantivResponseCode::CardholderTransactionNotPermitted
- | WorldpayvantivResponseCode::CardholderRequestedThatRecurringOrInstallmentPaymentBeStopped
- | WorldpayvantivResponseCode::InvalidPaymentType
- | WorldpayvantivResponseCode::InvalidPosCapabilityForCardholderAuthorizedTerminalTransaction
- | WorldpayvantivResponseCode::InvalidPosCardholderIdForCardholderAuthorizedTerminalTransaction
- | WorldpayvantivResponseCode::ThisMethodOfPaymentDoesNotSupportAuthorizationReversals
- | WorldpayvantivResponseCode::ReversalAmountDoesNotMatchAuthorizationAmount
- | WorldpayvantivResponseCode::TransactionDidNotConvertToPinless
- | WorldpayvantivResponseCode::InvalidAmountSoftDecline
- | WorldpayvantivResponseCode::InvalidHealthcareAmounts
- | WorldpayvantivResponseCode::InvalidBillingDescriptorPrefix
- | WorldpayvantivResponseCode::InvalidBillingDescriptor
- | WorldpayvantivResponseCode::InvalidReportGroup
- | WorldpayvantivResponseCode::DoNotHonor
- | WorldpayvantivResponseCode::GenericDecline
- | WorldpayvantivResponseCode::DeclineRequestPositiveId
- | WorldpayvantivResponseCode::DeclineCvv2CidFail
- | WorldpayvantivResponseCode::ThreeDSecureTransactionNotSupportedByMerchant
- | WorldpayvantivResponseCode::InvalidPurchaseLevelIiiTheTransactionContainedBadOrMissingData
- | WorldpayvantivResponseCode::MissingHealthcareIiasTagForAnFsaTransaction
- | WorldpayvantivResponseCode::RestrictedByVantivDueToSecurityCodeMismatch
- | WorldpayvantivResponseCode::NoTransactionFoundWithSpecifiedTransactionId
- | WorldpayvantivResponseCode::AuthorizationNoLongerAvailable
- | WorldpayvantivResponseCode::TransactionNotVoidedAlreadySettled
- | WorldpayvantivResponseCode::AutoVoidOnRefund
- | WorldpayvantivResponseCode::InvalidAccountNumberOriginalOrNocUpdatedECheckAccountRequired
- | WorldpayvantivResponseCode::TotalCreditAmountExceedsCaptureAmount
- | WorldpayvantivResponseCode::ExceedTheThresholdForSendingRedeposits
- | WorldpayvantivResponseCode::DepositHasNotBeenReturnedForInsufficientNonSufficientFunds
- | WorldpayvantivResponseCode::InvalidCheckNumber
- | WorldpayvantivResponseCode::RedepositAgainstInvalidTransactionType
- | WorldpayvantivResponseCode::InternalSystemErrorCallVantiv
- | WorldpayvantivResponseCode::OriginalTransactionHasBeenProcessedFutureRedepositsCanceled
- | WorldpayvantivResponseCode::SoftDeclineAutoRecyclingInProgress
- | WorldpayvantivResponseCode::HardDeclineAutoRecyclingComplete
- | WorldpayvantivResponseCode::RestrictedCardCardUnderSanction
- | WorldpayvantivResponseCode::MerchantIsNotEnabledForSurcharging
- | WorldpayvantivResponseCode::ThisMethodOfPaymentDoesNotSupportSurcharging
- | WorldpayvantivResponseCode::SurchargeIsNotValidForDebitOrPrepaidCards
- | WorldpayvantivResponseCode::SurchargeCannotExceedsTheMaximumAllowedLimit
- | WorldpayvantivResponseCode::TransactionDeclinedByTheProcessingNetwork
- | WorldpayvantivResponseCode::SecondaryAmountCannotExceedTheSaleAmount
- | WorldpayvantivResponseCode::ThisMethodOfPaymentDoesNotSupportSecondaryAmount
- | WorldpayvantivResponseCode::SecondaryAmountCannotBeLessThanZero
- | WorldpayvantivResponseCode::PartialTransactionIsNotSupportedWhenIncludingASecondaryAmount
- | WorldpayvantivResponseCode::SecondaryAmountRequiredOnPartialRefundWhenUsedOnDeposit
- | WorldpayvantivResponseCode::SecondaryAmountNotAllowedOnRefundIfNotIncludedOnDeposit
- | WorldpayvantivResponseCode::ProcessingNetworkError
- | WorldpayvantivResponseCode::InvalidEMail
- | WorldpayvantivResponseCode::InvalidCombinationOfAccountFundingTransactionTypeAndMcc
- | WorldpayvantivResponseCode::InvalidAccountFundingTransactionTypeForThisMethodOfPayment
- | WorldpayvantivResponseCode::MissingOneOrMoreReceiverFieldsForAccountFundingTransaction
- | WorldpayvantivResponseCode::InvalidRecurringRequestSeeRecurringResponseForDetails
- | WorldpayvantivResponseCode::ParentTransactionDeclinedRecurringSubscriptionNotCreated
- | WorldpayvantivResponseCode::InvalidPlanCode
- | WorldpayvantivResponseCode::InvalidSubscriptionId
- | WorldpayvantivResponseCode::AddOnCodeAlreadyExists
- | WorldpayvantivResponseCode::DuplicateAddOnCodesInRequests
- | WorldpayvantivResponseCode::NoMatchingAddOnCodeForTheSubscription
- | WorldpayvantivResponseCode::NoMatchingDiscountCodeForTheSubscription
- | WorldpayvantivResponseCode::DuplicateDiscountCodesInRequest
- | WorldpayvantivResponseCode::InvalidStartDate
- | WorldpayvantivResponseCode::MerchantNotRegisteredForRecurringEngine
- | WorldpayvantivResponseCode::InsufficientDataToUpdateSubscription
- | WorldpayvantivResponseCode::InvalidBillingDate
- | WorldpayvantivResponseCode::DiscountCodeAlreadyExists
- | WorldpayvantivResponseCode::PlanCodeAlreadyExists
- | WorldpayvantivResponseCode::TheAccountNumberWasChanged
- | WorldpayvantivResponseCode::TheAccountWasClosed
- | WorldpayvantivResponseCode::TheExpirationDateWasChanged
- | WorldpayvantivResponseCode::TheIssuingBankDoesNotParticipateInTheUpdateProgram
- | WorldpayvantivResponseCode::ContactTheCardholderForUpdatedInformation
- | WorldpayvantivResponseCode::TheCardholderHasOptedOutOfTheUpdateProgram
- | WorldpayvantivResponseCode::SoftDeclineCardReaderDecryptionServiceIsNotAvailable
- | WorldpayvantivResponseCode::SoftDeclineDecryptionFailed
- | WorldpayvantivResponseCode::HardDeclineInputDataIsInvalid
- | WorldpayvantivResponseCode::ApplePayKeyMismatch
- | WorldpayvantivResponseCode::ApplePayDecryptionFailed
- | WorldpayvantivResponseCode::HardDeclineDecryptionFailed
- | WorldpayvantivResponseCode::MerchantNotConfiguredForProcessingAtThisSite
- | WorldpayvantivResponseCode::AdvancedFraudFilterScoreBelowThreshold
- | WorldpayvantivResponseCode::SuspectedFraud
- | WorldpayvantivResponseCode::SystemErrorContactWorldpayRepresentative
- | WorldpayvantivResponseCode::AmazonPayAmazonUnavailable
- | WorldpayvantivResponseCode::AmazonPayAmazonDeclined
- | WorldpayvantivResponseCode::AmazonPayInvalidToken
- | WorldpayvantivResponseCode::MerchantNotEnabledForAmazonPay
- | WorldpayvantivResponseCode::TransactionNotSupportedBlockedByIssuer
- | WorldpayvantivResponseCode::BlockedByCardholderContactCardholder
- | WorldpayvantivResponseCode::SoftDeclinePrimaryFundingSourceFailed
- | WorldpayvantivResponseCode::SoftDeclineBuyerHasAlternateFundingSource
- | WorldpayvantivResponseCode::HardDeclineInvalidBillingAgreementId
- | WorldpayvantivResponseCode::HardDeclinePrimaryFundingSourceFailed
- | WorldpayvantivResponseCode::HardDeclineIssueWithPaypalAccount
- | WorldpayvantivResponseCode::HardDeclinePayPalAuthorizationIdMissing
- | WorldpayvantivResponseCode::HardDeclineConfirmedEmailAddressIsNotAvailable
- | WorldpayvantivResponseCode::HardDeclinePayPalBuyerAccountDenied
- | WorldpayvantivResponseCode::HardDeclinePayPalBuyerAccountRestricted
- | WorldpayvantivResponseCode::HardDeclinePayPalOrderHasBeenVoidedExpiredOrCompleted
- | WorldpayvantivResponseCode::HardDeclineIssueWithPayPalRefund
- | WorldpayvantivResponseCode::HardDeclinePayPalCredentialsIssue
- | WorldpayvantivResponseCode::HardDeclinePayPalAuthorizationVoidedOrExpired
- | WorldpayvantivResponseCode::HardDeclineRequiredPayPalParameterMissing
- | WorldpayvantivResponseCode::HardDeclinePayPalTransactionIdOrAuthIdIsInvalid
- | WorldpayvantivResponseCode::HardDeclineExceededMaximumNumberOfPayPalAuthorizationAttempts
- | WorldpayvantivResponseCode::HardDeclineTransactionAmountExceedsMerchantsPayPalAccountLimit
- | WorldpayvantivResponseCode::HardDeclinePayPalFundingSourcesUnavailable
- | WorldpayvantivResponseCode::HardDeclineIssueWithPayPalPrimaryFundingSource
- | WorldpayvantivResponseCode::HardDeclinePayPalProfileDoesNotAllowThisTransactionType
- | WorldpayvantivResponseCode::InternalSystemErrorWithPayPalContactVantiv
- | WorldpayvantivResponseCode::HardDeclineContactPayPalConsumerForAnotherPaymentMethod
- | WorldpayvantivResponseCode::InvalidTerminalId
- | WorldpayvantivResponseCode::PinlessDebitProcessingNotSupportedForNonRecurringTransactions
- | WorldpayvantivResponseCode::PinlessDebitProcessingNotSupportedForPartialAuths
- | WorldpayvantivResponseCode::MerchantNotConfiguredForPinlessDebitProcessing
- | WorldpayvantivResponseCode::DeclineCustomerCancellation
- | WorldpayvantivResponseCode::DeclineReTryTransaction
- | WorldpayvantivResponseCode::DeclineUnableToLocateRecordOnFile
- | WorldpayvantivResponseCode::DeclineFileUpdateFieldEditError
- | WorldpayvantivResponseCode::RemoteFunctionUnknown
- | WorldpayvantivResponseCode::DeclinedExceedsWithdrawalFrequencyLimit
- | WorldpayvantivResponseCode::DeclineCardRecordNotAvailable
- | WorldpayvantivResponseCode::InvalidAuthorizationCode
- | WorldpayvantivResponseCode::ReconciliationError
- | WorldpayvantivResponseCode::PreferredDebitRoutingDenialCreditTransactionCanBeDebit
- | WorldpayvantivResponseCode::DeclinedCurrencyConversionCompleteNoAuthPerformed
- | WorldpayvantivResponseCode::DeclinedMultiCurrencyDccFail
- | WorldpayvantivResponseCode::DeclinedMultiCurrencyInvertFail
- | WorldpayvantivResponseCode::Invalid3DSecurePassword
- | WorldpayvantivResponseCode::InvalidSocialSecurityNumber
- | WorldpayvantivResponseCode::InvalidMothersMaidenName
- | WorldpayvantivResponseCode::EnrollmentInquiryDeclined
- | WorldpayvantivResponseCode::SocialSecurityNumberNotAvailable
- | WorldpayvantivResponseCode::MothersMaidenNameNotAvailable
- | WorldpayvantivResponseCode::PinAlreadyExistsOnDatabase
- | WorldpayvantivResponseCode::Under18YearsOld
- | WorldpayvantivResponseCode::BillToOutsideUsa
- | WorldpayvantivResponseCode::BillToAddressIsNotEqualToShipToAddress
- | WorldpayvantivResponseCode::DeclinedForeignCurrencyMustBeUsd
- | WorldpayvantivResponseCode::OnNegativeFile
- | WorldpayvantivResponseCode::BlockedAgreement
- | WorldpayvantivResponseCode::InsufficientBuyingPower
- | WorldpayvantivResponseCode::InvalidData
- | WorldpayvantivResponseCode::InvalidDataDataElementsMissing
- | WorldpayvantivResponseCode::InvalidDataDataFormatError
- | WorldpayvantivResponseCode::InvalidDataInvalidTCVersion
- | WorldpayvantivResponseCode::DuplicateTransactionPaypalCredit
- | WorldpayvantivResponseCode::VerifyBillingAddress
- | WorldpayvantivResponseCode::InactiveAccount
- | WorldpayvantivResponseCode::InvalidAuth
- | WorldpayvantivResponseCode::AuthorizationAlreadyExistsForTheOrder
- | WorldpayvantivResponseCode::LodgingTransactionsAreNotAllowedForThisMcc
- | WorldpayvantivResponseCode::DurationCannotBeNegative
- | WorldpayvantivResponseCode::HotelFolioNumberCannotBeBlank
- | WorldpayvantivResponseCode::InvalidCheckInDate
- | WorldpayvantivResponseCode::InvalidCheckOutDate
- | WorldpayvantivResponseCode::InvalidCheckInOrCheckOutDate
- | WorldpayvantivResponseCode::CheckOutDateCannotBeBeforeCheckInDate
- | WorldpayvantivResponseCode::NumberOfAdultsCannotBeNegative
- | WorldpayvantivResponseCode::RoomRateCannotBeNegative
- | WorldpayvantivResponseCode::RoomTaxCannotBeNegative
- | WorldpayvantivResponseCode::DurationCanOnlyBeFrom0To99ForVisa
- | WorldpayvantivResponseCode::MerchantIsNotAuthorizedForTokens
- | WorldpayvantivResponseCode::CreditCardNumberWasInvalid
- | WorldpayvantivResponseCode::TokenWasNotFound
- | WorldpayvantivResponseCode::TokenInvalid
- | WorldpayvantivResponseCode::MerchantNotAuthorizedForECheckTokens
- | WorldpayvantivResponseCode::CheckoutIdWasInvalid
- | WorldpayvantivResponseCode::CheckoutIdWasNotFound
- | WorldpayvantivResponseCode::GenericCheckoutIdError
- | WorldpayvantivResponseCode::CaptureAmountCanNotBeMoreThanAuthorizedAmount
- | WorldpayvantivResponseCode::TaxBillingOnlyAllowedForMcc9311
- | WorldpayvantivResponseCode::Mcc9311RequiresTaxTypeElement
- | WorldpayvantivResponseCode::DebtRepaymentOnlyAllowedForViTransactionsOnMccs6012And6051
- | WorldpayvantivResponseCode::RoutingNumberDidNotMatchOneOnFileForToken
- | WorldpayvantivResponseCode::InvalidPayPageRegistrationId
- | WorldpayvantivResponseCode::ExpiredPayPageRegistrationId
- | WorldpayvantivResponseCode::MerchantIsNotAuthorizedForPayPage
- | WorldpayvantivResponseCode::MaximumNumberOfUpdatesForThisTokenExceeded
- | WorldpayvantivResponseCode::TooManyTokensCreatedForExistingNamespace
- | WorldpayvantivResponseCode::PinValidationNotPossible
- | WorldpayvantivResponseCode::GenericTokenRegistrationError
- | WorldpayvantivResponseCode::GenericTokenUseError
- | WorldpayvantivResponseCode::InvalidBankRoutingNumber
- | WorldpayvantivResponseCode::MissingName
- | WorldpayvantivResponseCode::InvalidName
- | WorldpayvantivResponseCode::MissingBillingCountryCode
- | WorldpayvantivResponseCode::InvalidIban
- | WorldpayvantivResponseCode::MissingEmailAddress
- | WorldpayvantivResponseCode::MissingMandateReference
- | WorldpayvantivResponseCode::InvalidMandateReference
- | WorldpayvantivResponseCode::MissingMandateUrl
- | WorldpayvantivResponseCode::InvalidMandateUrl
- | WorldpayvantivResponseCode::MissingMandateSignatureDate
- | WorldpayvantivResponseCode::InvalidMandateSignatureDate
- | WorldpayvantivResponseCode::RecurringMandateAlreadyExists
- | WorldpayvantivResponseCode::RecurringMandateWasNotFound
- | WorldpayvantivResponseCode::FinalRecurringWasAlreadyReceivedUsingThisMandate
- | WorldpayvantivResponseCode::IbanDidNotMatchOneOnFileForMandate
- | WorldpayvantivResponseCode::InvalidBillingCountry
- | WorldpayvantivResponseCode::ExpirationDateRequiredForInteracTransaction
- | WorldpayvantivResponseCode::TransactionTypeIsNotSupportedWithThisMethodOfPayment
- | WorldpayvantivResponseCode::UnreferencedOrphanRefundsAreNotAllowed
- | WorldpayvantivResponseCode::UnableToVoidATransactionWithAHeldState
- | WorldpayvantivResponseCode::ThisFundingInstructionResultsInANegativeAccountBalance
- | WorldpayvantivResponseCode::AccountBalanceInformationUnavailableAtThisTime
- | WorldpayvantivResponseCode::TheSubmittedCardIsNotEligibleForFastAccessFunding
- | WorldpayvantivResponseCode::TransactionCannotUseBothCcdPaymentInformationAndCtxPaymentInformation
- | WorldpayvantivResponseCode::ProcessingError
- | WorldpayvantivResponseCode::ThisFundingInstructionTypeIsInvalidForCanadianMerchants
- | WorldpayvantivResponseCode::CtxAndCcdRecordsAreNotAllowedForCanadianMerchants
- | WorldpayvantivResponseCode::CanadianAccountNumberCannotExceed12Digits
- | WorldpayvantivResponseCode::ThisFundingInstructionTypeIsInvalid
- | WorldpayvantivResponseCode::DeclineNegativeInformationOnFile
- | WorldpayvantivResponseCode::AbsoluteDecline
- | WorldpayvantivResponseCode::TheMerchantProfileDoesNotAllowTheRequestedOperation
- | WorldpayvantivResponseCode::TheAccountCannotAcceptAchTransactions
- | WorldpayvantivResponseCode::TheAccountCannotAcceptAchTransactionsOrSiteDrafts
- | WorldpayvantivResponseCode::AmountGreaterThanLimitSpecifiedInTheMerchantProfile
- | WorldpayvantivResponseCode::MerchantIsNotAuthorizedToPerformECheckVerificationTransactions
- | WorldpayvantivResponseCode::FirstNameAndLastNameRequiredForECheckVerifications
- | WorldpayvantivResponseCode::CompanyNameRequiredForCorporateAccountForECheckVerifications
- | WorldpayvantivResponseCode::PhoneNumberRequiredForECheckVerifications
- | WorldpayvantivResponseCode::CardBrandTokenNotSupported
- | WorldpayvantivResponseCode::PrivateLabelCardNotSupported
- | WorldpayvantivResponseCode::AllowedDailyDirectDebitCaptureECheckSaleLimitExceeded
- | WorldpayvantivResponseCode::AllowedDailyDirectDebitCreditECheckCreditLimitExceeded
- | WorldpayvantivResponseCode::AccountNotEligibleForRtp
- | WorldpayvantivResponseCode::SoftDeclineCustomerAuthenticationRequired
- | WorldpayvantivResponseCode::TransactionNotReversedVoidWorkflowNeedToBeInvoked
- | WorldpayvantivResponseCode::TransactionReversalNotSupportedForTheCoreMerchants
- | WorldpayvantivResponseCode::NoValidParentDepositOrParentRefundFound
- | WorldpayvantivResponseCode::TransactionReversalNotEnabledForVisa
- | WorldpayvantivResponseCode::TransactionReversalNotEnabledForMastercard
- | WorldpayvantivResponseCode::TransactionReversalNotEnabledForAmEx
- | WorldpayvantivResponseCode::TransactionReversalNotEnabledForDiscover
- | WorldpayvantivResponseCode::TransactionReversalNotSupported
- | WorldpayvantivResponseCode::FundingInstructionHeldPleaseContactYourRelationshipManager
- | WorldpayvantivResponseCode::MissingAddressInformation
- | WorldpayvantivResponseCode::CryptographicFailure
- | WorldpayvantivResponseCode::InvalidRegionCode
- | WorldpayvantivResponseCode::InvalidCountryCode
- | WorldpayvantivResponseCode::InvalidCreditAccount
- | WorldpayvantivResponseCode::InvalidCheckingAccount
- | WorldpayvantivResponseCode::InvalidSavingsAccount
- | WorldpayvantivResponseCode::InvalidUseOfMccCorrectAndReattempt
- | WorldpayvantivResponseCode::ExceedsRtpTransactionLimit
- => match flow {
- WorldpayvantivPaymentFlow::Sale
- | WorldpayvantivPaymentFlow::Auth => Ok(common_enums::AttemptStatus::Failure),
- WorldpayvantivPaymentFlow::Capture => Ok(common_enums::AttemptStatus::CaptureFailed),
- WorldpayvantivPaymentFlow::Void => Ok(common_enums::AttemptStatus::VoidFailed)
+ match vantiv_status {
+ PaymentStatus::ProcessedSuccessfully => {
+ if previous_status == common_enums::AttemptStatus::Authorizing {
+ Ok(common_enums::AttemptStatus::Authorized)
+ } else if previous_status == common_enums::AttemptStatus::VoidInitiated {
+ Ok(common_enums::AttemptStatus::Voided)
+ } else {
+ Ok(common_enums::AttemptStatus::Charged)
+ }
}
- _ => {
- Err(errors::ConnectorError::UnexpectedResponseError(
- bytes::Bytes::from("Invalid response code ".to_string()),
- ))
+ PaymentStatus::TransactionDeclined => {
+ if previous_status == common_enums::AttemptStatus::Authorizing {
+ Ok(common_enums::AttemptStatus::AuthorizationFailed)
+ } else if previous_status == common_enums::AttemptStatus::VoidInitiated {
+ Ok(common_enums::AttemptStatus::VoidFailed)
+ } else {
+ Ok(common_enums::AttemptStatus::Failure)
+ }
}
+ PaymentStatus::PaymentStatusNotFound => Ok(common_enums::AttemptStatus::Unresolved),
+ PaymentStatus::NotYetProcessed | PaymentStatus::StatusUnavailable => Ok(previous_status),
}
}
-fn get_refund_status(
- response: WorldpayvantivResponseCode,
+fn get_refund_status_for_rsync(
+ vantiv_status: PaymentStatus,
) -> Result<common_enums::RefundStatus, errors::ConnectorError> {
- match response {
- WorldpayvantivResponseCode::Approved
- | WorldpayvantivResponseCode::PartiallyApproved
- | WorldpayvantivResponseCode::OfflineApproval
- | WorldpayvantivResponseCode::OfflineApprovalUnableToGoOnline => {
- Ok(common_enums::RefundStatus::Success)
- },
- WorldpayvantivResponseCode::TransactionReceived => Ok(common_enums::RefundStatus::Pending),
- WorldpayvantivResponseCode::ProcessingNetworkUnavailable
- | WorldpayvantivResponseCode::IssuerUnavailable
- | WorldpayvantivResponseCode::ReSubmitTransaction
- | WorldpayvantivResponseCode::MerchantNotConfiguredForProcessingAtThisSite
- | WorldpayvantivResponseCode::TryAgainLater
- | WorldpayvantivResponseCode::InsufficientFunds
- | WorldpayvantivResponseCode::AuthorizationAmountHasAlreadyBeenDepleted
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter1Hour
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter24Hour
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter2Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter4Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter6Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter8Days
- | WorldpayvantivResponseCode::InsufficientFundsRetryAfter10Days
- | WorldpayvantivResponseCode::CallIssuer
- | WorldpayvantivResponseCode::CallAmex
- | WorldpayvantivResponseCode::CallDinersClub
- | WorldpayvantivResponseCode::CallDiscover
- | WorldpayvantivResponseCode::CallJbs
- | WorldpayvantivResponseCode::CallVisaMastercard
- | WorldpayvantivResponseCode::ExceedsApprovalAmountLimit
- | WorldpayvantivResponseCode::CallIndicatedNumber
- | WorldpayvantivResponseCode::ConsumerMultiUseVirtualCardNumberSoftDecline
- | WorldpayvantivResponseCode::ConsumerNonReloadablePrepaidCardSoftDecline
- | WorldpayvantivResponseCode::ConsumerSingleUseVirtualCardNumberSoftDecline
- | WorldpayvantivResponseCode::MerchantDoesntQualifyForProductCode
- | WorldpayvantivResponseCode::Lifecycle
- | WorldpayvantivResponseCode::Policy
- | WorldpayvantivResponseCode::InvalidOrExpiredCardContactCardholderToUpdate
- | WorldpayvantivResponseCode::InvalidTransactionOrCardRestrictionVerifyInformationAndResubmit
- | WorldpayvantivResponseCode::OriginalTransactionNotFound
- | WorldpayvantivResponseCode::QueryTransactionNotEnabled
- | WorldpayvantivResponseCode::AtLeastOneOfOrigIdOrOrigCnpTxnIdIsRequired
- | WorldpayvantivResponseCode::OrigCnpTxnIdIsRequiredWhenShowStatusOnlyIsUsed
- | WorldpayvantivResponseCode::TransactionMustReferenceTheEstimatedAuth
- | WorldpayvantivResponseCode::IncrementedAuthExceedsMaxTransactionAmount
- | WorldpayvantivResponseCode::SubmittedMccNotAllowed
- | WorldpayvantivResponseCode::TheMerchantIsNotRegisteredInTheUpdateProgram
- | WorldpayvantivResponseCode::MerchantNotCertifiedEnabledForIias
- | WorldpayvantivResponseCode::IssuerGeneratedError
- | WorldpayvantivResponseCode::InvalidAmountHardDecline
- | WorldpayvantivResponseCode::ReversalUnsuccessful
- | WorldpayvantivResponseCode::MissingData
- | WorldpayvantivResponseCode::InvalidDeactivate
- | WorldpayvantivResponseCode::OverMaxBalance
- | WorldpayvantivResponseCode::InvalidActivate
- | WorldpayvantivResponseCode::NoTransactionFoundForReversal
- | WorldpayvantivResponseCode::IllegalTransaction
- | WorldpayvantivResponseCode::DuplicateTransaction
- | WorldpayvantivResponseCode::SystemError
- | WorldpayvantivResponseCode::MerchantDepleted
- | WorldpayvantivResponseCode::InvalidReversalTypeForCreditCardTransaction
- | WorldpayvantivResponseCode::SystemErrorMessageFormatError
- | WorldpayvantivResponseCode::SystemErrorCannotProcess
- | WorldpayvantivResponseCode::RefundRejectedDueToPendingDepositStatus
- | WorldpayvantivResponseCode::RefundRejectedDueToDeclinedDepositStatus
- | WorldpayvantivResponseCode::RefundRejectedByTheProcessingNetwork
- | WorldpayvantivResponseCode::CaptureCreditAndAuthReversalTagsCannotBeUsedForGiftCardTransactions
- | WorldpayvantivResponseCode::InvalidAccountNumber
- | WorldpayvantivResponseCode::AuthorizationHasExpiredNoNeedToReverse
- | WorldpayvantivResponseCode::InvalidTrackData
- | WorldpayvantivResponseCode::DepositIsAlreadyReferencedByAChargeback
- | WorldpayvantivResponseCode::AutomaticRefundAlreadyIssued
- | WorldpayvantivResponseCode::InvalidMerchant
- | WorldpayvantivResponseCode::InvalidTransaction
- | WorldpayvantivResponseCode::TransactionNotAllowedAtTerminal
- | WorldpayvantivResponseCode::ThisMethodOfPaymentDoesNotSupportAuthorizationReversals
- | WorldpayvantivResponseCode::ReversalAmountDoesNotMatchAuthorizationAmount
- | WorldpayvantivResponseCode::InvalidAmountSoftDecline
- | WorldpayvantivResponseCode::InvalidReportGroup
- | WorldpayvantivResponseCode::DoNotHonor
- | WorldpayvantivResponseCode::GenericDecline
- | WorldpayvantivResponseCode::DeclineRequestPositiveId
- | WorldpayvantivResponseCode::ThreeDSecureTransactionNotSupportedByMerchant
- | WorldpayvantivResponseCode::RestrictedByVantivDueToSecurityCodeMismatch
- | WorldpayvantivResponseCode::NoTransactionFoundWithSpecifiedTransactionId
- | WorldpayvantivResponseCode::AuthorizationNoLongerAvailable
- | WorldpayvantivResponseCode::TransactionNotVoidedAlreadySettled
- | WorldpayvantivResponseCode::AutoVoidOnRefund
- | WorldpayvantivResponseCode::InvalidAccountNumberOriginalOrNocUpdatedECheckAccountRequired
- | WorldpayvantivResponseCode::TotalCreditAmountExceedsCaptureAmount
- | WorldpayvantivResponseCode::ExceedTheThresholdForSendingRedeposits
- | WorldpayvantivResponseCode::DepositHasNotBeenReturnedForInsufficientNonSufficientFunds
- | WorldpayvantivResponseCode::RedepositAgainstInvalidTransactionType
- | WorldpayvantivResponseCode::InternalSystemErrorCallVantiv
- | WorldpayvantivResponseCode::OriginalTransactionHasBeenProcessedFutureRedepositsCanceled
- | WorldpayvantivResponseCode::SoftDeclineAutoRecyclingInProgress
- | WorldpayvantivResponseCode::HardDeclineAutoRecyclingComplete
- | WorldpayvantivResponseCode::TransactionDeclinedByTheProcessingNetwork
- | WorldpayvantivResponseCode::SecondaryAmountCannotExceedTheSaleAmount
- | WorldpayvantivResponseCode::ThisMethodOfPaymentDoesNotSupportSecondaryAmount
- | WorldpayvantivResponseCode::SecondaryAmountCannotBeLessThanZero
- | WorldpayvantivResponseCode::PartialTransactionIsNotSupportedWhenIncludingASecondaryAmount
- | WorldpayvantivResponseCode::SecondaryAmountRequiredOnPartialRefundWhenUsedOnDeposit
- | WorldpayvantivResponseCode::SecondaryAmountNotAllowedOnRefundIfNotIncludedOnDeposit
- | WorldpayvantivResponseCode::ProcessingNetworkError
- | WorldpayvantivResponseCode::InvalidEMail
- | WorldpayvantivResponseCode::InvalidCombinationOfAccountFundingTransactionTypeAndMcc
- | WorldpayvantivResponseCode::InvalidAccountFundingTransactionTypeForThisMethodOfPayment
- | WorldpayvantivResponseCode::MissingOneOrMoreReceiverFieldsForAccountFundingTransaction
- | WorldpayvantivResponseCode::SoftDeclineDecryptionFailed
- | WorldpayvantivResponseCode::HardDeclineInputDataIsInvalid
- | WorldpayvantivResponseCode::HardDeclineDecryptionFailed
- | WorldpayvantivResponseCode::SuspectedFraud
- | WorldpayvantivResponseCode::SystemErrorContactWorldpayRepresentative
- | WorldpayvantivResponseCode::InvalidTerminalId
- | WorldpayvantivResponseCode::DeclineReTryTransaction
- | WorldpayvantivResponseCode::RemoteFunctionUnknown
- | WorldpayvantivResponseCode::InvalidData
- | WorldpayvantivResponseCode::InvalidDataDataElementsMissing
- | WorldpayvantivResponseCode::InvalidDataDataFormatError
- | WorldpayvantivResponseCode::VerifyBillingAddress
- | WorldpayvantivResponseCode::InactiveAccount
- | WorldpayvantivResponseCode::InvalidAuth
- | WorldpayvantivResponseCode::CheckoutIdWasInvalid
- | WorldpayvantivResponseCode::CheckoutIdWasNotFound
- | WorldpayvantivResponseCode::TransactionTypeIsNotSupportedWithThisMethodOfPayment
- | WorldpayvantivResponseCode::UnreferencedOrphanRefundsAreNotAllowed
- | WorldpayvantivResponseCode::ThisFundingInstructionResultsInANegativeAccountBalance
- | WorldpayvantivResponseCode::ProcessingError
- | WorldpayvantivResponseCode::ThisFundingInstructionTypeIsInvalidForCanadianMerchants
- | WorldpayvantivResponseCode::ThisFundingInstructionTypeIsInvalid
- | WorldpayvantivResponseCode::AbsoluteDecline
- | WorldpayvantivResponseCode::TheMerchantProfileDoesNotAllowTheRequestedOperation
- | WorldpayvantivResponseCode::AmountGreaterThanLimitSpecifiedInTheMerchantProfile
- | WorldpayvantivResponseCode::AccountNotEligibleForRtp
- | WorldpayvantivResponseCode::NoValidParentDepositOrParentRefundFound
- | WorldpayvantivResponseCode::FundingInstructionHeldPleaseContactYourRelationshipManager
- | WorldpayvantivResponseCode::InvalidCreditAccount => Ok(common_enums::RefundStatus::Failure),
- _ => {
- Err(errors::ConnectorError::UnexpectedResponseError(
- bytes::Bytes::from("Invalid response code for refund".to_string()),
- ))
+ match vantiv_status {
+ PaymentStatus::ProcessedSuccessfully => Ok(common_enums::RefundStatus::Success),
+ PaymentStatus::TransactionDeclined => Ok(common_enums::RefundStatus::Failure),
+ PaymentStatus::PaymentStatusNotFound => Ok(common_enums::RefundStatus::ManualReview),
+ PaymentStatus::NotYetProcessed | PaymentStatus::StatusUnavailable => {
+ Ok(common_enums::RefundStatus::Pending)
}
- }
+ }
}
diff --git a/crates/hyperswitch_domain_models/src/configs.rs b/crates/hyperswitch_domain_models/src/configs.rs
index e9f13a1de8..6644693836 100644
--- a/crates/hyperswitch_domain_models/src/configs.rs
+++ b/crates/hyperswitch_domain_models/src/configs.rs
@@ -116,7 +116,7 @@ pub struct Connectors {
pub wise: ConnectorParams,
pub worldline: ConnectorParams,
pub worldpay: ConnectorParams,
- pub worldpayvantiv: ConnectorParams,
+ pub worldpayvantiv: ConnectorParamsWithSecondaryBaseUrl,
pub worldpayxml: ConnectorParams,
pub xendit: ConnectorParams,
pub zen: ConnectorParams,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 98bdb8224a..ac1b275f7e 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -191,6 +191,7 @@ wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
worldpayvantiv.base_url = "https://transact.vantivprelive.com/vap/communicator/online"
+worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
wise.base_url = "https://api.sandbox.transferwise.tech/"
@@ -585,8 +586,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
-card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
-card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris"
+card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,worldpayvantiv"
+card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,worldpayvantiv"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet"
wallet.samsung_pay.connector_list = "cybersource"
@@ -626,7 +627,7 @@ card.credit = { connector_list = "cybersource" }
card.debit = { connector_list = "cybersource" }
[network_transaction_id_supported_connectors]
-connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay"
+connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv"
[analytics]
source = "sqlx"