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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(connector): [Authorizedotnet] Adds MOTO support for card payments (#15139)
Akshaya Shankarf71ad21ce9a2
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rsindex add3b23915..f8561f044c 100644--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs@@ -162,6 +162,8 @@ struct TransactionRequest {#[serde(skip_serializing_if = "Option::is_none")]bill_to: Option<BillTo>,#[serde(skip_serializing_if = "Option::is_none")]+ retail: Option<RetailDetails>,+ #[serde(skip_serializing_if = "Option::is_none")]user_fields: Option<UserFields>,#[serde(skip_serializing_if = "Option::is_none")]surcharge: Option<Surcharge>,@@ -171,6 +173,47 @@ struct TransactionRequest {subsequent_auth_information: Option<SubsequentAuthInformation>,}+/// Retail details sent to Authorize.net to indicate the market type of the transaction.+/// If the `retail` element is sent, both `marketType` and `deviceType` are required.+#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+struct RetailDetails {+ market_type: MarketType,+ device_type: DeviceType,+}++#[derive(Debug, Serialize)]+enum MarketType {+ /// Mail Order / Telephone Order+ #[serde(rename = "1")]+ Moto,+}++#[derive(Debug, Serialize)]+enum DeviceType {+ #[serde(rename = "1")]+ Unknown,+}++impl RetailDetails {+ fn from_payment_channel(+ payment_channel: Option<&common_enums::PaymentChannel>,+ ) -> Option<Self> {+ match payment_channel {+ Some(+ common_enums::PaymentChannel::MailOrder+ | common_enums::PaymentChannel::TelephoneOrder,+ ) => Some(Self {+ market_type: MarketType::Moto,+ device_type: DeviceType::Unknown,+ }),+ Some(common_enums::PaymentChannel::Ecommerce)+ | Some(common_enums::PaymentChannel::Other(_))+ | None => None,+ }+ }+}+#[derive(Debug, Serialize)]struct Surcharge {amount: FloatMajorUnit,@@ -1004,6 +1047,8 @@ implzip: address.zip.clone(),country: address.country,}),+ // MIT via network transaction id is merchant-initiated, not MOTO+ retail: None,user_fields: match item.router_data.request.metadata.clone() {Some(metadata) => Some(UserFields {user_field: Vec::<UserField>::foreign_try_from(metadata)?,@@ -1099,6 +1144,8 @@ impl},customer: None,bill_to: None,+ // MIT via connector mandate (customer profile) is merchant-initiated, not MOTO+ retail: None,user_fields: match item.router_data.request.metadata.clone() {Some(metadata) => Some(UserFields {user_field: Vec::<UserField>::foreign_try_from(metadata)?,@@ -1214,6 +1261,9 @@ implzip: address.zip.clone(),country: address.country,}),+ retail: RetailDetails::from_payment_channel(+ item.router_data.request.payment_channel.as_ref(),+ ),user_fields: match item.router_data.request.metadata.clone() {Some(metadata) => Some(UserFields {user_field: Vec::<UserField>::foreign_try_from(metadata)?,@@ -1319,6 +1369,8 @@ implzip: address.zip.clone(),country: address.country,}),+ // Wallet payments are customer-authenticated on device, so always ecommerce+ retail: None,user_fields: match item.router_data.request.metadata.clone() {Some(metadata) => Some(UserFields {user_field: Vec::<UserField>::foreign_try_from(metadata)?,