Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(connector): [worldpayvantiv] add NTID support, fix wallets, make flow synchronous (#11558)
Akshaya Shankar6eb9224d5bc0
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rsindex b1042e56e7..b0e0fb6875 100644--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs@@ -290,6 +290,8 @@ pub struct Sale {#[serde(skip_serializing_if = "Option::is_none")]pub token: Option<TokenizationData>,#[serde(skip_serializing_if = "Option::is_none")]+ pub cardholder_authentication: Option<CardholderAuthentication>,+ #[serde(skip_serializing_if = "Option::is_none")]pub enhanced_data: Option<EnhancedData>,#[serde(skip_serializing_if = "Option::is_none")]pub processing_type: Option<VantivProcessingType>,@@ -790,6 +792,7 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl.and_then(|enable_partial_authorization| {enable_partial_authorization.then_some(true)}),+ cardholder_authentication,}),)} else {@@ -969,6 +972,11 @@ impl From<(PaymentMethodData, Option<common_enums::PaymentChannel>)> for OrderSo{return Self::AndroidPay;}+ if let PaymentMethodData::DecryptedWalletTokenDetailsForNetworkTransactionId(_) =+ payment_method_data+ {+ return Self::Ecommerce;+ }match payment_channel {Some(common_enums::PaymentChannel::Ecommerce)@@ -3585,7 +3593,7 @@ fn get_post_capture_void_status(| WorldpayvantivResponseCode::AccountNumberWasSuccessfullyRegistered| WorldpayvantivResponseCode::AccountNumberWasPreviouslyRegistered| WorldpayvantivResponseCode::ValidToken- => Ok(common_enums::PostCaptureVoidStatus::Pending),+ => Ok(common_enums::PostCaptureVoidStatus::Succeeded),WorldpayvantivResponseCode::ShopperCheckoutExpired| WorldpayvantivResponseCode::ProcessingNetworkUnavailable| WorldpayvantivResponseCode::IssuerUnavailable@@ -3954,13 +3962,12 @@ fn get_attempt_status(| WorldpayvantivResponseCode::AccountNumberWasPreviouslyRegistered| WorldpayvantivResponseCode::ValidToken=> match flow {- WorldpayvantivPaymentFlow::Sale => Ok(common_enums::AttemptStatus::Pending),- WorldpayvantivPaymentFlow::Auth => Ok(common_enums::AttemptStatus::Authorizing),- WorldpayvantivPaymentFlow::Capture => Ok(common_enums::AttemptStatus::CaptureInitiated),- WorldpayvantivPaymentFlow::Void => Ok(common_enums::AttemptStatus::VoidInitiated),- WorldpayvantivPaymentFlow::VoidPC => {- Ok(common_enums::AttemptStatus::VoidInitiated)- }+ // For synchronous behaviour: mark approved/partially approved as terminal+ 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),+ WorldpayvantivPaymentFlow::VoidPC => Ok(common_enums::AttemptStatus::VoidedPostCharge),},WorldpayvantivResponseCode::ShopperCheckoutExpired| WorldpayvantivResponseCode::ProcessingNetworkUnavailable@@ -4325,7 +4332,7 @@ fn get_refund_status(| WorldpayvantivResponseCode::PartiallyApproved| WorldpayvantivResponseCode::OfflineApproval| WorldpayvantivResponseCode::OfflineApprovalUnableToGoOnline => {- Ok(common_enums::RefundStatus::Pending)+ Ok(common_enums::RefundStatus::Success)},WorldpayvantivResponseCode::TransactionReceived => Ok(common_enums::RefundStatus::Pending),WorldpayvantivResponseCode::ProcessingNetworkUnavailable@@ -4509,6 +4516,24 @@ fn get_vantiv_card_data(None,))}+ PaymentMethodData::DecryptedWalletTokenDetailsForNetworkTransactionId(dw_token) => {+ let card_type = match dw_token.card_network.clone() {+ Some(card_type) => WorldpayvativCardType::try_from(card_type)?,+ None => WorldpayvativCardType::try_from(&dw_token.get_card_issuer()?)?,+ };++ let exp_date = dw_token.get_expiry_date_as_mmyy()?;++ Ok((+ Some(WorldpayvantivCardData {+ card_type,+ number: cards::CardNumber::from(dw_token.decrypted_token.clone()),+ exp_date,+ card_validation_num: None,+ }),+ None,+ ))+ }PaymentMethodData::MandatePayment => Ok((None, None)),PaymentMethodData::Wallet(wallet_data) => match wallet_data {hyperswitch_domain_models::payment_method_data::WalletData::ApplePay(