fix(connector): [Braintree] Consume merchant_account_id and merchant_config_currency in payment requests (#7408)

Co-authored-by: Debarshi Gupta <debarshi.gupta@Debarshi-Gupta-CM92YWDXFD.local>
This commit is contained in:
DEEPANSHU BANSAL
2025-03-05 16:30:28 +05:30
committed by GitHub
parent 38bb7676be
commit 00d69bd924
16 changed files with 229 additions and 11 deletions

View File

@ -338,6 +338,23 @@ pub async fn construct_refund_router_data<'a, F>(
let connector_refund_id = refund.get_optional_connector_refund_id().cloned();
let braintree_metadata = payment_intent
.connector_metadata
.clone()
.map(|cm| {
cm.parse_value::<api_models::payments::ConnectorMetadata>("ConnectorMetadata")
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed parsing ConnectorMetadata")
})
.transpose()?
.and_then(|cm| cm.braintree);
let merchant_account_id = braintree_metadata
.as_ref()
.and_then(|braintree| braintree.merchant_account_id.clone());
let merchant_config_currency =
braintree_metadata.and_then(|braintree| braintree.merchant_config_currency);
let router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
@ -376,6 +393,8 @@ pub async fn construct_refund_router_data<'a, F>(
split_refunds,
integrity_object: None,
refund_status: refund.refund_status,
merchant_account_id,
merchant_config_currency,
},
response: Ok(types::RefundsResponseData {