mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
chore: add cardholder name as mandatory field for Worldpay card transactions (#7897)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -285,6 +285,7 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
|
|||||||
http_code: res.status_code,
|
http_code: res.status_code,
|
||||||
},
|
},
|
||||||
optional_correlation_id,
|
optional_correlation_id,
|
||||||
|
data.request.amount.unwrap_or(0),
|
||||||
))
|
))
|
||||||
.change_context(errors::ConnectorError::ResponseHandlingFailed)
|
.change_context(errors::ConnectorError::ResponseHandlingFailed)
|
||||||
}
|
}
|
||||||
@ -759,6 +760,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
|
|||||||
http_code: res.status_code,
|
http_code: res.status_code,
|
||||||
},
|
},
|
||||||
optional_correlation_id,
|
optional_correlation_id,
|
||||||
|
data.request.amount,
|
||||||
))
|
))
|
||||||
.change_context(errors::ConnectorError::ResponseHandlingFailed)
|
.change_context(errors::ConnectorError::ResponseHandlingFailed)
|
||||||
}
|
}
|
||||||
@ -870,6 +872,7 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
|
|||||||
http_code: res.status_code,
|
http_code: res.status_code,
|
||||||
},
|
},
|
||||||
optional_correlation_id,
|
optional_correlation_id,
|
||||||
|
data.request.amount,
|
||||||
))
|
))
|
||||||
.change_context(errors::ConnectorError::ResponseHandlingFailed)
|
.change_context(errors::ConnectorError::ResponseHandlingFailed)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,34 +86,24 @@ fn fetch_payment_instrument(
|
|||||||
},
|
},
|
||||||
cvc: card.card_cvc,
|
cvc: card.card_cvc,
|
||||||
card_holder_name: billing_address.and_then(|address| address.get_optional_full_name()),
|
card_holder_name: billing_address.and_then(|address| address.get_optional_full_name()),
|
||||||
billing_address: if let Some(address) =
|
billing_address: billing_address
|
||||||
billing_address.and_then(|addr| addr.address.clone())
|
.and_then(|addr| addr.address.clone())
|
||||||
{
|
.and_then(|address| {
|
||||||
|
match (address.line1, address.city, address.zip, address.country) {
|
||||||
|
(Some(address1), Some(city), Some(postal_code), Some(country_code)) => {
|
||||||
Some(BillingAddress {
|
Some(BillingAddress {
|
||||||
address1: address.line1.get_required_value("line1").change_context(
|
address1,
|
||||||
errors::ConnectorError::MissingRequiredField {
|
|
||||||
field_name: "line1",
|
|
||||||
},
|
|
||||||
)?,
|
|
||||||
address2: address.line2,
|
address2: address.line2,
|
||||||
address3: address.line3,
|
address3: address.line3,
|
||||||
city: address.city.get_required_value("city").change_context(
|
city,
|
||||||
errors::ConnectorError::MissingRequiredField { field_name: "city" },
|
|
||||||
)?,
|
|
||||||
state: address.state,
|
state: address.state,
|
||||||
postal_code: address.zip.get_required_value("zip").change_context(
|
postal_code,
|
||||||
errors::ConnectorError::MissingRequiredField { field_name: "zip" },
|
country_code,
|
||||||
)?,
|
|
||||||
country_code: address
|
|
||||||
.country
|
|
||||||
.get_required_value("country_code")
|
|
||||||
.change_context(errors::ConnectorError::MissingRequiredField {
|
|
||||||
field_name: "country_code",
|
|
||||||
})?,
|
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
None
|
_ => None,
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
})),
|
})),
|
||||||
PaymentMethodData::CardDetailsForNetworkTransactionId(raw_card_details) => {
|
PaymentMethodData::CardDetailsForNetworkTransactionId(raw_card_details) => {
|
||||||
Ok(PaymentInstrument::RawCardForNTI(RawCardDetails {
|
Ok(PaymentInstrument::RawCardForNTI(RawCardDetails {
|
||||||
@ -264,7 +254,7 @@ impl WorldpayPaymentsRequestData
|
|||||||
for RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
|
for RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
|
||||||
{
|
{
|
||||||
fn get_return_url(&self) -> Result<String, error_stack::Report<errors::ConnectorError>> {
|
fn get_return_url(&self) -> Result<String, error_stack::Report<errors::ConnectorError>> {
|
||||||
self.request.get_router_return_url()
|
self.request.get_complete_authorize_url()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_auth_type(&self) -> &enums::AuthenticationType {
|
fn get_auth_type(&self) -> &enums::AuthenticationType {
|
||||||
@ -681,6 +671,7 @@ impl<F, T>
|
|||||||
ForeignTryFrom<(
|
ForeignTryFrom<(
|
||||||
ResponseRouterData<F, WorldpayPaymentsResponse, T, PaymentsResponseData>,
|
ResponseRouterData<F, WorldpayPaymentsResponse, T, PaymentsResponseData>,
|
||||||
Option<String>,
|
Option<String>,
|
||||||
|
i64,
|
||||||
)> for RouterData<F, T, PaymentsResponseData>
|
)> for RouterData<F, T, PaymentsResponseData>
|
||||||
{
|
{
|
||||||
type Error = error_stack::Report<errors::ConnectorError>;
|
type Error = error_stack::Report<errors::ConnectorError>;
|
||||||
@ -688,9 +679,10 @@ impl<F, T>
|
|||||||
item: (
|
item: (
|
||||||
ResponseRouterData<F, WorldpayPaymentsResponse, T, PaymentsResponseData>,
|
ResponseRouterData<F, WorldpayPaymentsResponse, T, PaymentsResponseData>,
|
||||||
Option<String>,
|
Option<String>,
|
||||||
|
i64,
|
||||||
),
|
),
|
||||||
) -> Result<Self, Self::Error> {
|
) -> Result<Self, Self::Error> {
|
||||||
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
|
let (description, redirection_data, mandate_reference, network_txn_id, error) = router_data
|
||||||
.response
|
.response
|
||||||
.other_fields
|
.other_fields
|
||||||
@ -770,7 +762,11 @@ impl<F, T>
|
|||||||
PaymentOutcome::FraudHighRisk => Some("Transaction marked as high risk".to_string()),
|
PaymentOutcome::FraudHighRisk => Some("Transaction marked as high risk".to_string()),
|
||||||
_ => None,
|
_ => 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) {
|
let response = match (optional_error_message, error) {
|
||||||
(None, None) => Ok(PaymentsResponseData::TransactionResponse {
|
(None, None) => Ok(PaymentsResponseData::TransactionResponse {
|
||||||
resource_id: ResponseId::foreign_try_from((
|
resource_id: ResponseId::foreign_try_from((
|
||||||
|
|||||||
@ -1473,6 +1473,7 @@ fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {
|
|||||||
RequiredField::CardNumber,
|
RequiredField::CardNumber,
|
||||||
RequiredField::CardExpMonth,
|
RequiredField::CardExpMonth,
|
||||||
RequiredField::CardExpYear,
|
RequiredField::CardExpYear,
|
||||||
|
RequiredField::BillingUserFirstName,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user