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(core): Add `CurrentFlowInfo` in `AccessTokenRequestData` and moved `get_access_token_key` to `ConnectorSpecifications` (#11569)

Sayak Bhattacharya350a5cb897f3
diff --git a/.typos.toml b/.typos.toml
index 89f1f82cff..5198c19a54 100644
--- a/.typos.toml
+++ b/.typos.toml
@@ -117,6 +117,7 @@ nin = "nin" # National identification number, a field used by PayU connector
requestor = "requestor" #Used in external 3ds flows
substituters = "substituters" # Present in `flake.nix`
unsuccess = "unsuccess" # Used in cryptopay request
+automatico = "automatico" # Pix Automático (Portuguese for Automatic) - payment method name
[files]
extend-exclude = [
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 1360c5f0e7..08e83fc6f8 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -12593,6 +12593,28 @@
}
}
},
+ {
+ "type": "object",
+ "required": [
+ "pix_automatico_push"
+ ],
+ "properties": {
+ "pix_automatico_push": {
+ "$ref": "#/components/schemas/PixAutomaticoPushAdditionalData"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "pix_automatico_qr"
+ ],
+ "properties": {
+ "pix_automatico_qr": {
+ "type": "object"
+ }
+ }
+ },
{
"type": "object",
"required": [
@@ -28578,6 +28600,8 @@
"paypal",
"paze",
"pix",
+ "pix_automatico_qr",
+ "pix_automatico_push",
"pay_safe_card",
"przelewy24",
"prompt_pay",
@@ -35072,6 +35096,29 @@
}
]
},
+ "PixAutomaticoPushAdditionalData": {
+ "type": "object",
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "Partially masked account number for Pix Automatico Push payment method",
+ "example": "550689",
+ "nullable": true
+ },
+ "branch_code": {
+ "type": "string",
+ "description": "Partially masked branch code for Pix Automatico Push payment method",
+ "example": "2569",
+ "nullable": true
+ },
+ "bank_identifier": {
+ "type": "string",
+ "description": "Partially masked bank identifier for Pix Automatico Push payment method",
+ "example": "91193552",
+ "nullable": true
+ }
+ }
+ },
"PixBankTransfer": {
"type": "object",
"required": [
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 14ed0d2340..64481167fb 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -8263,6 +8263,28 @@
}
}
},
+ {
+ "type": "object",
+ "required": [
+ "pix_automatico_push"
+ ],
+ "properties": {
+ "pix_automatico_push": {
+ "$ref": "#/components/schemas/PixAutomaticoPushAdditionalData"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "pix_automatico_qr"
+ ],
+ "properties": {
+ "pix_automatico_qr": {
+ "type": "object"
+ }
+ }
+ },
{
"type": "object",
"required": [
@@ -22179,6 +22201,8 @@
"paypal",
"paze",
"pix",
+ "pix_automatico_qr",
+ "pix_automatico_push",
"pay_safe_card",
"przelewy24",
"prompt_pay",
@@ -25598,6 +25622,29 @@
}
]
},
+ "PixAutomaticoPushAdditionalData": {
+ "type": "object",
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "Partially masked account number for Pix Automatico Push payment method",
+ "example": "550689",
+ "nullable": true
+ },
+ "branch_code": {
+ "type": "string",
+ "description": "Partially masked branch code for Pix Automatico Push payment method",
+ "example": "2569",
+ "nullable": true
+ },
+ "bank_identifier": {
+ "type": "string",
+ "description": "Partially masked bank identifier for Pix Automatico Push payment method",
+ "example": "91193552",
+ "nullable": true
+ }
+ }
+ },
"PixBankTransfer": {
"type": "object",
"required": [
diff --git a/crates/api_models/src/payments/additional_info.rs b/crates/api_models/src/payments/additional_info.rs
index fa97d5b37c..ccdfd72f36 100644
--- a/crates/api_models/src/payments/additional_info.rs
+++ b/crates/api_models/src/payments/additional_info.rs
@@ -248,6 +248,10 @@ pub enum BankTransferAdditionalData {
MandiriVa {},
#[smithy(value_type = "PixBankTransferAdditionalData")]
Pix(Box<PixBankTransferAdditionalData>),
+ #[smithy(value_type = "PixAutomaticoPushAdditionalData")]
+ PixAutomaticoPush(Box<PixAutomaticoPushAdditionalData>),
+ #[smithy(nested_value_type)]
+ PixAutomaticoQr {},
#[smithy(nested_value_type)]
Pse {},
#[smithy(value_type = "LocalBankTransferAdditionalData")]
@@ -266,6 +270,27 @@ pub enum BankTransferAdditionalData {
},
}
+#[derive(
+ Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema, SmithyModel,
+)]
+#[smithy(namespace = "com.hyperswitch.smithy.types")]
+pub struct PixAutomaticoPushAdditionalData {
+ /// Partially masked account number for Pix Automatico Push payment method
+ #[schema(value_type = Option<String>, example = "550689")]
+ #[smithy(value_type = "Option<String>")]
+ pub account_number: Option<Secret<String>>,
+
+ /// Partially masked branch code for Pix Automatico Push payment method
+ #[schema(value_type = Option<String>, example = "2569")]
+ #[smithy(value_type = "Option<String>")]
+ pub branch_code: Option<Secret<String>>,
+
+ /// Partially masked bank identifier for Pix Automatico Push payment method
+ #[schema(value_type = Option<String>, example = "91193552")]
+ #[smithy(value_type = "Option<String>")]
+ pub bank_identifier: Option<Secret<String>>,
+}
+
#[derive(
Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema, SmithyModel,
)]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index c15524364c..b44f11efc5 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2353,6 +2353,8 @@ pub enum PaymentMethodType {
Paypal,
Paze,
Pix,
+ PixAutomaticoQr,
+ PixAutomaticoPush,
PaySafeCard,
Przelewy24,
PromptPay,
@@ -2486,6 +2488,8 @@ impl PaymentMethodType {
Self::Paypal => "PayPal",
Self::Paze => "Paze",
Self::Pix => "Pix",
+ Self::PixAutomaticoQr => "Pix Automático QR",
+ Self::PixAutomaticoPush => "Pix Automático Push",
Self::PaySafeCard => "PaySafeCard",
Self::Przelewy24 => "Przelewy24",
Self::PromptPay => "PromptPay",
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index 981307a2b5..b7ad6c9be8 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1864,6 +1864,8 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::Paze => Self::Wallet,
PaymentMethodType::PermataBankTransfer => Self::BankTransfer,
PaymentMethodType::Pix => Self::BankTransfer,
+ PaymentMethodType::PixAutomaticoPush => Self::BankTransfer,
+ PaymentMethodType::PixAutomaticoQr => Self::BankTransfer,
PaymentMethodType::Pse => Self::BankTransfer,
PaymentMethodType::LocalBankTransfer => Self::BankTransfer,
PaymentMethodType::PayBright => Self::PayLater,
diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs
index 8a81ffdb23..8b80a15b49 100644
--- a/crates/euclid/src/frontend/dir/enums.rs
+++ b/crates/euclid/src/frontend/dir/enums.rs
@@ -223,6 +223,8 @@ pub enum BankTransferType {
MandiriVa,
PermataBankTransfer,
Pix,
+ PixAutomaticoPush,
+ PixAutomaticoQr,
Pse,
LocalBankTransfer,
InstantBankTransfer,
diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs
index 0ac474ac24..39e6bf0172 100644
--- a/crates/euclid/src/frontend/dir/lowering.rs
+++ b/crates/euclid/src/frontend/dir/lowering.rs
@@ -120,6 +120,8 @@ impl From<enums::BankTransferType> for global_enums::PaymentMethodType {
match value {
enums::BankTransferType::Multibanco => Self::Multibanco,
enums::BankTransferType::Pix => Self::Pix,
+ enums::BankTransferType::PixAutomaticoPush => Self::PixAutomaticoPush,
+ enums::BankTransferType::PixAutomaticoQr => Self::PixAutomaticoQr,
enums::BankTransferType::Pse => Self::Pse,
enums::BankTransferType::Ach => Self::Ach,
enums::BankTransferType::SepaBankTransfer => Self::Sepa,
diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs
index 6da1b5b03f..288ce21a7a 100644
--- a/crates/euclid/src/frontend/dir/transformers.rs
+++ b/crates/euclid/src/frontend/dir/transformers.rs
@@ -90,6 +90,12 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
Ok(dirval!(BankTransferType = Multibanco))
}
global_enums::PaymentMethodType::Pix => Ok(dirval!(BankTransferType = Pix)),
+ global_enums::PaymentMethodType::PixAutomaticoPush => {
+ Ok(dirval!(BankTransferType = PixAutomaticoPush))
+ }
+ global_enums::PaymentMethodType::PixAutomaticoQr => {
+ Ok(dirval!(BankTransferType = PixAutomaticoQr))
+ }
global_enums::PaymentMethodType::Pse => Ok(dirval!(BankTransferType = Pse)),
global_enums::PaymentMethodType::Interac => Ok(dirval!(BankRedirectType = Interac)),
global_enums::PaymentMethodType::OnlineBankingCzechRepublic => {
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs
index 23b8ec69d6..105d9c1fe2 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs
@@ -360,7 +360,9 @@ impl ConnectorValidation for Adyen {
| PaymentMethodType::Bluecode
| PaymentMethodType::SepaGuarenteedDebit
| PaymentMethodType::OpenBanking
- | PaymentMethodType::NetworkToken => {
+ | PaymentMethodType::NetworkToken
+ | PaymentMethodType::PixAutomaticoPush
+ | PaymentMethodType::PixAutomaticoQr => {
capture_method_not_supported!(connector, capture_method, payment_method_type)
}
},
@@ -3442,7 +3444,7 @@ static ADYEN_SUPPORTED_WEBHOOK_FLOWS: &[enums::EventClass] = &[
];
impl ConnectorSpecifications for Adyen {
- fn is_balance_check_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_balance_check_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { request_data, .. } => {
matches!(&request_data.payment_method_data, payment_method_data::PaymentMethodData::GiftCard(giftcard_data) if giftcard_data.is_givex())
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 19c09192f0..df4b15c077 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -2971,6 +2971,8 @@ impl TryFrom<(&BankTransferData, &PaymentsAuthorizeRouterData)> for AdyenPayment
| BankTransferData::InstantBankTransferFinland {}
| BankTransferData::InstantBankTransferPoland {}
| BankTransferData::IndonesianBankTransfer { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::Pse {} => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
@@ -3734,6 +3736,8 @@ impl
| BankTransferData::InstantBankTransfer {}
| BankTransferData::InstantBankTransferFinland {}
| BankTransferData::InstantBankTransferPoland {}
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::IndonesianBankTransfer { .. } => (None, None),
};
let application_info = get_application_info(item);
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
index f468f51d37..4c5c0cbe7b 100644
--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
@@ -1637,19 +1637,19 @@ static BARCLAYCARD_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
static BARCLAYCARD_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
impl ConnectorSpecifications for Barclaycard {
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
request_data,
auth_type,
- } => *auth_type == common_enums::AuthenticationType::ThreeDs && request_data.is_card(),
+ } => auth_type == common_enums::AuthenticationType::ThreeDs && request_data.is_card(),
// No alternate flow for complete authorize
api::CurrentFlowInfo::CompleteAuthorize { .. } => false,
api::CurrentFlowInfo::SetupMandate { .. } => false,
}
}
/// Check if authentication flow is required
- fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { .. } => {
// during authorize flow, there is no post_authentication call needed
@@ -1674,7 +1674,7 @@ impl ConnectorSpecifications for Barclaycard {
}
}
/// Check if post-authentication flow is required
- fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { .. } => {
// during authorize flow, there is no post_authentication call needed
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
index 1d97b4c54b..c8c2bb1f91 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
@@ -2283,7 +2283,7 @@ impl ConnectorSpecifications for Cybersource {
}
fn get_preprocessing_flow_if_needed(
&self,
- current_flow_info: api::CurrentFlowInfo<'_>,
+ current_flow_info: api::CurrentFlowInfo,
) -> Option<api::PreProcessingFlowName> {
match current_flow_info {
api::CurrentFlowInfo::Authorize { .. } => {
@@ -2309,14 +2309,14 @@ impl ConnectorSpecifications for Cybersource {
}
fn get_alternate_flow_if_needed(
&self,
- current_flow: api::CurrentFlowInfo<'_>,
+ current_flow: api::CurrentFlowInfo,
) -> Option<api::AlternateFlow> {
match current_flow {
api::CurrentFlowInfo::Authorize {
request_data,
auth_type,
} => {
- if self.is_3ds_setup_required(request_data, *auth_type) {
+ if self.is_3ds_setup_required(&request_data, auth_type) {
Some(api::AlternateFlow::PreAuthenticate)
} else {
None
@@ -2327,19 +2327,19 @@ impl ConnectorSpecifications for Cybersource {
api::CurrentFlowInfo::SetupMandate { .. } => None,
}
}
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
request_data,
auth_type,
- } => self.is_3ds_setup_required(request_data, *auth_type),
+ } => self.is_3ds_setup_required(&request_data, auth_type),
// No alternate flow for complete authorize
api::CurrentFlowInfo::CompleteAuthorize { .. } => false,
api::CurrentFlowInfo::SetupMandate { .. } => false,
}
}
/// Check if authentication flow is required
- fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { .. } => {
// during authorize flow, there is no post_authentication call needed
@@ -2364,7 +2364,7 @@ impl ConnectorSpecifications for Cybersource {
}
}
/// Check if post-authentication flow is required
- fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { .. } => {
// during authorize flow, there is no post_authentication call needed
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
index b990ecd9e7..f729736e5a 100644
--- a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs
@@ -178,6 +178,8 @@ impl TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>>
| BankTransferData::InstantBankTransferFinland {}
| BankTransferData::InstantBankTransferPoland {}
| BankTransferData::IndonesianBankTransfer { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::LocalBankTransfer { .. } => {
Err(errors::ConnectorError::NotImplemented(
"Selected payment method through Facilitapay".to_string(),
diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
index 688342b830..1de42790ef 100644
--- a/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
@@ -111,6 +111,8 @@ impl TryFrom<&ItaubankRouterData<&types::PaymentsAuthorizeRouterData>> for Itaub
| BankTransferData::InstantBankTransferFinland {}
| BankTransferData::InstantBankTransferPoland {}
| BankTransferData::IndonesianBankTransfer { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::LocalBankTransfer { .. } => {
Err(errors::ConnectorError::NotImplemented(
"Selected payment method through itaubank".to_string(),
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs
index 5404c0ff4a..5b95f9ea7f 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs
@@ -620,6 +620,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Paypal
| common_enums::PaymentMethodType::Paze
| common_enums::PaymentMethodType::Pix
+ | common_enums::PaymentMethodType::PixAutomaticoPush
+ | common_enums::PaymentMethodType::PixAutomaticoQr
| common_enums::PaymentMethodType::PaySafeCard
| common_enums::PaymentMethodType::Przelewy24
| common_enums::PaymentMethodType::Pse
@@ -750,6 +752,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Paypal
| common_enums::PaymentMethodType::Paze
| common_enums::PaymentMethodType::Pix
+ | common_enums::PaymentMethodType::PixAutomaticoPush
+ | common_enums::PaymentMethodType::PixAutomaticoQr
| common_enums::PaymentMethodType::PaySafeCard
| common_enums::PaymentMethodType::Przelewy24
| common_enums::PaymentMethodType::Pse
@@ -888,6 +892,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Paypal
| common_enums::PaymentMethodType::Paze
| common_enums::PaymentMethodType::Pix
+ | common_enums::PaymentMethodType::PixAutomaticoPush
+ | common_enums::PaymentMethodType::PixAutomaticoQr
| common_enums::PaymentMethodType::PaySafeCard
| common_enums::PaymentMethodType::Przelewy24
| common_enums::PaymentMethodType::Pse
@@ -1018,6 +1024,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Paypal
| common_enums::PaymentMethodType::Paze
| common_enums::PaymentMethodType::Pix
+ | common_enums::PaymentMethodType::PixAutomaticoPush
+ | common_enums::PaymentMethodType::PixAutomaticoQr
| common_enums::PaymentMethodType::PaySafeCard
| common_enums::PaymentMethodType::Przelewy24
| common_enums::PaymentMethodType::Pse
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
index 5d6b32f7e3..c281bfea13 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
@@ -1359,7 +1359,7 @@ impl ConnectorSpecifications for Nexixpay {
Some(&*NEXIXPAY_CONNECTOR_INFO)
}
- fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { .. } => false,
api::CurrentFlowInfo::CompleteAuthorize {
@@ -1379,7 +1379,7 @@ impl ConnectorSpecifications for Nexixpay {
Some(&*NEXIXPAY_SUPPORTED_WEBHOOK_FLOWS)
}
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
request_data,
@@ -1389,7 +1389,7 @@ impl ConnectorSpecifications for Nexixpay {
if request_data.is_mandate_payment() {
false
} else {
- self.is_3ds_setup_required(request_data, *auth_type)
+ self.is_3ds_setup_required(&request_data, auth_type)
}
}
// No alternate flow for complete authorize
diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rs
index 634aa45849..f3979dc3d1 100644
--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs
@@ -1196,7 +1196,7 @@ static NMI_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] =
[enums::EventClass::Payments, enums::EventClass::Refunds];
impl ConnectorSpecifications for Nmi {
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type,
diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rs
index a6e6f1a907..82ff3c8610 100644
--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs
@@ -1268,7 +1268,7 @@ lazy_static! {
}
impl ConnectorSpecifications for Nordea {
- fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type: _,
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 94c85ec69f..e5a59343b4 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -1721,7 +1721,7 @@ impl ConnectorSpecifications for Nuvei {
Some(&NUVEI_CONNECTOR_INFO)
}
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type,
@@ -1743,7 +1743,10 @@ impl ConnectorSpecifications for Nuvei {
Some(&NUVEI_SUPPORTED_WEBHOOK_FLOWS)
}
- fn is_authorize_session_token_call_required(&self) -> bool {
+ fn is_authorize_session_token_call_required(
+ &self,
+ _current_flow: Option<api::CurrentFlowInfo>,
+ ) -> bool {
true
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/payme.rs b/crates/hyperswitch_connectors/src/connectors/payme.rs
index 556e8da21d..d4b853d8ca 100644
--- a/crates/hyperswitch_connectors/src/connectors/payme.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payme.rs
@@ -1470,7 +1470,7 @@ static PAYME_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [
];
impl ConnectorSpecifications for Payme {
- fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type: _,
diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rs
index 378134dfd0..09b8e525ec 100644
--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs
@@ -2574,7 +2574,7 @@ static PAYPAL_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [
];
impl ConnectorSpecifications for Paypal {
- fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { .. } => false,
api::CurrentFlowInfo::CompleteAuthorize {
diff --git a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
index a77458bded..470bba21b3 100644
--- a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
@@ -1273,6 +1273,8 @@ impl TryFrom<&PaypalRouterData<&PaymentsAuthorizeRouterData>> for PaypalPayments
| enums::PaymentMethodType::OpenBankingUk
| enums::PaymentMethodType::PayBright
| enums::PaymentMethodType::Pix
+ | enums::PaymentMethodType::PixAutomaticoPush
+ | enums::PaymentMethodType::PixAutomaticoQr
| enums::PaymentMethodType::PaySafeCard
| enums::PaymentMethodType::Przelewy24
| enums::PaymentMethodType::PromptPay
@@ -1422,6 +1424,8 @@ impl TryFrom<&BankTransferData> for PaypalPaymentsRequest {
| BankTransferData::DanamonVaBankTransfer { .. }
| BankTransferData::MandiriVaBankTransfer { .. }
| BankTransferData::Pix { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::Pse {}
| BankTransferData::InstantBankTransfer {}
| BankTransferData::InstantBankTransferFinland {}
diff --git a/crates/hyperswitch_connectors/src/connectors/paytm.rs b/crates/hyperswitch_connectors/src/connectors/paytm.rs
index 00f2fcb75a..8e8e3c77f9 100644
--- a/crates/hyperswitch_connectors/src/connectors/paytm.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paytm.rs
@@ -654,7 +654,10 @@ impl ConnectorSpecifications for Paytm {
Some(&*PAYTM_SUPPORTED_WEBHOOK_FLOWS)
}
- fn is_authorize_session_token_call_required(&self) -> bool {
+ fn is_authorize_session_token_call_required(
+ &self,
+ _current_flow: Option<api::CurrentFlowInfo>,
+ ) -> bool {
true
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rs
index 34586d31fc..a1ebf3bbf4 100644
--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs
@@ -1076,7 +1076,7 @@ static REDSYS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
static REDSYS_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = [];
impl ConnectorSpecifications for Redsys {
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type,
@@ -1087,7 +1087,7 @@ impl ConnectorSpecifications for Redsys {
}
}
- fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type,
diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs
index 0786d0ca70..cdcf17d91d 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander.rs
@@ -21,9 +21,10 @@ use hyperswitch_domain_models::{
UpdateMetadata,
},
router_request_types::{
- AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
- PaymentsUpdateMetadataData, RefundsData, SetupMandateRequestData,
+ AccessTokenRequestData, CurrentFlowInfo, PaymentMethodTokenizationData,
+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
+ PaymentsSyncData, PaymentsUpdateMetadataData, RefundsData, ResponseId,
+ SetupMandateRequestData,
},
router_response_types::{
ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
@@ -811,9 +812,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for San
let santander_mca_metadata = SantanderMetadataObject::try_from(&req.connector_meta_data)?;
let connector_transaction_id = match req.request.connector_transaction_id {
- hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(
- ref id,
- ) => Some(id.clone()),
+ ResponseId::ConnectorTransactionId(ref id) => Some(id.clone()),
_ => None,
};
@@ -1585,6 +1584,19 @@ impl ConnectorSpecifications for Santander {
_ => payment_attempt.payment_id.get_string_repr().to_owned(),
}
}
+
+ fn is_authorize_session_token_call_required(
+ &self,
+ current_flow: Option<CurrentFlowInfo>,
+ ) -> bool {
+ match current_flow {
+ // Journey 1/2/3/4 CIT
+ Some(CurrentFlowInfo::SetupMandate { .. }) => true,
+ Some(CurrentFlowInfo::CompleteAuthorize { .. })
+ | Some(CurrentFlowInfo::Authorize { .. })
+ | None => false,
+ }
+ }
}
impl ConnectorAccessTokenSuffix for Santander {
@@ -1592,6 +1604,7 @@ impl ConnectorAccessTokenSuffix for Santander {
&self,
router_data: &dyn api::AccessTokenData,
merchant_connector_id_or_connector_name: String,
+ _current_flow: Option<CurrentFlowInfo>,
) -> CustomResult<String, errors::ConnectorError> {
let pmt = router_data.get_payment_method_type();
let merchant_id = router_data.get_merchant_id();
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs
index f1e2af6455..b04138d1aa 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs
@@ -1099,7 +1099,7 @@ static SHIFT4_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] =
[enums::EventClass::Payments, enums::EventClass::Refunds];
impl ConnectorSpecifications for Shift4 {
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
request_data,
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index b1d610eb12..6c215c19f0 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -521,6 +521,8 @@ impl TryFrom<&BankTransferData> for Shift4PaymentMethod {
| BankTransferData::DanamonVaBankTransfer { .. }
| BankTransferData::MandiriVaBankTransfer { .. }
| BankTransferData::Pix { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::Pse {}
| BankTransferData::InstantBankTransfer {}
| BankTransferData::InstantBankTransferFinland { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs
index babf50b0f0..dba0347a61 100644
--- a/crates/hyperswitch_connectors/src/connectors/square.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square.rs
@@ -1003,7 +1003,10 @@ impl ConnectorSpecifications for Square {
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
Some(&*SQUARE_SUPPORTED_WEBHOOK_FLOWS)
}
- fn is_authorize_session_token_call_required(&self) -> bool {
+ fn is_authorize_session_token_call_required(
+ &self,
+ _current_flow: Option<api::CurrentFlowInfo>,
+ ) -> bool {
true
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
index 5df38a5211..f9492ca360 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
@@ -873,6 +873,8 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
| enums::PaymentMethodType::Paypal
| enums::PaymentMethodType::BhnCardNetwork
| enums::PaymentMethodType::Pix
+ | enums::PaymentMethodType::PixAutomaticoPush
+ | enums::PaymentMethodType::PixAutomaticoQr
| enums::PaymentMethodType::UpiCollect
| enums::PaymentMethodType::UpiIntent
| enums::PaymentMethodType::Cashapp
@@ -1511,7 +1513,9 @@ fn create_stripe_payment_method(
))
.into(),
),
- payment_method_data::BankTransferData::Pse {}
+ payment_method_data::BankTransferData::PixAutomaticoPush { .. }
+ | payment_method_data::BankTransferData::PixAutomaticoQr {}
+ | payment_method_data::BankTransferData::Pse {}
| payment_method_data::BankTransferData::LocalBankTransfer { .. }
| payment_method_data::BankTransferData::InstantBankTransfer {}
| payment_method_data::BankTransferData::InstantBankTransferFinland { .. }
@@ -4698,6 +4702,8 @@ impl
))
}
payment_method_data::BankTransferData::Pix { .. }
+ | payment_method_data::BankTransferData::PixAutomaticoPush { .. }
+ | payment_method_data::BankTransferData::PixAutomaticoQr {}
| payment_method_data::BankTransferData::Pse {}
| payment_method_data::BankTransferData::PermataBankTransfer { .. }
| payment_method_data::BankTransferData::BcaBankTransfer { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs
index b5bc3f5762..bdfd117360 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs
@@ -371,8 +371,11 @@ fn serialize_value(value: &serde_json::Value) -> String {
sorted
.iter()
.filter(|(_, v)| !v.is_null())
- .map(|(k, v)| format!("{}{}", k, serialize_data(v)))
- .collect()
+ .fold(String::new(), |mut acc, (k, v)| {
+ acc.push_str(k);
+ acc.push_str(&serialize_data(v));
+ acc
+ })
}
serde_json::Value::Array(arr) => arr.iter().map(serialize_data).collect(),
serde_json::Value::String(s) => s.clone(),
@@ -417,10 +420,11 @@ fn serialize_data(value: &serde_json::Value) -> String {
serde_json::Value::Object(map) => {
// BTreeMap keeps keys sorted (matches PHP's ksort)
let sorted: BTreeMap<_, _> = map.iter().collect();
- sorted
- .iter()
- .map(|(k, v)| format!("{}{}", k, serialize_data(v)))
- .collect()
+ sorted.iter().fold(String::new(), |mut acc, (k, v)| {
+ acc.push_str(k);
+ acc.push_str(&serialize_data(v));
+ acc
+ })
}
serde_json::Value::Array(arr) => arr.iter().map(serialize_data).collect(),
serde_json::Value::String(s) => s.clone(),
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
index f0691bf906..bf70b85282 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
@@ -1483,7 +1483,7 @@ static TRUSTPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [
];
impl ConnectorSpecifications for Trustpay {
- fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize {
auth_type: _,
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs
index 83d7d78c40..a755fa7c35 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs
@@ -1174,7 +1174,7 @@ static XENDIT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
static XENDIT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];
impl ConnectorSpecifications for Xendit {
- fn is_settlement_split_call_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_settlement_split_call_required(&self, current_flow: api::CurrentFlowInfo) -> bool {
match current_flow {
api::CurrentFlowInfo::Authorize { request_data, .. } => {
matches!(request_data.payment_method_data, PaymentMethodData::Card(_))
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 63b0b0cc64..9785e20ebc 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -350,6 +350,8 @@ impl
| BankTransferData::InstantBankTransferFinland { .. }
| BankTransferData::InstantBankTransferPoland { .. }
| BankTransferData::IndonesianBankTransfer { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::MandiriVaBankTransfer { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Zen"),
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
index a4f621c1ea..fa03b1231d 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
@@ -162,6 +162,8 @@ impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPayment
| BankTransferData::DanamonVaBankTransfer { .. }
| BankTransferData::MandiriVaBankTransfer { .. }
| BankTransferData::Pix { .. }
+ | BankTransferData::PixAutomaticoPush { .. }
+ | BankTransferData::PixAutomaticoQr {}
| BankTransferData::Pse {}
| BankTransferData::InstantBankTransferFinland {}
| BankTransferData::InstantBankTransferPoland {}
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index d8fca69ea5..1f0d21b3ca 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -6713,6 +6713,8 @@ pub enum PaymentMethodDataType {
DanamonVaBankTransfer,
MandiriVaBankTransfer,
Pix,
+ PixAutomaticoPush,
+ PixAutomaticoQr,
Pse,
Crypto,
MandatePayment,
@@ -6916,6 +6918,10 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
Self::MandiriVaBankTransfer
}
payment_method_data::BankTransferData::Pix { .. } => Self::Pix,
+ payment_method_data::BankTransferData::PixAutomaticoPush { .. } => {
+ Self::PixAutomaticoPush
+ }
+ payment_method_data::BankTransferData::PixAutomaticoQr {} => Self::PixAutomaticoQr,
payment_method_data::BankTransferData::Pse {} => Self::Pse,
payment_method_data::BankTransferData::LocalBankTransfer { .. } => {
Self::LocalBankTransfer
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 4114523bd2..cc17dc298f 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -1440,6 +1440,12 @@ pub enum BankTransferData {
/// The expiration date and time for the Pix QR code
expiry_date: Option<time::PrimitiveDateTime>,
},
+ PixAutomaticoPush {
+ account_number: Option<Secret<String>>,
+ branch_code: Option<Secret<String>>,
+ bank_identifier: Option<Secret<String>>,
+ },
+ PixAutomaticoQr {},
Pse {},
LocalBankTransfer {
bank_code: Option<String>,
@@ -2591,6 +2597,18 @@ impl From<BankTransferData> for api_models::payments::additional_info::BankTrans
expiry_date,
},
)),
+ BankTransferData::PixAutomaticoPush {
+ account_number,
+ branch_code,
+ bank_identifier,
+ } => Self::PixAutomaticoPush(Box::new(
+ api_models::payments::additional_info::PixAutomaticoPushAdditionalData {
+ account_number,
+ branch_code,
+ bank_identifier,
+ },
+ )),
+ BankTransferData::PixAutomaticoQr {} => Self::PixAutomaticoQr {},
BankTransferData::Pse {} => Self::Pse {},
BankTransferData::LocalBankTransfer { bank_code } => Self::LocalBankTransfer(Box::new(
api_models::payments::additional_info::LocalBankTransferAdditionalData {
@@ -2910,6 +2928,8 @@ impl GetPaymentMethodType for BankTransferData {
Self::DanamonVaBankTransfer { .. } => api_enums::PaymentMethodType::DanamonVa,
Self::MandiriVaBankTransfer { .. } => api_enums::PaymentMethodType::MandiriVa,
Self::Pix { .. } => api_enums::PaymentMethodType::Pix,
+ Self::PixAutomaticoPush { .. } => api_enums::PaymentMethodType::PixAutomaticoPush,
+ Self::PixAutomaticoQr {} => api_enums::PaymentMethodType::PixAutomaticoQr,
Self::Pse {} => api_enums::PaymentMethodType::Pse,
Self::LocalBankTransfer { .. } => api_enums::PaymentMethodType::LocalBankTransfer,
Self::InstantBankTransfer {} => api_enums::PaymentMethodType::InstantBankTransfer,
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 32d2a9139b..641fa7f50b 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -7,6 +7,7 @@ pub mod unified_authentication_service;
use api_models::payments::{
AdditionalPaymentData, AddressDetails, ConnectorMetadata, RequestSurchargeDetails,
};
+use common_enums;
use common_types::payments as common_payments_types;
use common_utils::{
consts, errors,
@@ -31,6 +32,36 @@ use crate::{
router_flow_types as flows, router_response_types as response_types,
vault::PaymentMethodCustomVaultingData,
};
+
+/// Current flow information passed to the connector specifications trait
+/// In order to make some decision about the preprocessing or alternate flow
+#[derive(Clone, Debug, Serialize)]
+pub enum CurrentFlowInfo {
+ /// Authorize flow information
+ Authorize {
+ /// The authentication type being used
+ auth_type: storage_enums::AuthenticationType,
+ /// The payment authorize request data
+ request_data: Box<PaymentsAuthorizeData>,
+ },
+ /// CompleteAuthorize flow information
+ CompleteAuthorize {
+ /// The authentication type being used
+ auth_type: storage_enums::AuthenticationType,
+ /// The payment authorize request data
+ request_data: Box<CompleteAuthorizeData>,
+ /// The payment method that is used
+ payment_method: Option<common_enums::PaymentMethod>,
+ },
+ /// SetupMandate flow information
+ SetupMandate {
+ /// The authentication type being used
+ auth_type: storage_enums::AuthenticationType,
+ /// The payment setup mandate request data
+ request_data: Box<SetupMandateRequestData>,
+ },
+}
+
#[derive(Debug, Clone, Serialize)]
pub struct PaymentsAuthorizeData {
pub payment_method_data: PaymentMethodData,
@@ -1370,6 +1401,7 @@ pub struct AccessTokenRequestData {
pub app_id: Secret<String>,
pub id: Option<Secret<String>>,
pub authentication_token: Option<AccessTokenAuthenticationResponse>,
+ pub current_flow: Option<CurrentFlowInfo>,
// Add more keys if required
}
@@ -1382,21 +1414,25 @@ impl TryFrom<router_data::ConnectorAuthType> for AccessTokenRequestData {
app_id: api_key,
id: None,
authentication_token: None,
+ current_flow: None,
}),
router_data::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
app_id: api_key,
id: Some(key1),
authentication_token: None,
+ current_flow: None,
}),
router_data::ConnectorAuthType::SignatureKey { api_key, key1, .. } => Ok(Self {
app_id: api_key,
id: Some(key1),
authentication_token: None,
+ current_flow: None,
}),
router_data::ConnectorAuthType::MultiAuthKey { api_key, key1, .. } => Ok(Self {
app_id: api_key,
id: Some(key1),
authentication_token: None,
+ current_flow: None,
}),
router_data::ConnectorAuthType::CertificateAuth {
certificate,
@@ -1406,6 +1442,7 @@ impl TryFrom<router_data::ConnectorAuthType> for AccessTokenRequestData {
app_id: certificate,
id: Some(private_key),
authentication_token: None,
+ current_flow: None,
}),
_ => Err(ApiErrorResponse::InvalidDataValue {
@@ -1419,17 +1456,20 @@ impl
TryFrom<(
router_data::ConnectorAuthType,
Option<AccessTokenAuthenticationResponse>,
+ Option<CurrentFlowInfo>,
)> for AccessTokenRequestData
{
type Error = ApiErrorResponse;
fn try_from(
- (connector_auth, authentication_token): (
+ (connector_auth, authentication_token, current_flow): (
router_data::ConnectorAuthType,
Option<AccessTokenAuthenticationResponse>,
+ Option<CurrentFlowInfo>,
),
) -> Result<Self, Self::Error> {
let mut access_token_request_data = Self::try_from(connector_auth)?;
access_token_request_data.authentication_token = authentication_token;
+ access_token_request_data.current_flow = current_flow;
Ok(access_token_request_data)
}
}
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index 4837d90c7a..610c65f9e0 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -43,6 +43,7 @@ use common_utils::{
request::{Method, Request, RequestContent},
};
use error_stack::ResultExt;
+pub use hyperswitch_domain_models::router_request_types::CurrentFlowInfo;
use hyperswitch_domain_models::{
connector_endpoints::Connectors,
errors::api_error_response::ApiErrorResponse,
@@ -405,44 +406,18 @@ impl ConnectorAccessTokenSuffix for BoxedConnector {
&self,
router_data: &dyn AccessTokenData,
merchant_connector_id_or_connector_name: String,
+ current_flow: Option<CurrentFlowInfo>,
) -> CustomResult<String, errors::ConnectorError> {
// 'self' is the BoxedConnector (the Box)
// We dereference it to get the 'dyn Connector' and call the method
- self.as_ref()
- .get_access_token_key(router_data, merchant_connector_id_or_connector_name)
+ self.as_ref().get_access_token_key(
+ router_data,
+ merchant_connector_id_or_connector_name,
+ current_flow,
+ )
}
}
-/// Current flow information passed to the connector specifications trait
-///
-/// In order to make some desicion about the preprocessing or alternate flow
-#[derive(Clone, Debug)]
-pub enum CurrentFlowInfo<'a> {
- /// Authorize flow information
- Authorize {
- /// The authentication type being used
- auth_type: &'a enums::AuthenticationType,
- /// The payment authorize request data
- request_data: &'a router_request_types::PaymentsAuthorizeData,
- },
- /// CompleteAuthorize flow information
- CompleteAuthorize {
- /// The authentication type being used
- auth_type: &'a enums::AuthenticationType,
- /// The payment authorize request data
- request_data: &'a router_request_types::CompleteAuthorizeData,
- /// The payment method that is used
- payment_method: Option<PaymentMethod>,
- },
- /// SetupMandate flow information
- SetupMandate {
- /// The authentication type being used
- auth_type: &'a enums::AuthenticationType,
- /// The payment setup mandate request data
- request_data: &'a router_request_types::SetupMandateRequestData,
- },
-}
-
/// Alternate API flow that must be made instead of the current flow.
/// For example, PreAuthenticate flow must be made instead of Authorize flow.
#[derive(Debug, Clone, Copy)]
@@ -475,40 +450,40 @@ pub struct PreProcessingFlowResponse<'a> {
/// The trait that provides specifications about the connector
pub trait ConnectorSpecifications {
/// Check if pre-authentication flow is required
- fn is_balance_check_flow_required(&self, _current_flow: CurrentFlowInfo<'_>) -> bool {
+ fn is_balance_check_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {
false
}
/// Check if pre-authentication flow is required
- fn is_order_create_flow_required(&self, _current_flow: CurrentFlowInfo<'_>) -> bool {
+ fn is_order_create_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {
false
}
/// Check if pre-authentication flow is required
- fn is_pre_authentication_flow_required(&self, _current_flow: CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {
false
}
/// Check if authentication flow is required
- fn is_authentication_flow_required(&self, _current_flow: CurrentFlowInfo<'_>) -> bool {
+ fn is_authentication_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {
false
}
/// Check if post-authentication flow is required
- fn is_post_authentication_flow_required(&self, _current_flow: CurrentFlowInfo<'_>) -> bool {
+ fn is_post_authentication_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {
false
}
/// Check if pre-authentication flow is required
- fn is_settlement_split_call_required(&self, _current_flow: CurrentFlowInfo<'_>) -> bool {
+ fn is_settlement_split_call_required(&self, _current_flow: CurrentFlowInfo) -> bool {
false
}
/// Preprocessing flow name if any, that must be made before the current flow.
fn get_preprocessing_flow_if_needed(
&self,
- _current_flow: CurrentFlowInfo<'_>,
+ _current_flow: CurrentFlowInfo,
) -> Option<PreProcessingFlowName> {
None
}
/// If Some is returned, the returned api flow must be made instead of the current flow.
fn get_alternate_flow_if_needed(
&self,
- _current_flow: CurrentFlowInfo<'_>,
+ _current_flow: CurrentFlowInfo,
) -> Option<AlternateFlow> {
None
}
@@ -596,7 +571,10 @@ pub trait ConnectorSpecifications {
}
/// Is Authorize session token required before authorize
- fn is_authorize_session_token_call_required(&self) -> bool {
+ fn is_authorize_session_token_call_required(
+ &self,
+ _current_flow: Option<CurrentFlowInfo>,
+ ) -> bool {
false
}
@@ -1033,6 +1011,7 @@ pub trait ConnectorAccessTokenSuffix {
&self,
router_data: &dyn AccessTokenData,
merchant_connector_id_or_connector_name: String,
+ _current_flow: Option<CurrentFlowInfo>,
) -> CustomResult<String, errors::ConnectorError> {
Ok(common_utils::access_token::get_default_access_token_key(
&router_data.get_merchant_id(),
diff --git a/crates/hyperswitch_interfaces/src/connector_integration_interface.rs b/crates/hyperswitch_interfaces/src/connector_integration_interface.rs
index da73bbe90a..33f1a5b61b 100644
--- a/crates/hyperswitch_interfaces/src/connector_integration_interface.rs
+++ b/crates/hyperswitch_interfaces/src/connector_integration_interface.rs
@@ -8,6 +8,7 @@ use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, ErrorResponse, RouterData},
router_data_v2::RouterDataV2,
+ router_request_types::CurrentFlowInfo,
router_response_types::{ConnectorInfo, SupportedPaymentMethods},
};
@@ -149,6 +150,7 @@ impl ConnectorEnum {
&self,
router_data: &RouterData<F, Req, Res>,
merchant_connector_id_or_connector_name: String,
+ current_flow: Option<CurrentFlowInfo>,
) -> CustomResult<String, errors::ConnectorError> {
match self {
Self::Old(connector) => {
@@ -157,6 +159,7 @@ impl ConnectorEnum {
// router_data as &dyn AccessTokenData,
router_data,
merchant_connector_id_or_connector_name,
+ current_flow,
)
}
Self::New(connector) => {
@@ -164,6 +167,7 @@ impl ConnectorEnum {
// router_data as &dyn AccessTokenData,
router_data,
merchant_connector_id_or_connector_name,
+ current_flow,
)
}
}
@@ -571,39 +575,38 @@ impl ConnectorValidation for ConnectorEnum {
}
}
}
-
impl ConnectorSpecifications for ConnectorEnum {
- fn is_balance_check_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_balance_check_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {
match self {
Self::Old(connector) => connector.is_balance_check_flow_required(current_flow),
Self::New(connector) => connector.is_balance_check_flow_required(current_flow),
}
}
- fn is_order_create_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_order_create_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {
match self {
Self::Old(connector) => connector.is_order_create_flow_required(current_flow),
Self::New(connector) => connector.is_order_create_flow_required(current_flow),
}
}
- fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_pre_authentication_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {
match self {
Self::Old(connector) => connector.is_pre_authentication_flow_required(current_flow),
Self::New(connector) => connector.is_pre_authentication_flow_required(current_flow),
}
}
- fn is_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_authentication_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {
match self {
Self::Old(connector) => connector.is_authentication_flow_required(current_flow),
Self::New(connector) => connector.is_authentication_flow_required(current_flow),
}
}
- fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_post_authentication_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {
match self {
Self::Old(connector) => connector.is_post_authentication_flow_required(current_flow),
Self::New(connector) => connector.is_post_authentication_flow_required(current_flow),
}
}
- fn is_settlement_split_call_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ fn is_settlement_split_call_required(&self, current_flow: CurrentFlowInfo) -> bool {
match self {
Self::Old(connector) => connector.is_settlement_split_call_required(current_flow),
Self::New(connector) => connector.is_settlement_split_call_required(current_flow),
@@ -611,7 +614,7 @@ impl ConnectorSpecifications for ConnectorEnum {
}
fn get_preprocessing_flow_if_needed(
&self,
- current_flow_info: api::CurrentFlowInfo<'_>,
+ current_flow_info: CurrentFlowInfo,
) -> Option<api::PreProcessingFlowName> {
match self {
Self::Old(connector) => connector.get_preprocessing_flow_if_needed(current_flow_info),
@@ -620,7 +623,7 @@ impl ConnectorSpecifications for ConnectorEnum {
}
fn get_alternate_flow_if_needed(
&self,
- current_flow: api::CurrentFlowInfo<'_>,
+ current_flow: CurrentFlowInfo,
) -> Option<api::AlternateFlow> {
match self {
Self::Old(connector) => connector.get_alternate_flow_if_needed(current_flow),
@@ -695,10 +698,17 @@ impl ConnectorSpecifications for ConnectorEnum {
}
/// Check if the connector needs authorize session token call
- fn is_authorize_session_token_call_required(&self) -> bool {
+ fn is_authorize_session_token_call_required(
+ &self,
+ current_flow: Option<CurrentFlowInfo>,
+ ) -> bool {
match self {
- Self::Old(connector) => connector.is_authorize_session_token_call_required(),
- Self::New(connector) => connector.is_authorize_session_token_call_required(),
+ Self::Old(connector) => {
+ connector.is_authorize_session_token_call_required(current_flow)
+ }
+ Self::New(connector) => {
+ connector.is_authorize_session_token_call_required(current_flow)
+ }
}
}
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index 5b3284003e..08bde828ff 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -65,6 +65,12 @@ fn get_dir_value_payment_method(
api_enums::PaymentMethodType::Cashapp => Ok(dirval!(WalletType = Cashapp)),
api_enums::PaymentMethodType::Multibanco => Ok(dirval!(BankTransferType = Multibanco)),
api_enums::PaymentMethodType::Pix => Ok(dirval!(BankTransferType = Pix)),
+ api_enums::PaymentMethodType::PixAutomaticoPush => {
+ Ok(dirval!(BankTransferType = PixAutomaticoPush))
+ }
+ api_enums::PaymentMethodType::PixAutomaticoQr => {
+ Ok(dirval!(BankTransferType = PixAutomaticoQr))
+ }
api_enums::PaymentMethodType::Pse => Ok(dirval!(BankTransferType = Pse)),
api_enums::PaymentMethodType::Interac => Ok(dirval!(BankRedirectType = Interac)),
api_enums::PaymentMethodType::OnlineBankingCzechRepublic => {
diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs
index 162d28ab03..cb948d2911 100644
--- a/crates/kgraph_utils/src/transformers.rs
+++ b/crates/kgraph_utils/src/transformers.rs
@@ -220,6 +220,12 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
api_enums::PaymentMethodType::Cashapp => Ok(dirval!(WalletType = Cashapp)),
api_enums::PaymentMethodType::Multibanco => Ok(dirval!(BankTransferType = Multibanco)),
api_enums::PaymentMethodType::Pix => Ok(dirval!(BankTransferType = Pix)),
+ api_enums::PaymentMethodType::PixAutomaticoPush => {
+ Ok(dirval!(BankTransferType = PixAutomaticoPush))
+ }
+ api_enums::PaymentMethodType::PixAutomaticoQr => {
+ Ok(dirval!(BankTransferType = PixAutomaticoQr))
+ }
api_enums::PaymentMethodType::Pse => Ok(dirval!(BankTransferType = Pse)),
api_enums::PaymentMethodType::Interac => Ok(dirval!(BankRedirectType = Interac)),
api_enums::PaymentMethodType::OnlineBankingCzechRepublic => {
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 1846d0b489..872ae84d00 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -951,6 +951,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::additional_info::UpiCollectAdditionalData,
api_models::payments::additional_info::WalletAdditionalDataForCard,
api_models::payments::additional_info::SepaBankTransferPaymentAdditionalData,
+ api_models::payments::additional_info::PixAutomaticoPushAdditionalData,
api_models::payments::PaymentsDynamicTaxCalculationRequest,
api_models::payments::WalletResponse,
api_models::payments::WalletResponseData,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index bd461f25c8..45db353b49 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -888,6 +888,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::additional_info::UpiCollectAdditionalData,
api_models::payments::additional_info::WalletAdditionalDataForCard,
api_models::payments::additional_info::SepaBankTransferPaymentAdditionalData,
+ api_models::payments::additional_info::PixAutomaticoPushAdditionalData,
api_models::payments::WalletResponse,
api_models::payments::WalletResponseData,
api_models::payments::PaymentsDynamicTaxCalculationRequest,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index f5c8a4de1f..afaedf49ce 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2615,6 +2615,8 @@ pub enum PaymentMethodDataType {
DanamonVaBankTransfer,
MandiriVaBankTransfer,
Pix,
+ PixAutomaticoPush,
+ PixAutomaticoQr,
Pse,
Crypto,
MandatePayment,
@@ -2813,6 +2815,8 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
Self::MandiriVaBankTransfer
}
domain::payments::BankTransferData::Pix { .. } => Self::Pix,
+ domain::payments::BankTransferData::PixAutomaticoPush { .. } => Self::PixAutomaticoPush,
+ domain::payments::BankTransferData::PixAutomaticoQr {} => Self::PixAutomaticoQr,
domain::payments::BankTransferData::Pse {} => Self::Pse,
domain::payments::BankTransferData::LocalBankTransfer { .. } => {
Self::LocalBankTransfer
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 2fed7ffa35..1968423155 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4490,16 +4490,17 @@ where
)
.await?;
- router_data
- .add_session_token(state, &connector, &context)
- .await?;
-
let should_continue_further = access_token::update_router_data_with_access_token_result(
&add_access_token_result,
&mut router_data,
&call_connector_action,
);
+ // AuthorizeSessionTokenFlow needs access token to be added in router data before creating session token, as the session token creation might require access token in headers for some connectors (like Santander)
+ router_data
+ .add_session_token(state, &connector, &context)
+ .await?;
+
// Balance check flow for payment methods like Giftcard, Voucher etc.
let should_continue_further = if should_continue_further {
let balance_check_response = router_data
@@ -5068,15 +5069,16 @@ where
)
.await?;
- router_data
- .add_session_token(state, &connector, &gateway_context)
- .await?;
-
let should_continue_further = access_token::update_router_data_with_access_token_result(
&add_access_token_result,
&mut router_data,
&call_connector_action,
);
+
+ router_data
+ .add_session_token(state, &connector, &gateway_context)
+ .await?;
+
let payment_method_token_response = router_data
.add_payment_method_token(
state,
@@ -6038,16 +6040,16 @@ where
)
.await?;
- router_data
- .add_session_token(state, &connector, &default_gateway_context)
- .await?;
-
let mut should_continue_further = access_token::update_router_data_with_access_token_result(
&add_access_token_result,
&mut router_data,
&call_connector_action,
);
+ router_data
+ .add_session_token(state, &connector, &default_gateway_context)
+ .await?;
+
let (connector_request, should_continue_further) = if should_continue_further {
router_data
.build_flow_specific_connector_request(state, &connector, call_connector_action.clone())
diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rs
index a8c56a7f5e..76e0555a6f 100644
--- a/crates/router/src/core/payments/access_token.rs
+++ b/crates/router/src/core/payments/access_token.rs
@@ -124,6 +124,7 @@ pub async fn add_access_token<
router_data: &types::RouterData<F, Req, Res>,
creds_identifier: Option<&str>,
gateway_context: &gateway_context::RouterGatewayContext,
+ current_flow: Option<hyperswitch_domain_models::router_request_types::CurrentFlowInfo>,
) -> RouterResult<types::AddAccessTokenResult> {
if connector
.connector_name
@@ -147,7 +148,11 @@ pub async fn add_access_token<
let key = connector
.connector
- .get_access_token_key(router_data, merchant_connector_id_or_connector_name.clone())
+ .get_access_token_key(
+ router_data,
+ merchant_connector_id_or_connector_name.clone(),
+ current_flow.clone(),
+ )
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(format!(
"Failed to get access token key for connector: {:?}",
@@ -197,6 +202,7 @@ pub async fn add_access_token<
let refresh_token_request_data = types::AccessTokenRequestData::try_from((
router_data.connector_auth_type.clone(),
authentication_token,
+ current_flow,
))
.attach_printable(
"Could not create access token request, invalid connector account credentials",
diff --git a/crates/router/src/core/payments/flows/approve_flow.rs b/crates/router/src/core/payments/flows/approve_flow.rs
index d314e32a78..cb83fe2970 100644
--- a/crates/router/src/core/payments/flows/approve_flow.rs
+++ b/crates/router/src/core/payments/flows/approve_flow.rs
@@ -97,6 +97,7 @@ impl Feature<api::Approve, types::PaymentsApproveData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index 52718ee387..c39ec296c2 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -286,8 +286,8 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
) -> RouterResult<types::BalanceCheckResult> {
if connector.connector.is_balance_check_flow_required(
api_interface::CurrentFlowInfo::Authorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
@@ -396,12 +396,17 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
creds_identifier: Option<&str>,
gateway_context: &gateway_context::RouterGatewayContext,
) -> RouterResult<types::AddAccessTokenResult> {
+ let current_flow = Some(api_interface::CurrentFlowInfo::Authorize {
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
+ });
Box::pin(access_token::add_access_token(
state,
connector,
self,
creds_identifier,
gateway_context,
+ current_flow,
))
.await
}
@@ -415,9 +420,18 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
where
Self: Sized,
{
- self.session_token =
- session_token::add_session_token_if_needed(self, state, connector, gateway_context)
- .await?;
+ let current_flow = api_interface::CurrentFlowInfo::Authorize {
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
+ };
+ self.session_token = session_token::add_session_token_if_needed(
+ self,
+ state,
+ connector,
+ gateway_context,
+ Some(current_flow),
+ )
+ .await?;
Ok(())
}
@@ -453,8 +467,8 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
{
if connector.connector.is_pre_authentication_flow_required(
api_interface::CurrentFlowInfo::Authorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
@@ -568,8 +582,8 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
{
if connector.connector.is_authentication_flow_required(
api_interface::CurrentFlowInfo::Authorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
@@ -822,8 +836,8 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
) -> RouterResult<(Self, bool)> {
if connector.connector.is_settlement_split_call_required(
api_interface::CurrentFlowInfo::Authorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
@@ -893,8 +907,8 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
) -> RouterResult<Option<types::CreateOrderResult>> {
let is_order_create_bloated_connector = connector.connector.is_order_create_flow_required(
api_interface::CurrentFlowInfo::Authorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
);
if (connector
diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs
index ae911c4a59..e6d82ff650 100644
--- a/crates/router/src/core/payments/flows/cancel_flow.rs
+++ b/crates/router/src/core/payments/flows/cancel_flow.rs
@@ -119,6 +119,7 @@ impl Feature<api::Void, types::PaymentsCancelData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/cancel_post_capture_flow.rs b/crates/router/src/core/payments/flows/cancel_post_capture_flow.rs
index b9bb25f416..944badffab 100644
--- a/crates/router/src/core/payments/flows/cancel_post_capture_flow.rs
+++ b/crates/router/src/core/payments/flows/cancel_post_capture_flow.rs
@@ -121,6 +121,7 @@ impl Feature<api::PostCaptureVoid, types::PaymentsCancelPostCaptureData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/capture_flow.rs b/crates/router/src/core/payments/flows/capture_flow.rs
index 0e5910433c..d1ce1f7261 100644
--- a/crates/router/src/core/payments/flows/capture_flow.rs
+++ b/crates/router/src/core/payments/flows/capture_flow.rs
@@ -130,6 +130,7 @@ impl Feature<api::Capture, types::PaymentsCaptureData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
index 9c8b190c82..7bab3e897e 100644
--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
@@ -172,9 +172,9 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
) -> RouterResult<types::BalanceCheckResult> {
if connector.connector.is_balance_check_flow_required(
api_interface::CurrentFlowInfo::CompleteAuthorize {
- auth_type: &self.auth_type,
+ auth_type: self.auth_type,
payment_method: Some(self.payment_method),
- request_data: &self.request,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
@@ -289,6 +289,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
@@ -358,8 +359,8 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
{
if connector.connector.is_authentication_flow_required(
api_interface::CurrentFlowInfo::CompleteAuthorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
payment_method: Some(self.payment_method),
},
) {
@@ -445,8 +446,8 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
{
if connector.connector.is_post_authentication_flow_required(
api_interface::CurrentFlowInfo::CompleteAuthorize {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
payment_method: Some(self.payment_method),
},
) {
diff --git a/crates/router/src/core/payments/flows/extend_authorization_flow.rs b/crates/router/src/core/payments/flows/extend_authorization_flow.rs
index 6a8ee66632..5356655c63 100644
--- a/crates/router/src/core/payments/flows/extend_authorization_flow.rs
+++ b/crates/router/src/core/payments/flows/extend_authorization_flow.rs
@@ -121,6 +121,7 @@ impl Feature<api::ExtendAuthorization, types::PaymentsExtendAuthorizationData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/external_proxy_flow.rs b/crates/router/src/core/payments/flows/external_proxy_flow.rs
index ffd1597589..b96c063d9e 100644
--- a/crates/router/src/core/payments/flows/external_proxy_flow.rs
+++ b/crates/router/src/core/payments/flows/external_proxy_flow.rs
@@ -130,6 +130,7 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
@@ -143,9 +144,14 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>
where
Self: Sized,
{
- self.session_token =
- session_token::add_session_token_if_needed(self, state, connector, gateway_context)
- .await?;
+ self.session_token = session_token::add_session_token_if_needed(
+ self,
+ state,
+ connector,
+ gateway_context,
+ None,
+ )
+ .await?;
Ok(())
}
diff --git a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs
index fc6b3915e7..d49ccf1412 100644
--- a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs
+++ b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs
@@ -109,6 +109,7 @@ impl Feature<api::IncrementalAuthorization, types::PaymentsIncrementalAuthorizat
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/post_session_tokens_flow.rs b/crates/router/src/core/payments/flows/post_session_tokens_flow.rs
index c879e22ac7..81f4b075e1 100644
--- a/crates/router/src/core/payments/flows/post_session_tokens_flow.rs
+++ b/crates/router/src/core/payments/flows/post_session_tokens_flow.rs
@@ -115,6 +115,7 @@ impl Feature<api::PostSessionTokens, types::PaymentsPostSessionTokensData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs
index a997a6b37f..041595292c 100644
--- a/crates/router/src/core/payments/flows/psync_flow.rs
+++ b/crates/router/src/core/payments/flows/psync_flow.rs
@@ -176,6 +176,7 @@ impl Feature<api::PSync, types::PaymentsSyncData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/reject_flow.rs b/crates/router/src/core/payments/flows/reject_flow.rs
index 9cf3ad88e3..37a5eb92f2 100644
--- a/crates/router/src/core/payments/flows/reject_flow.rs
+++ b/crates/router/src/core/payments/flows/reject_flow.rs
@@ -94,6 +94,7 @@ impl Feature<api::Reject, types::PaymentsRejectData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 15b259b395..a492021d04 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -142,6 +142,7 @@ impl Feature<api::Session, types::PaymentsSessionData> for types::PaymentsSessio
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/session_update_flow.rs b/crates/router/src/core/payments/flows/session_update_flow.rs
index b9ef952718..ed7e4fa8de 100644
--- a/crates/router/src/core/payments/flows/session_update_flow.rs
+++ b/crates/router/src/core/payments/flows/session_update_flow.rs
@@ -113,6 +113,7 @@ impl Feature<api::SdkSessionUpdate, types::SdkPaymentsSessionUpdateData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
index 3ccc6f6358..10b4b0e398 100644
--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -157,8 +157,8 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
) -> RouterResult<types::BalanceCheckResult> {
if connector.connector.is_balance_check_flow_required(
api_interface::CurrentFlowInfo::SetupMandate {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
@@ -267,12 +267,17 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
creds_identifier: Option<&str>,
gateway_context: &gateway_context::RouterGatewayContext,
) -> RouterResult<types::AddAccessTokenResult> {
+ let current_flow = Some(api_interface::CurrentFlowInfo::SetupMandate {
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
+ });
Box::pin(access_token::add_access_token(
state,
connector,
self,
creds_identifier,
gateway_context,
+ current_flow,
))
.await
}
@@ -286,9 +291,18 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
where
Self: Sized,
{
- self.session_token =
- session_token::add_session_token_if_needed(self, state, connector, gateway_context)
- .await?;
+ let current_flow = api_interface::CurrentFlowInfo::SetupMandate {
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
+ };
+ self.session_token = session_token::add_session_token_if_needed(
+ self,
+ state,
+ connector,
+ gateway_context,
+ Some(current_flow),
+ )
+ .await?;
Ok(())
}
@@ -335,8 +349,8 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
{
if connector.connector.is_pre_authentication_flow_required(
api_interface::CurrentFlowInfo::SetupMandate {
- auth_type: &self.auth_type,
- request_data: &self.request,
+ auth_type: self.auth_type,
+ request_data: Box::new(self.request.clone()),
},
) {
logger::info!(
diff --git a/crates/router/src/core/payments/flows/update_metadata_flow.rs b/crates/router/src/core/payments/flows/update_metadata_flow.rs
index c66efdbfb5..98023f0d59 100644
--- a/crates/router/src/core/payments/flows/update_metadata_flow.rs
+++ b/crates/router/src/core/payments/flows/update_metadata_flow.rs
@@ -112,6 +112,7 @@ impl Feature<api::UpdateMetadata, types::PaymentsUpdateMetadataData>
self,
creds_identifier,
gateway_context,
+ None,
))
.await
}
diff --git a/crates/router/src/core/payments/session_token.rs b/crates/router/src/core/payments/session_token.rs
index d22453cc79..fa9ae5cbd3 100644
--- a/crates/router/src/core/payments/session_token.rs
+++ b/crates/router/src/core/payments/session_token.rs
@@ -19,6 +19,7 @@ pub(crate) async fn add_session_token_if_needed<F: Clone, Req: Debug + Clone>(
state: &routes::SessionState,
connector: &api_types::ConnectorData,
gateway_context: &gateway_context::RouterGatewayContext,
+ current_flow: Option<hyperswitch_interfaces::api::CurrentFlowInfo>,
) -> RouterResult<Option<String>>
where
types::AuthorizeSessionTokenData:
@@ -26,7 +27,7 @@ where
{
if connector
.connector
- .is_authorize_session_token_call_required()
+ .is_authorize_session_token_call_required(current_flow)
{
let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
api_types::AuthorizeSessionToken,
diff --git a/crates/router/src/core/payouts/access_token.rs b/crates/router/src/core/payouts/access_token.rs
index cbf5ac0139..f7fa11e353 100644
--- a/crates/router/src/core/payouts/access_token.rs
+++ b/crates/router/src/core/payouts/access_token.rs
@@ -57,7 +57,7 @@ pub async fn add_access_token_for_payout<F: Clone + 'static>(
let key = connector
.connector
- .get_access_token_key(router_data, connector.connector.id().to_string())
+ .get_access_token_key(router_data, connector.connector.id().to_string(), None)
.change_context(errors::ApiErrorResponse::InternalServerError)?;
let old_access_token = store
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 83515bb782..94c65ed9c4 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -266,6 +266,7 @@ pub async fn trigger_refund_to_gateway(
&router_data,
creds_identifier.as_deref(),
&gateway_context,
+ None,
))
.await?;
@@ -953,6 +954,7 @@ pub async fn sync_refund_with_gateway(
&router_data,
creds_identifier.as_deref(),
&gateway_context,
+ None,
))
.await?;
diff --git a/crates/router/src/core/refunds_v2.rs b/crates/router/src/core/refunds_v2.rs
index bd3333cfb8..87fc645e71 100644
--- a/crates/router/src/core/refunds_v2.rs
+++ b/crates/router/src/core/refunds_v2.rs
@@ -181,6 +181,7 @@ pub async fn trigger_refund_to_gateway(
&router_data,
None,
&default_gateway_context,
+ None,
))
.await?;
@@ -306,6 +307,7 @@ pub async fn internal_trigger_refund_to_gateway(
&router_data,
None,
&default_gateway_context,
+ None,
))
.await?;
@@ -889,6 +891,7 @@ pub async fn sync_refund_with_gateway(
&router_data,
None,
&default_gateway_context,
+ None,
))
.await?;
@@ -988,6 +991,7 @@ pub async fn internal_sync_refund_with_gateway(
&router_data,
None,
&default_gateway_context,
+ None,
))
.await?;
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 3c94308716..fee36b95cd 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1103,6 +1103,13 @@ pub fn build_unified_connector_service_payment_method(
}),
})),
}),
+ hyperswitch_domain_models::payment_method_data::BankTransferData::PixAutomaticoPush { .. }
+ | hyperswitch_domain_models::payment_method_data::BankTransferData::PixAutomaticoQr {} => {
+ Err(UnifiedConnectorServiceError::NotImplemented(format!(
+ "Unimplemented payment method subtype: {payment_method_type:?}"
+ ))
+ .into())
+ }
hyperswitch_domain_models::payment_method_data::BankTransferData::PermataBankTransfer {} => {
Ok(payments_grpc::PaymentMethod {
payment_method: Some(PaymentMethod::PermataBankTransfer(
diff --git a/crates/router/src/services/email/types.rs b/crates/router/src/services/email/types.rs
index 68a96f220e..76b6f6c213 100644
--- a/crates/router/src/services/email/types.rs
+++ b/crates/router/src/services/email/types.rs
@@ -760,8 +760,12 @@ impl EmailData for RoleDeleted {
EntityType::Profile => vec![org_info, merchant_info, profile_info],
}
.into_iter()
- .map(|item| format!("<li>{}</li>", item))
- .collect::<String>();
+ .fold(String::new(), |mut acc, item| {
+ acc.push_str("<li>");
+ acc.push_str(&item);
+ acc.push_str("</li>");
+ acc
+ });
let body = html::get_html_body(EmailBody::RoleDeleted {
user_name: self.user_name.clone().get_secret().expose(),
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 0b332866ac..ca100606ea 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -400,6 +400,8 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::InstantBankTransferPoland
| api_enums::PaymentMethodType::SepaBankTransfer
| api_enums::PaymentMethodType::IndonesianBankTransfer
+ | api_enums::PaymentMethodType::PixAutomaticoPush
+ | api_enums::PaymentMethodType::PixAutomaticoQr
| api_enums::PaymentMethodType::Pix => Self::BankTransfer,
api_enums::PaymentMethodType::Givex
| api_enums::PaymentMethodType::PaySafeCard