refactor(address): pass payment method billing to the connector module (#3828)

Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-03-12 15:52:52 +05:30
committed by GitHub
parent ac8ddd4020
commit 195c700e6c
55 changed files with 405 additions and 387 deletions

View File

@ -86,33 +86,31 @@ pub async fn construct_payout_router_data<'a, F>(
let billing = payout_data.billing_address.to_owned();
let address = PaymentAddress {
shipping: None,
billing: billing.map(|a| {
let phone_details = api_models::payments::PhoneDetails {
number: a.phone_number.clone().map(Encryptable::into_inner),
country_code: a.country_code.to_owned(),
};
let address_details = api_models::payments::AddressDetails {
city: a.city.to_owned(),
country: a.country.to_owned(),
line1: a.line1.clone().map(Encryptable::into_inner),
line2: a.line2.clone().map(Encryptable::into_inner),
line3: a.line3.clone().map(Encryptable::into_inner),
zip: a.zip.clone().map(Encryptable::into_inner),
first_name: a.first_name.clone().map(Encryptable::into_inner),
last_name: a.last_name.clone().map(Encryptable::into_inner),
state: a.state.map(Encryptable::into_inner),
};
let billing_address = billing.map(|a| {
let phone_details = api_models::payments::PhoneDetails {
number: a.phone_number.clone().map(Encryptable::into_inner),
country_code: a.country_code.to_owned(),
};
let address_details = api_models::payments::AddressDetails {
city: a.city.to_owned(),
country: a.country.to_owned(),
line1: a.line1.clone().map(Encryptable::into_inner),
line2: a.line2.clone().map(Encryptable::into_inner),
line3: a.line3.clone().map(Encryptable::into_inner),
zip: a.zip.clone().map(Encryptable::into_inner),
first_name: a.first_name.clone().map(Encryptable::into_inner),
last_name: a.last_name.clone().map(Encryptable::into_inner),
state: a.state.map(Encryptable::into_inner),
};
api_models::payments::Address {
phone: Some(phone_details),
address: Some(address_details),
email: a.email.to_owned().map(Email::from),
}
}),
payment_method_billing: None,
};
api_models::payments::Address {
phone: Some(phone_details),
address: Some(address_details),
email: a.email.to_owned().map(Email::from),
}
});
let address = PaymentAddress::new(None, billing_address, None);
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let payouts = &payout_data.payouts;