Skip to content

Commit ed276ec

Browse files
feat(connector): [AIRWALLEX] Add refferer data to whitelist hyperswitch (#6806)
1 parent 6081283 commit ed276ec

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ impl TryFrom<&ConnectorAuthType> for AirwallexAuthType {
4343
}
4444
}
4545
}
46+
47+
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
48+
pub struct ReferrerData {
49+
#[serde(rename = "type")]
50+
r_type: String,
51+
version: String,
52+
}
53+
4654
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
4755
pub struct AirwallexIntentRequest {
4856
// Unique ID to be sent for each transaction/operation request to the connector
@@ -51,10 +59,16 @@ pub struct AirwallexIntentRequest {
5159
currency: enums::Currency,
5260
//ID created in merchant's order system that corresponds to this PaymentIntent.
5361
merchant_order_id: String,
62+
// This data is required to whitelist Hyperswitch at Airwallex.
63+
referrer_data: ReferrerData,
5464
}
5565
impl TryFrom<&types::PaymentsPreProcessingRouterData> for AirwallexIntentRequest {
5666
type Error = error_stack::Report<errors::ConnectorError>;
5767
fn try_from(item: &types::PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {
68+
let referrer_data = ReferrerData {
69+
r_type: "hyperswitch".to_string(),
70+
version: "1.0.0".to_string(),
71+
};
5872
// amount and currency will always be Some since PaymentsPreProcessingData is constructed using PaymentsAuthorizeData
5973
let amount = item
6074
.request
@@ -73,6 +87,7 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for AirwallexIntentRequest
7387
amount: utils::to_currency_base_unit(amount, currency)?,
7488
currency,
7589
merchant_order_id: item.connector_request_reference_id.clone(),
90+
referrer_data,
7691
})
7792
}
7893
}

0 commit comments

Comments
 (0)