mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(payments): update error handling for payment void v2 (#9595)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1017,6 +1017,7 @@ pub async fn construct_cancel_router_data_v2<'a>(
|
||||
request: types::PaymentsCancelData,
|
||||
connector_request_reference_id: String,
|
||||
customer_id: Option<common_utils::id_type::CustomerId>,
|
||||
connector_id: &str,
|
||||
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
|
||||
) -> RouterResult<
|
||||
RouterDataV2<
|
||||
@ -1035,6 +1036,7 @@ pub async fn construct_cancel_router_data_v2<'a>(
|
||||
merchant_id: merchant_account.get_id().clone(),
|
||||
customer_id,
|
||||
connector_customer: None,
|
||||
connector: connector_id.to_owned(),
|
||||
payment_id: payment_data
|
||||
.payment_attempt
|
||||
.payment_id
|
||||
@ -1149,6 +1151,7 @@ pub async fn construct_router_data_for_cancel<'a>(
|
||||
request,
|
||||
connector_request_reference_id.clone(),
|
||||
customer_id.clone(),
|
||||
connector_id,
|
||||
header_payload.clone(),
|
||||
)
|
||||
.await?;
|
||||
@ -2183,6 +2186,11 @@ where
|
||||
.connector
|
||||
.as_ref()
|
||||
.and_then(|conn| api_enums::Connector::from_str(conn).ok());
|
||||
let error = payment_attempt
|
||||
.error
|
||||
.as_ref()
|
||||
.map(api_models::payments::ErrorDetails::foreign_from);
|
||||
|
||||
let response = api_models::payments::PaymentsCancelResponse {
|
||||
id: payment_intent.id.clone(),
|
||||
status: payment_intent.status,
|
||||
@ -2195,6 +2203,7 @@ where
|
||||
payment_method_subtype: Some(payment_attempt.payment_method_subtype),
|
||||
attempts: None,
|
||||
return_url: payment_intent.return_url.clone(),
|
||||
error,
|
||||
};
|
||||
|
||||
let headers = connector_http_status_code
|
||||
@ -6000,6 +6009,7 @@ impl ForeignFrom<&hyperswitch_domain_models::payments::payment_attempt::ErrorDet
|
||||
Self {
|
||||
code: error_details.code.to_owned(),
|
||||
message: error_details.message.to_owned(),
|
||||
reason: error_details.reason.clone(),
|
||||
unified_code: error_details.unified_code.clone(),
|
||||
unified_message: error_details.unified_message.clone(),
|
||||
network_advice_code: error_details.network_advice_code.clone(),
|
||||
|
||||
Reference in New Issue
Block a user