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): add missing COF parameters for ACI recurring payments (#10150)

Ben Janecke5e2611b75446
diff --git a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
index c42b9affb0..591fc34a36 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
@@ -8,6 +8,7 @@ use hyperswitch_domain_models::{
payment_method_data::{
BankRedirectData, Card, NetworkTokenData, PayLaterData, PaymentMethodData, WalletData,
},
+ payment_methods::storage_enums::MitCategory,
router_data::{ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::SetupMandate,
router_request_types::{
@@ -558,6 +559,8 @@ pub enum InstructionMode {
#[serde(rename_all = "UPPERCASE")]
pub enum InstructionType {
Unscheduled,
+ Recurring,
+ Installment,
}
#[derive(Debug, Clone, Serialize)]
@@ -580,6 +583,10 @@ pub struct Instruction {
#[serde(rename = "standingInstruction.source")]
source: InstructionSource,
+ #[serde(rename = "standingInstruction.initialTransactionId")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ initial_transaction_id: Option<String>,
+
create_registration: Option<bool>,
}
@@ -833,13 +840,29 @@ fn get_instruction_details(
mode: InstructionMode::Initial,
transaction_type: InstructionType::Unscheduled,
source: InstructionSource::CardholderInitiatedTransaction,
+ initial_transaction_id: None,
create_registration: Some(true),
});
} else if item.router_data.request.mandate_id.is_some() {
+ let initial_transaction_id = item
+ .router_data
+ .request
+ .get_connector_mandate_request_reference_id()
+ .ok();
+
+ let transaction_type = match item.router_data.request.mit_category.as_ref() {
+ Some(MitCategory::Installment) => InstructionType::Installment,
+ Some(MitCategory::Recurring) => InstructionType::Recurring,
+ Some(MitCategory::Unscheduled) | Some(MitCategory::Resubmission) | None => {
+ InstructionType::Unscheduled
+ }
+ };
+
return Some(Instruction {
mode: InstructionMode::Repeated,
- transaction_type: InstructionType::Unscheduled,
+ transaction_type,
source: InstructionSource::MerchantInitiatedTransaction,
+ initial_transaction_id,
create_registration: None,
});
}
@@ -1075,7 +1098,7 @@ where
connector_mandate_id: Some(id.expose()),
payment_method_id: None,
mandate_metadata: None,
- connector_mandate_request_reference_id: None,
+ connector_mandate_request_reference_id: Some(item.response.id.clone()),
});
let auto_capture = matches!(
@@ -1460,7 +1483,7 @@ impl
connector_mandate_id: Some(item.response.id.clone()),
payment_method_id: None,
mandate_metadata: None,
- connector_mandate_request_reference_id: None,
+ connector_mandate_request_reference_id: Some(item.response.id.clone()),
});
let status = if SUCCESSFUL_CODES.contains(&item.response.result.code.as_str()) {