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

fix(connector): [NEXIXPAY] Updated the Api Response Schema (#9476)

Sayak Bhattacharyaab00b083e963
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index 68ad70da2a..b4cd758ef6 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -1,7 +1,9 @@
use std::collections::HashMap;
use cards::CardNumber;
-use common_enums::{enums, AttemptStatus, CaptureMethod, Currency, RefundStatus};
+use common_enums::{
+ AttemptStatus, CaptureMethod, CountryAlpha2, CountryAlpha3, Currency, RefundStatus,
+};
use common_utils::{
errors::CustomResult, ext_traits::ValueExt, request::Method, types::StringMinorUnit,
};
@@ -57,7 +59,7 @@ trait AddressConstructor {
street: Option<Secret<String>>,
city: Option<String>,
post_code: Option<Secret<String>>,
- country: Option<enums::CountryAlpha2>,
+ country: Option<CountryAlpha3>,
) -> Self;
}
@@ -67,7 +69,7 @@ impl AddressConstructor for BillingAddress {
street: Option<Secret<String>>,
city: Option<String>,
post_code: Option<Secret<String>>,
- country: Option<enums::CountryAlpha2>,
+ country: Option<CountryAlpha3>,
) -> Self {
Self {
name,
@@ -85,7 +87,7 @@ impl AddressConstructor for ShippingAddress {
street: Option<Secret<String>>,
city: Option<String>,
post_code: Option<Secret<String>>,
- country: Option<enums::CountryAlpha2>,
+ country: Option<CountryAlpha3>,
) -> Self {
Self {
name,
@@ -126,7 +128,8 @@ where
data.get_optional_billing_full_name(),
data.get_optional_billing_city(),
data.get_optional_billing_zip(),
- data.get_optional_billing_country(),
+ data.get_optional_billing_country()
+ .map(CountryAlpha2::from_alpha2_to_alpha3),
data.get_optional_billing().is_some(),
"billing",
MAX_BILLING_ADDRESS_NAME_LENGTH,
@@ -141,7 +144,8 @@ where
data.get_optional_shipping_full_name(),
data.get_optional_shipping_city(),
data.get_optional_shipping_zip(),
- data.get_optional_shipping_country(),
+ data.get_optional_shipping_country()
+ .map(CountryAlpha2::from_alpha2_to_alpha3),
data.get_optional_shipping().is_some(),
"shipping",
MAX_BILLING_ADDRESS_NAME_LENGTH,
@@ -392,7 +396,7 @@ pub struct BillingAddress {
street: Option<Secret<String>>,
city: Option<String>,
post_code: Option<Secret<String>>,
- country: Option<enums::CountryAlpha2>,
+ country: Option<CountryAlpha3>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -402,7 +406,7 @@ pub struct ShippingAddress {
street: Option<Secret<String>>,
city: Option<String>,
post_code: Option<Secret<String>>,
- country: Option<enums::CountryAlpha2>,
+ country: Option<CountryAlpha3>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -561,8 +565,9 @@ pub struct NexixpayPreProcessingResponse {
#[serde(rename_all = "camelCase")]
pub struct Operation {
additional_data: AdditionalData,
+ channel: Option<Channel>,
customer_info: CustomerInfo,
- operation_amount: String,
+ operation_amount: StringMinorUnit,
operation_currency: Currency,
operation_id: String,
operation_result: NexixpayPaymentStatus,
@@ -570,7 +575,22 @@ pub struct Operation {
operation_type: NexixpayOperationType,
order_id: String,
payment_method: String,
- warnings: Option<Vec<String>>,
+ warnings: Option<Vec<DetailedWarnings>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum Channel {
+ Ecommerce,
+ Pos,
+ Backoffice,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DetailedWarnings {
+ code: Option<String>,
+ description: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]