diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs index 4628eaf116..645502b267 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs @@ -285,6 +285,7 @@ impl ConnectorIntegration { + Some(BillingAddress { + address1, + address2: address.line2, + address3: address.line3, + city, + state: address.state, + postal_code, + country_code, + }) + } + _ => None, + } + }), })), PaymentMethodData::CardDetailsForNetworkTransactionId(raw_card_details) => { Ok(PaymentInstrument::RawCardForNTI(RawCardDetails { @@ -264,7 +254,7 @@ impl WorldpayPaymentsRequestData for RouterData { fn get_return_url(&self) -> Result> { - self.request.get_router_return_url() + self.request.get_complete_authorize_url() } fn get_auth_type(&self) -> &enums::AuthenticationType { @@ -681,6 +671,7 @@ impl ForeignTryFrom<( ResponseRouterData, Option, + i64, )> for RouterData { type Error = error_stack::Report; @@ -688,9 +679,10 @@ impl item: ( ResponseRouterData, Option, + i64, ), ) -> Result { - let (router_data, optional_correlation_id) = item; + let (router_data, optional_correlation_id, amount) = item; let (description, redirection_data, mandate_reference, network_txn_id, error) = router_data .response .other_fields @@ -770,7 +762,11 @@ impl PaymentOutcome::FraudHighRisk => Some("Transaction marked as high risk".to_string()), _ => None, }; - let status = enums::AttemptStatus::from(worldpay_status.clone()); + let status = if amount == 0 && worldpay_status == PaymentOutcome::Authorized { + enums::AttemptStatus::Charged + } else { + enums::AttemptStatus::from(worldpay_status.clone()) + }; let response = match (optional_error_message, error) { (None, None) => Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::foreign_try_from(( diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs index 192d45c8fc..69cb4b97de 100644 --- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs +++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs @@ -1473,6 +1473,7 @@ fn get_cards_required_fields() -> HashMap { RequiredField::CardNumber, RequiredField::CardExpMonth, RequiredField::CardExpYear, + RequiredField::BillingUserFirstName, ], ), ),