From ed276ecc0017f7f98b6f8fa3841e6b8971f609f1 Mon Sep 17 00:00:00 2001 From: DEEPANSHU BANSAL <41580413+deepanshu-iiitu@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:25:43 +0530 Subject: [PATCH] feat(connector): [AIRWALLEX] Add refferer data to whitelist hyperswitch (#6806) --- .../src/connectors/airwallex/transformers.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs index 97c9ed4d36a4..e8ab479c978c 100644 --- a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs @@ -43,6 +43,14 @@ impl TryFrom<&ConnectorAuthType> for AirwallexAuthType { } } } + +#[derive(Default, Debug, Serialize, Eq, PartialEq)] +pub struct ReferrerData { + #[serde(rename = "type")] + r_type: String, + version: String, +} + #[derive(Default, Debug, Serialize, Eq, PartialEq)] pub struct AirwallexIntentRequest { // Unique ID to be sent for each transaction/operation request to the connector @@ -51,10 +59,16 @@ pub struct AirwallexIntentRequest { currency: enums::Currency, //ID created in merchant's order system that corresponds to this PaymentIntent. merchant_order_id: String, + // This data is required to whitelist Hyperswitch at Airwallex. + referrer_data: ReferrerData, } impl TryFrom<&types::PaymentsPreProcessingRouterData> for AirwallexIntentRequest { type Error = error_stack::Report; fn try_from(item: &types::PaymentsPreProcessingRouterData) -> Result { + let referrer_data = ReferrerData { + r_type: "hyperswitch".to_string(), + version: "1.0.0".to_string(), + }; // amount and currency will always be Some since PaymentsPreProcessingData is constructed using PaymentsAuthorizeData let amount = item .request @@ -73,6 +87,7 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for AirwallexIntentRequest amount: utils::to_currency_base_unit(amount, currency)?, currency, merchant_order_id: item.connector_request_reference_id.clone(), + referrer_data, }) } }