Skip to content

Commit

Permalink
fix(connector): [Novalnet] Get email from customer email if billing.e…
Browse files Browse the repository at this point in the history
…mail is not present (#6619)
  • Loading branch information
cookieg13 authored Nov 21, 2024
1 parent bc65a84 commit 9010214
Showing 1 changed file with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ use api_models::webhooks::IncomingWebhookEvent;
use cards::CardNumber;
use common_enums::{enums, enums as api_enums};
use common_utils::{
consts,
ext_traits::OptionExt,
pii::{Email, IpAddress},
request::Method,
types::StringMinorUnit,
consts, ext_traits::OptionExt, pii::Email, request::Method, types::StringMinorUnit,
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
Expand All @@ -32,9 +28,8 @@ use strum::Display;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
self, ApplePay, BrowserInformationData, PaymentsAuthorizeRequestData,
PaymentsCancelRequestData, PaymentsCaptureRequestData, PaymentsSyncRequestData,
RefundsRequestData, RouterData as _,
self, ApplePay, PaymentsAuthorizeRequestData, PaymentsCancelRequestData,
PaymentsCaptureRequestData, PaymentsSyncRequestData, RefundsRequestData, RouterData as _,
},
};

Expand Down Expand Up @@ -82,7 +77,6 @@ pub struct NovalnetPaymentsRequestCustomer {
email: Email,
mobile: Option<Secret<String>>,
billing: Option<NovalnetPaymentsRequestBilling>,
customer_ip: Option<Secret<String, IpAddress>>,
no_nc: i64,
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -194,20 +188,15 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
country_code: item.router_data.get_optional_billing_country(),
};

let customer_ip = item
.router_data
.request
.get_browser_info()?
.get_ip_address()
.ok();

let customer = NovalnetPaymentsRequestCustomer {
first_name: item.router_data.get_billing_first_name()?,
last_name: item.router_data.get_billing_last_name()?,
email: item.router_data.get_billing_email()?,
email: item
.router_data
.get_billing_email()
.or(item.router_data.request.get_email())?,
mobile: item.router_data.get_optional_billing_phone_number(),
billing: Some(billing),
customer_ip,
// no_nc is used to indicate if minimal customer data is passed or not
no_nc: 1,
};
Expand Down

0 comments on commit 9010214

Please sign in to comment.