feat(router): send 2xx payments response for all the connector http responses (2xx, 4xx etc.) (#1924)

This commit is contained in:
Sai Harsha Vardhan
2023-08-17 15:26:07 +05:30
committed by GitHub
parent 35963e279a
commit 0ab6827f6c
18 changed files with 314 additions and 223 deletions

View File

@ -88,6 +88,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
quote_id: None,
test_mode: None,
payment_method_balance: None,
connector_http_status_code: None,
}
}
@ -140,6 +141,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
quote_id: None,
test_mode: None,
payment_method_balance: None,
connector_http_status_code: None,
}
}

View File

@ -504,6 +504,7 @@ pub trait ConnectorActions: Connector {
quote_id: None,
test_mode: None,
payment_method_balance: None,
connector_http_status_code: None,
}
}

View File

@ -352,7 +352,8 @@ async fn payments_create_core() {
mandate_id: None,
..Default::default()
};
let expected_response = services::ApplicationResponse::Json(expected_response);
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
let actual_response =
payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
&state,
@ -498,21 +499,24 @@ async fn payments_create_core_adyen_no_redirect() {
..Default::default()
};
let expected_response = services::ApplicationResponse::Json(api::PaymentsResponse {
payment_id: Some(payment_id.clone()),
status: api_enums::IntentStatus::Processing,
amount: 6540,
amount_capturable: None,
amount_received: None,
client_secret: None,
created: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
refunds: None,
mandate_id: None,
..Default::default()
});
let expected_response = services::ApplicationResponse::JsonWithHeaders((
api::PaymentsResponse {
payment_id: Some(payment_id.clone()),
status: api_enums::IntentStatus::Processing,
amount: 6540,
amount_capturable: None,
amount_received: None,
client_secret: None,
created: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
refunds: None,
mandate_id: None,
..Default::default()
},
vec![],
));
let actual_response =
payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
&state,

View File

@ -112,7 +112,8 @@ async fn payments_create_core() {
mandate_id: None,
..Default::default()
};
let expected_response = services::ApplicationResponse::Json(expected_response);
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
let actual_response =
router::core::payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
&state,
@ -260,21 +261,24 @@ async fn payments_create_core_adyen_no_redirect() {
..Default::default()
};
let expected_response = services::ApplicationResponse::Json(api::PaymentsResponse {
payment_id: Some(payment_id.clone()),
status: api_enums::IntentStatus::Processing,
amount: 6540,
amount_capturable: None,
amount_received: None,
client_secret: None,
created: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
refunds: None,
mandate_id: None,
..Default::default()
});
let expected_response = services::ApplicationResponse::JsonWithHeaders((
api::PaymentsResponse {
payment_id: Some(payment_id.clone()),
status: api_enums::IntentStatus::Processing,
amount: 6540,
amount_capturable: None,
amount_received: None,
client_secret: None,
created: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
refunds: None,
mandate_id: None,
..Default::default()
},
vec![],
));
let actual_response =
router::core::payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
&state,