Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(gigadat): add method to retrieve billing phone number without plus sign (#12322)

Swangi Kumari4f50a8f6f90f
diff --git a/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs b/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs
index 0cf08c699b..27911c4c94 100644
--- a/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs
@@ -111,7 +111,7 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
let router_data = item.router_data;
let name = router_data.get_billing_full_name()?;
let email = router_data.get_billing_email()?;
- let mobile = router_data.get_billing_phone_number()?;
+ let mobile = router_data.get_billing_phone_number_without_plus()?;
let currency = item.router_data.request.currency;
let sandbox = match item.router_data.test_mode {
Some(true) => true,
@@ -476,7 +476,7 @@ impl TryFrom<&GigadatRouterData<&PayoutsRouterData<PoQuote>>> for GigadatPayoutQ
let router_data = item.router_data;
let name = router_data.get_billing_full_name()?;
let email = interac_data.email;
- let mobile = router_data.get_billing_phone_number()?;
+ let mobile = router_data.get_billing_phone_number_without_plus()?;
let currency = item.router_data.request.destination_currency;
let user_ip = router_data.request.get_browser_info()?.get_ip_address()?;
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 3149520f6d..e7fc245112 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -564,6 +564,7 @@ pub trait RouterData {
fn get_billing_city(&self) -> Result<String, Error>;
fn get_billing_email(&self) -> Result<Email, Error>;
fn get_billing_phone_number(&self) -> Result<Secret<String>, Error>;
+ fn get_billing_phone_number_without_plus(&self) -> Result<Secret<String>, Error>;
fn to_connector_meta<T>(&self) -> Result<T, Error>
where
T: serde::de::DeserializeOwned;
@@ -918,6 +919,11 @@ impl<Flow, Request, Response> RouterData
.ok_or_else(missing_field_err("payment_method_data.billing.phone"))
}
+ fn get_billing_phone_number_without_plus(&self) -> Result<Secret<String>, Error> {
+ self.get_billing_phone_number()
+ .map(|phone| Secret::new(phone.peek().trim_start_matches('+').to_string()))
+ }
+
fn get_optional_billing_line1(&self) -> Option<Secret<String>> {
self.address
.get_payment_method_billing()