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(connector): [AUTHORIZEDOTNET] Add billing address in payments request (#3981)

DEEPANSHU BANSAL3806cd35c763
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index 8ba610d66d..2d6f2e040a 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -7,10 +7,17 @@ use masking::{ExposeInterface, PeekInterface, Secret, StrongSecret};
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::{self, CardData, PaymentsSyncRequestData, RefundsRequestData, WalletData},
+ connector::utils::{
+ self, CardData, PaymentsSyncRequestData, RefundsRequestData, RouterData, WalletData,
+ },
core::errors,
services,
- types::{self, api, storage::enums, transformers::ForeignFrom},
+ types::{
+ self,
+ api::{self, enums as api_enums},
+ storage::enums,
+ transformers::ForeignFrom,
+ },
utils::OptionExt,
};
@@ -231,6 +238,8 @@ struct TransactionRequest {
amount: f64,
currency_code: String,
payment: PaymentDetails,
+ order: Order,
+ bill_to: Option<BillTo>,
processing_options: Option<ProcessingOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
subsequent_auth_information: Option<SubsequentAuthInformation>,
@@ -243,6 +252,24 @@ pub struct ProcessingOptions {
is_subsequent_auth: bool,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BillTo {
+ first_name: Option<Secret<String>>,
+ last_name: Option<Secret<String>>,
+ address: Option<Secret<String>>,
+ city: Option<String>,
+ state: Option<Secret<String>>,
+ zip: Option<Secret<String>>,
+ country: Option<api_enums::CountryAlpha2>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Order {
+ description: String,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SubsequentAuthInformation {
@@ -341,12 +368,27 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>>
}),
None => None,
};
-
+ let bill_to = item
+ .router_data
+ .get_billing_address_details_as_optional()
+ .map(|address| BillTo {
+ first_name: address.first_name.clone(),
+ last_name: address.last_name.clone(),
+ address: address.line1.clone(),
+ city: address.city.clone(),
+ state: address.state.clone(),
+ zip: address.zip.clone(),
+ country: address.country,
+ });
let transaction_request = TransactionRequest {
transaction_type: TransactionType::from(item.router_data.request.capture_method),
amount: item.amount,
- payment: payment_details,
currency_code: item.router_data.request.currency.to_string(),
+ payment: payment_details,
+ order: Order {
+ description: item.router_data.connector_request_reference_id.clone(),
+ },
+ bill_to,
processing_options,
subsequent_auth_information,
authorization_indicator_type,