refactor(payment_method_data): send optional billing details in response (#4569)

This commit is contained in:
Narayan Bhat
2024-05-10 15:05:25 +05:30
committed by GitHub
parent fef28c3345
commit 86e05501cb
3 changed files with 100 additions and 27 deletions

View File

@ -527,7 +527,9 @@ impl From<payments::PaymentsResponse> for StripePaymentIntentResponse {
capture_on: resp.capture_on,
capture_method: resp.capture_method,
payment_method: resp.payment_method,
payment_method_data: resp.payment_method_data.map(|pmd| pmd.payment_method_data),
payment_method_data: resp
.payment_method_data
.and_then(|pmd| pmd.payment_method_data),
payment_token: resp.payment_token,
shipping: resp.shipping,
billing: resp.billing,

View File

@ -463,14 +463,17 @@ where
let payment_method_data =
additional_payment_method_data.map(api::PaymentMethodDataResponse::from);
let payment_method_data_response = payment_method_data.map(|payment_method_data| {
api_models::payments::PaymentMethodDataResponseWithBilling {
payment_method_data,
billing: payment_data
.address
.get_request_payment_method_billing()
.cloned(),
}
let payment_method_data_response = (payment_method_data.is_some()
|| payment_data
.address
.get_request_payment_method_billing()
.is_some())
.then_some(api_models::payments::PaymentMethodDataResponseWithBilling {
payment_method_data,
billing: payment_data
.address
.get_request_payment_method_billing()
.cloned(),
});
let mut headers = connector_http_status_code