From dd3e22a938714f373477e08d1d25e4b84ac796c6 Mon Sep 17 00:00:00 2001 From: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:33:55 +0530 Subject: [PATCH] fix(connector): [Prophetpay] Use refund_id as reference_id for Refund (#2966) --- .../src/connector/prophetpay/transformers.rs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/crates/router/src/connector/prophetpay/transformers.rs b/crates/router/src/connector/prophetpay/transformers.rs index b8cf3e3a1f5b..43816bc2ee52 100644 --- a/crates/router/src/connector/prophetpay/transformers.rs +++ b/crates/router/src/connector/prophetpay/transformers.rs @@ -8,6 +8,7 @@ use url::Url; use crate::{ connector::utils::{self, to_connector_meta}, + consts as const_val, core::errors, services, types::{self, api, storage::enums}, @@ -432,7 +433,6 @@ pub struct ProphetpaySyncResponse { pub response_text: String, #[serde(rename = "transactionID")] pub transaction_id: String, - pub response_code: String, } impl @@ -462,7 +462,7 @@ impl Ok(Self { status: enums::AttemptStatus::Failure, response: Err(types::ErrorResponse { - code: item.response.response_code, + code: const_val::NO_ERROR_CODE.to_string(), message: item.response.response_text.clone(), reason: Some(item.response.response_text), status_code: item.http_code, @@ -481,7 +481,6 @@ pub struct ProphetpayVoidResponse { pub response_text: String, #[serde(rename = "transactionID")] pub transaction_id: String, - pub response_code: String, } impl @@ -511,7 +510,7 @@ impl Ok(Self { status: enums::AttemptStatus::VoidFailed, response: Err(types::ErrorResponse { - code: item.response.response_code, + code: const_val::NO_ERROR_CODE.to_string(), message: item.response.response_text.clone(), reason: Some(item.response.response_text), status_code: item.http_code, @@ -576,8 +575,8 @@ impl TryFrom<&ProphetpayRouterData<&types::RefundsRouterData>> for Prophet amount: item.amount.to_owned(), card_token: card_token_data.card_token, profile: auth_data.profile_id, - ref_info: item.router_data.connector_request_reference_id.to_owned(), - inquiry_reference: item.router_data.connector_request_reference_id.clone(), + ref_info: item.router_data.request.refund_id.to_owned(), + inquiry_reference: item.router_data.request.refund_id.clone(), action_type: ProphetpayActionType::get_action_type(&ProphetpayActionType::Refund), }) } else { @@ -594,8 +593,7 @@ impl TryFrom<&ProphetpayRouterData<&types::RefundsRouterData>> for Prophet pub struct ProphetpayRefundResponse { pub success: bool, pub response_text: String, - pub tran_seq_number: String, - pub response_code: String, + pub tran_seq_number: Option, } impl TryFrom> @@ -609,7 +607,11 @@ impl TryFrom TryFrom> @@ -658,7 +659,7 @@ impl TryFrom