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
fix(connector): [ACI] Add amount currency conversion and update error codes (#1065)
SamraatBansalb760cba54603
diff --git a/crates/router/src/connector/aci/result_codes.rs b/crates/router/src/connector/aci/result_codes.rsindex 1fae407964..84502c46ee 100644--- a/crates/router/src/connector/aci/result_codes.rs+++ b/crates/router/src/connector/aci/result_codes.rs@@ -1,4 +1,4 @@-pub(super) const FAILURE_CODES: [&str; 499] = [+pub(super) const FAILURE_CODES: [&str; 501] = ["100.370.100","100.370.110","100.370.111",@@ -10,6 +10,8 @@ pub(super) const FAILURE_CODES: [&str; 499] = ["100.380.306","100.380.401","100.380.501",+ "100.395.502",+ "100.396.101","100.400.000","100.400.001","100.400.002",diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rsindex e4eb7a1585..acb1784929 100644--- a/crates/router/src/connector/aci/transformers.rs+++ b/crates/router/src/connector/aci/transformers.rs@@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};use super::result_codes::{FAILURE_CODES, PENDING_CODES, SUCCESSFUL_CODES};use crate::{+ connector::utils,core::errors,services,types::{self, api, storage::enums},@@ -35,7 +36,7 @@ impl TryFrom<&types::ConnectorAuthType> for AciAuthType {#[serde(rename_all = "camelCase")]pub struct AciPaymentsRequest {pub entity_id: String,- pub amount: i64,+ pub amount: String,pub currency: String,pub payment_type: AciPaymentType,#[serde(flatten)]@@ -200,7 +201,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {let aci_payment_request = Self {payment_method: payment_details,entity_id: auth.entity_id,- amount: item.request.amount,+ amount: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,currency: item.request.currency.to_string(),payment_type: AciPaymentType::Debit,};@@ -349,7 +350,7 @@ impl<F, T>#[derive(Default, Debug, Serialize)]#[serde(rename_all = "camelCase")]pub struct AciRefundRequest {- pub amount: i64,+ pub amount: String,pub currency: String,pub payment_type: AciPaymentType,pub entity_id: String,@@ -358,7 +359,8 @@ pub struct AciRefundRequest {impl<F> TryFrom<&types::RefundsRouterData<F>> for AciRefundRequest {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {- let amount = item.request.refund_amount;+ let amount =+ utils::to_currency_base_unit(item.request.refund_amount, item.request.currency)?;let currency = item.request.currency;let payment_type = AciPaymentType::Refund;let auth = AciAuthType::try_from(&item.connector_auth_type)?;