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(core/connector): [SANTANDER] Add & Implement PushNotification & GenerateQr Connector Integration Flow (#11553)
Sayak Bhattacharya2eb3106753d3
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 24753090f8..2e1eef8389 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -20098,6 +20098,14 @@}],"nullable": true+ },+ "pix_automatico_additional_details": {+ "allOf": [+ {+ "$ref": "#/components/schemas/PixAutomaticoAdditionalDetails"+ }+ ],+ "nullable": true}}},@@ -35452,6 +35460,34 @@}]},+ "PixAutomaticoAdditionalDetails": {+ "oneOf": [+ {+ "allOf": [+ {+ "$ref": "#/components/schemas/PixAutomaticoPushDetails"+ },+ {+ "type": "object",+ "required": [+ "type"+ ],+ "properties": {+ "type": {+ "type": "string",+ "enum": [+ "pix_automatico_push"+ ]+ }+ }+ }+ ]+ }+ ],+ "discriminator": {+ "propertyName": "type"+ }+ },"PixAutomaticoPushAdditionalData": {"type": "object","properties": {@@ -35475,6 +35511,21 @@}}},+ "PixAutomaticoPushDetails": {+ "type": "object",+ "required": [+ "time"+ ],+ "properties": {+ "time": {+ "type": "integer",+ "format": "int32",+ "description": "Time in seconds until which the push notification is valid",+ "example": 3600,+ "minimum": 0+ }+ }+ },"PixBankTransfer": {"type": "object","required": [diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex f65ea75b15..5d6d5fdd1c 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -13894,6 +13894,14 @@}],"nullable": true+ },+ "pix_automatico_additional_details": {+ "allOf": [+ {+ "$ref": "#/components/schemas/PixAutomaticoAdditionalDetails"+ }+ ],+ "nullable": true}}},@@ -25664,6 +25672,34 @@}]},+ "PixAutomaticoAdditionalDetails": {+ "oneOf": [+ {+ "allOf": [+ {+ "$ref": "#/components/schemas/PixAutomaticoPushDetails"+ },+ {+ "type": "object",+ "required": [+ "type"+ ],+ "properties": {+ "type": {+ "type": "string",+ "enum": [+ "pix_automatico_push"+ ]+ }+ }+ }+ ]+ }+ ],+ "discriminator": {+ "propertyName": "type"+ }+ },"PixAutomaticoPushAdditionalData": {"type": "object","properties": {@@ -25687,6 +25723,21 @@}}},+ "PixAutomaticoPushDetails": {+ "type": "object",+ "required": [+ "time"+ ],+ "properties": {+ "time": {+ "type": "integer",+ "format": "int32",+ "description": "Time in seconds until which the push notification is valid",+ "example": 3600,+ "minimum": 0+ }+ }+ },"PixBankTransfer": {"type": "object","required": [diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 6aa8f06995..4cd17d9b0c 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -11406,6 +11406,8 @@ pub struct FeatureMetadata {pub pix_additional_details: Option<PixAdditionalDetails>,/// Extra information like fine percentage, interest percentage etc required for Pix payment methodpub boleto_additional_details: Option<BoletoAdditionalDetails>,+ /// Pix Automatico additional details for Push and QR flows+ pub pix_automatico_additional_details: Option<PixAutomaticoAdditionalDetails>,}#[cfg(feature = "v2")]@@ -11421,6 +11423,21 @@ impl FeatureMetadata {.as_ref().and_then(|boleto| boleto.covenant_code.clone())}+ /// Gets the Pix Automatico Push expiry time in seconds, returns error if not present+ pub fn get_pix_automatico_push_expiry_time(&self) -> Result<u32, ValidationError> {+ self.pix_automatico_additional_details+ .as_ref()+ .ok_or(ValidationError::MissingRequiredField {+ field_name: "feature_metadata.pix_automatico_additional_details".to_string(),+ })+ .and_then(|details| match details {+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => Ok(push.time),+ _ => Err(ValidationError::InvalidValue {+ message: "pix_automatico_additional_details is not of type PixAutomaticoPush"+ .to_string(),+ }),+ })+ }pub fn set_payment_revenue_recovery_metadata_using_api(self,payment_revenue_recovery_metadata: PaymentRevenueRecoveryMetadata,@@ -11432,6 +11449,7 @@ impl FeatureMetadata {revenue_recovery: Some(payment_revenue_recovery_metadata),pix_additional_details: self.pix_additional_details,boleto_additional_details: self.boleto_additional_details,+ pix_automatico_additional_details: self.pix_automatico_additional_details,}}/// Extracts the Pix key and its secret value specifically from PixAdditionalDetails@@ -11482,6 +11500,9 @@ pub struct FeatureMetadata {/// Extra information like fine percentage, interest percentage etc required for Pix payment method#[smithy(value_type = "Option<BoletoAdditionalDetails>")]pub boleto_additional_details: Option<BoletoAdditionalDetails>,+ /// Pix Automatico additional details for Push Notification and QR based flows+ #[smithy(value_type = "Option<PixAutomaticoAdditionalDetails>")]+ pub pix_automatico_additional_details: Option<PixAutomaticoAdditionalDetails>,}#[cfg(feature = "v1")]impl FeatureMetadata {@@ -11491,6 +11512,17 @@ impl FeatureMetadata {.as_ref().and_then(|boleto| boleto.covenant_code.clone())}+ /// Gets the Pix Automatico Push expiry time in seconds, returns error if not present+ pub fn get_pix_automatico_push_expiry_time(&self) -> Result<u32, ValidationError> {+ self.pix_automatico_additional_details+ .as_ref()+ .ok_or(ValidationError::MissingRequiredField {+ field_name: "feature_metadata.pix_automatico_additional_details".to_string(),+ })+ .map(|details| match details {+ PixAutomaticoAdditionalDetails::PixAutomaticoPush(push) => push.time,+ })+ }pub fn merge(self, other: Option<Self>) -> Self {if let Some(other) = other {Self {@@ -11507,6 +11539,9 @@ impl FeatureMetadata {self.boleto_additional_details,other.boleto_additional_details,),+ pix_automatico_additional_details: self+ .pix_automatico_additional_details+ .or(other.pix_automatico_additional_details),}} else {self@@ -11626,6 +11661,20 @@ pub struct ScheduledExpirationTime {pub pix_key: Option<enums::PixKey>,}+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]+#[serde(tag = "type", rename_all = "snake_case")]+pub enum PixAutomaticoAdditionalDetails {+ /// Pix Automatico Push notification flow+ PixAutomaticoPush(PixAutomaticoPushDetails),+}++#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]+pub struct PixAutomaticoPushDetails {+ /// Time in seconds until which the push notification is valid+ #[schema(value_type = u32, example = 3600)]+ pub time: u32,+}+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, SmithyModel, PartialEq)]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct ApplePayRecurringDetails {diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rsindex 8a72deb9b1..b1761d844d 100644--- a/crates/diesel_models/src/types.rs+++ b/crates/diesel_models/src/types.rs@@ -75,6 +75,8 @@ pub struct FeatureMetadata {pub pix_additional_details: Option<PixAdditionalDetails>,/// Extra information like fine percentage, interest percentage etc required for Pix payment methodpub boleto_additional_details: Option<BoletoAdditionalDetails>,+ /// Pix Automatico additional details for Push and QR flows+ pub pix_automatico_additional_details: Option<PixAutomaticoAdditionalDetails>,}#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]@@ -136,6 +138,8 @@ pub struct FeatureMetadata {pub pix_additional_details: Option<PixAdditionalDetails>,/// Extra information like fine percentage, interest percentage etc required for Pix payment methodpub boleto_additional_details: Option<BoletoAdditionalDetails>,+ /// Pix Automatico additional details for Push and QR flows+ pub pix_automatico_additional_details: Option<PixAutomaticoAdditionalDetails>,}#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]@@ -168,6 +172,20 @@ pub struct ScheduledExpirationTime {pub pix_key: Option<common_enums::enums::PixKey>,}+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]+#[diesel(sql_type = Json)]+pub enum PixAutomaticoAdditionalDetails {+ /// Pix Automatico Push notification flow+ PixAutomaticoPush(PixAutomaticoPushDetails),+}++#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]+#[diesel(sql_type = Json)]+pub struct PixAutomaticoPushDetails {+ /// Time in seconds until which the push notification is valid+ pub time: u32,+}+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]#[diesel(sql_type = Json)]pub struct ApplePayRecurringDetails {diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rsindex f5f5090a82..34610f6d74 100644--- a/crates/hyperswitch_connectors/src/connectors/santander.rs+++ b/crates/hyperswitch_connectors/src/connectors/santander.rs@@ -16,15 +16,18 @@ use hyperswitch_domain_models::{router_data::{AccessToken, ErrorResponse, RouterData},router_flow_types::{access_token_auth::AccessTokenAuth,- payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},+ payments::{+ Authorize, Capture, GenerateQr, PSync, PaymentMethodToken, PushNotification, Session,+ SetupMandate, Void,+ },refunds::{Execute, RSync},AuthorizeSessionToken, UpdateMetadata,},router_request_types::{- AccessTokenRequestData, AuthorizeSessionTokenData, CurrentFlowInfo,+ AccessTokenRequestData, AuthorizeSessionTokenData, GenerateQrRequestData,PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, PaymentsUpdateMetadataData,- RefundsData, ResponseId, SetupMandateRequestData,+ PushNotificationRequestData, RefundsData, ResponseId, SetupMandateRequestData,},router_response_types::{ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,@@ -32,14 +35,15 @@ use hyperswitch_domain_models::{},types::{PaymentsAuthorizeRouterData, PaymentsAuthorizeSessionTokenRouterData,- PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,+ PaymentsCancelRouterData, PaymentsCaptureRouterData, PaymentsGenerateQrRouterData,+ PaymentsPushNotificationRouterData, PaymentsSyncRouterData,PaymentsUpdateMetadataRouterData, RefundSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{api::{self, ConnectorAccessTokenSuffix, ConnectorCommon, ConnectorCommonExt,- ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation, CurrentFlowInfo,},configs::Connectors,consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},@@ -54,12 +58,14 @@ use crate::{connectors::santander::{requests::{SantanderAuthRequest, SantanderAuthType, SantanderMetadataObject,- SantanderPaymentRequest, SantanderRefundRequest, SantanderRouterData,+ SantanderPaymentRequest, SantanderPixAutomaticSolicitationRequest,+ SantanderRefundRequest, SantanderRouterData,},responses::{SanatanderAccessTokenResponse, SantanderCreatePixPayloadLocationResponse,SantanderErrorResponse, SantanderGenericErrorResponse, SantanderPaymentsResponse,- SantanderPaymentsSyncResponse, SantanderRefundResponse,+ SantanderPaymentsSyncResponse, SantanderPixAutomaticRecResponse,+ SantanderPixAutomaticSolicitationResponse, SantanderRefundResponse,SantanderUpdateMetadataResponse, SantanderVoidResponse,},},@@ -103,6 +109,8 @@ impl api::RefundExecute for Santander {}impl api::RefundSync for Santander {}impl api::PaymentToken for Santander {}impl api::PaymentUpdateMetadata for Santander {}+impl api::PaymentsPushNotification for Santander {}+impl api::PaymentsGenerateQr for Santander {}impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>for Santander@@ -375,6 +383,18 @@ where.ok_or(errors::ConnectorError::NoConnectorMetaData)?.client_id}+ Some(enums::PaymentMethodType::PixAutomaticoPush) => {+ santander_mca_metadata+ .pix_automatico_push+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?+ .client_id+ }+ Some(enums::PaymentMethodType::PixAutomaticoQr) => {+ santander_mca_metadata+ .pix_automatico_qr+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?+ .client_id+ }Some(enums::PaymentMethodType::Boleto) => {santander_mca_metadata.boleto@@ -693,6 +713,90 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons}}+impl ConnectorIntegration<PushNotification, PushNotificationRequestData, PaymentsResponseData>+ for Santander+{+ fn get_headers(+ &self,+ req: &PaymentsPushNotificationRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {+ self.build_headers(req, connectors)+ }++ fn get_content_type(&self) -> &'static str {+ self.common_get_content_type()+ }++ fn get_url(+ &self,+ _req: &PaymentsPushNotificationRouterData,+ connectors: &Connectors,+ ) -> CustomResult<String, errors::ConnectorError> {+ Ok(format!("{}api/v1/solicrec", self.base_url(connectors)))+ }++ fn get_request_body(+ &self,+ req: &PaymentsPushNotificationRouterData,+ _connectors: &Connectors,+ ) -> CustomResult<RequestContent, errors::ConnectorError> {+ let connector_req = SantanderPixAutomaticSolicitationRequest::try_from(req)?;+ Ok(RequestContent::Json(Box::new(connector_req)))+ }++ fn build_request(+ &self,+ req: &PaymentsPushNotificationRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {+ let auth_details = SantanderAuthType::try_from(&req.connector_auth_type)?;++ let builder = RequestBuilder::new()+ .method(Method::Post)+ .url(&types::PaymentsPushNotificationType::get_url(+ self, req, connectors,+ )?)+ .add_certificate(Some(auth_details.client_id))+ .add_certificate_key(Some(auth_details.client_secret))+ .attach_default_headers()+ .headers(types::PaymentsPushNotificationType::get_headers(+ self, req, connectors,+ )?);++ Ok(Some(builder.build()))+ }++ fn handle_response(+ &self,+ data: &PaymentsPushNotificationRouterData,+ event_builder: Option<&mut ConnectorEvent>,+ res: Response,+ ) -> CustomResult<PaymentsPushNotificationRouterData, errors::ConnectorError> {+ let response: SantanderPixAutomaticSolicitationResponse = res+ .response+ .parse_struct("SantanderPixAutomaticSolicitationResponse")+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);++ RouterData::try_from(ResponseRouterData {+ response,+ data: data.clone(),+ http_code: res.status_code,+ })+ }++ fn get_error_response(+ &self,+ res: Response,+ event_builder: Option<&mut ConnectorEvent>,+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Santander {fn get_headers(&self,@@ -1693,6 +1797,28 @@ impl ConnectorSpecifications for Santander {| None => false,}}+ fn is_push_notification_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {+ match current_flow {+ CurrentFlowInfo::SetupMandate { request_data, .. } => {+ matches!(+ request_data.payment_method_type,+ Some(enums::PaymentMethodType::PixAutomaticoPush)+ ) && request_data.mandate_id.is_none()+ }+ CurrentFlowInfo::Authorize { .. } | CurrentFlowInfo::CompleteAuthorize { .. } => false,+ }+ }+ fn is_generate_qr_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {+ match current_flow {+ CurrentFlowInfo::SetupMandate { request_data, .. } => {+ matches!(+ request_data.payment_method_type,+ Some(enums::PaymentMethodType::PixAutomaticoQr)+ ) && request_data.mandate_id.is_none()+ }+ CurrentFlowInfo::Authorize { .. } | CurrentFlowInfo::CompleteAuthorize { .. } => false,+ }+ }}impl ConnectorAccessTokenSuffix for Santander {@@ -1721,3 +1847,106 @@ impl ConnectorAccessTokenSuffix for Santander {}}}++impl ConnectorIntegration<GenerateQr, GenerateQrRequestData, PaymentsResponseData> for Santander {+ fn get_headers(+ &self,+ req: &PaymentsGenerateQrRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {+ self.build_headers(req, connectors)+ }++ fn get_content_type(&self) -> &'static str {+ self.common_get_content_type()+ }++ fn get_url(+ &self,+ req: &PaymentsGenerateQrRouterData,+ connectors: &Connectors,+ ) -> CustomResult<String, errors::ConnectorError> {+ let mandate_id = req+ .request+ .get_connector_mandate_id()+ .ok_or(errors::ConnectorError::MissingConnectorMandateID)?;++ // Control enters when it is PixAutomaticoQr and Journey 2 CIT+ if req.request.amount.unwrap_or(0) > 0 {+ Ok(format!(+ "{}api/v1/rec/{}?txid={}",+ self.base_url(connectors),+ mandate_id,+ req.connector_request_reference_id+ ))+ }+ // Control enters when it is PixAutomaticoQr and Journey 3/4 CIT+ else {+ Ok(format!(+ "{}api/v1/rec/{}",+ self.base_url(connectors),+ mandate_id+ ))+ }+ }++ fn build_request(+ &self,+ req: &PaymentsGenerateQrRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {+ let auth_details = SantanderAuthType::try_from(&req.connector_auth_type)?;++ Ok(Some(+ RequestBuilder::new()+ .method(Method::Get)+ .url(&types::PaymentsGenerateQrType::get_url(+ self, req, connectors,+ )?)+ .add_certificate(Some(auth_details.client_id))+ .add_certificate_key(Some(auth_details.client_secret))+ .attach_default_headers()+ .headers(types::PaymentsGenerateQrType::get_headers(+ self, req, connectors,+ )?)+ .build(),+ ))+ }++ fn handle_response(+ &self,+ data: &PaymentsGenerateQrRouterData,+ event_builder: Option<&mut ConnectorEvent>,+ res: Response,+ ) -> CustomResult<PaymentsGenerateQrRouterData, errors::ConnectorError> {+ let response: SantanderPixAutomaticRecResponse = res+ .response+ .parse_struct("SantanderPixAutomaticRecResponse")+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ event_builder.map(|i| i.set_response_body(&response));+ router_env::logger::info!(connector_response=?response);++ RouterData::try_from(ResponseRouterData {+ response,+ data: data.clone(),+ http_code: res.status_code,+ })+ }++ fn get_error_response(+ &self,+ res: Response,+ event_builder: Option<&mut ConnectorEvent>,+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }++ fn get_5xx_error_response(+ &self,+ res: Response,+ event_builder: Option<&mut ConnectorEvent>,+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}diff --git a/crates/hyperswitch_connectors/src/connectors/santander/requests.rs b/crates/hyperswitch_connectors/src/connectors/santander/requests.rsindex 9a48a17dfc..1751ca3801 100644--- a/crates/hyperswitch_connectors/src/connectors/santander/requests.rs+++ b/crates/hyperswitch_connectors/src/connectors/santander/requests.rs@@ -125,7 +125,8 @@ pub struct SantanderDebtor {#[serde(skip_serializing_if = "Option::is_none")]pub cpf: Option<Secret<String>>,// Name- pub nome: Secret<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub nome: Option<Secret<String>>,#[serde(skip_serializing_if = "Option::is_none")]// Streetpub logradouro: Option<Secret<String>>,@@ -169,6 +170,39 @@ pub struct SantanderPixDueDateCalendarRequest {pub validade_apos_vencimento: Option<u32>,}+#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticCalendarRequest {+ pub data_expiracao_solicitacao: String,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticDestinationRequest {+ pub agencia: String,+ pub conta: String,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub cpf: Option<Secret<String>>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub cnpj: Option<Secret<String>>,+ pub ispb_participante: String,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticSolicitationRequest {+ pub id_rec: String,+ pub calendario: SantanderPixAutomaticCalendarRequest,+ pub destinatario: SantanderPixAutomaticDestinationRequest,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(untagged)]+pub enum SantanderPostProcessingStepRequest {+ PixAutomaticoPush(SantanderPixAutomaticSolicitationRequest),+ PixAutomaticoQr(),+}+#[derive(Debug, Clone, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct SantanderPixCancelRequest {diff --git a/crates/hyperswitch_connectors/src/connectors/santander/responses.rs b/crates/hyperswitch_connectors/src/connectors/santander/responses.rsindex 367687fc27..859c48ac44 100644--- a/crates/hyperswitch_connectors/src/connectors/santander/responses.rs+++ b/crates/hyperswitch_connectors/src/connectors/santander/responses.rs@@ -1,3 +1,4 @@+use api_models::payments::PollConfig;use common_utils::types::StringMajorUnit;use hyperswitch_masking::Secret;use serde::{Deserialize, Serialize};@@ -744,3 +745,276 @@ pub enum SantanderBoletoStatus {/// A partial payment was madeLiquidadoParcialmente,}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticSolicitationResponse {+ /// Unique identifier for the recurrence solicitation request+ pub id_solic_rec: String,+ /// Unique identifier for the recurrence+ pub id_rec: String,+ /// Calendar information for the recurrence (expiration, start, end, frequency)+ pub calendario: SantanderPixAutomaticoCalendario,+ /// Recipient/Destination information for the recurrence+ pub destinatario: SantanderPixAutomaticoDestinatario,+ /// Current status of the recurrence solicitation+ pub status: Option<RecurrenceStatus>,+ /// Update history of the recurrence solicitation+ pub atualizacao: Option<Vec<SantanderPixAutomaticoAtualizacao>>,+ /// Complete payload containing detailed recurrence information+ pub rec_payload: Option<SantanderPixAutomaticoRecPayload>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoCalendario {+ /// Expiration date of the recurrence solicitation+ pub data_expiracao_solicitacao: Option<String>,+ /// Start date of the recurrence+ pub data_inicial: Option<String>,+ /// End date of the recurrence+ pub data_final: Option<String>,+ /// Periodicity/frequency of the recurrence (e.g., monthly, weekly)+ pub periodicidade: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoDestinatario {+ /// Recipient's bank account number+ pub conta: Option<String>,+ /// ISPB code of the recipient's financial institution participant+ pub ispb_participante: Option<String>,+ /// Recipient's bank branch/agency number+ pub agencia: Option<String>,+ /// Recipient's CPF (individual tax ID)+ pub cpf: Option<Secret<String>>,+ /// Recipient's CNPJ (business tax ID)+ pub cnpj: Option<Secret<String>>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoAtualizacao {+ /// Status of the recurrence at the time of update+ pub status: Option<RecurrenceStatus>,+ /// Date when the status update occurred+ pub data: String,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoRecPayload {+ /// Unique identifier for the recurrence+ pub id_rec: String,+ /// Link/relationship information between debtor and creditor+ pub vinculo: SantanderPixAutomaticoVinculo,+ /// Calendar information for the recurrence+ pub calendario: SantanderPixAutomaticoCalendario,+ /// Value information for the recurrence (recurrence amount and minimum amount)+ pub valor: Option<SantanderPixAutomaticoValor>,+ /// Recipient information for the recurrence+ pub recebedor: SantanderPixAutomaticoRecebedor,+ /// Update history of the recurrence+ pub atualizacao: Vec<SantanderPixAutomaticoAtualizacao>,+ /// Retry policy for failed payments in the recurrence+ pub politica_retentativa: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoVinculo {+ /// Object or subject of the recurrence link/agreement+ pub objeto: Option<String>,+ /// Debtor/Payer information in the recurrence relationship+ pub devedor: SantanderPixAutomaticoDevedor,+ /// Contract identifier linking the recurrence to a contract+ pub contrato: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoDevedor {+ /// Debtor's CPF (individual tax ID)+ pub cpf: Option<Secret<String>>,+ /// Debtor's CNPJ (business tax ID)+ pub cnpj: Option<Secret<String>>,+ /// Debtor's full name+ pub nome: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoRecebedor {+ /// Covenant/agreement identifier for the recipient+ pub convenio: Option<String>,+ /// Recipient's CNPJ (business tax ID)+ pub cnpj: Option<Secret<String>>,+ /// Recipient's full name+ pub nome: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticRecResponse {+ /// Unique identifier for the recurrence+ pub id_rec: String,+ /// Link/relationship information between debtor and creditor+ pub vinculo: SantanderPixAutomaticoVinculo,+ /// Calendar information for the recurrence+ pub calendario: SantanderPixAutomaticoCalendario,+ /// Value information for the recurrence+ pub valor: Option<SantanderPixAutomaticoValor>,+ /// Recipient information for the recurrence+ pub recebedor: SantanderPixAutomaticoRecebedor,+ /// Payer information for the recurrence+ pub pagador: Option<SantanderPixAutomaticoPagador>,+ /// Current status of the recurrence+ pub status: RecurrenceStatus,+ /// Retry policy for failed payments in the recurrence+ pub politica_retentativa: Option<String>,+ /// Location information for the recurrence (QR code location)+ pub loc: Option<SantanderPixAutomaticoLoc>,+ /// Update history of the recurrence+ pub atualizacao: Vec<SantanderPixAutomaticoAtualizacao>,+ /// Closure/termination information if the recurrence was ended+ pub encerramento: Option<SantanderPixAutomaticoEncerramento>,+ /// Associated solicitation requests for the recurrence+ pub solicitacao: Option<Vec<SantanderPixAutomaticSolicitationResponse>>,+ /// Activation information for the recurrence+ pub ativacao: Option<SantanderPixAutomaticoAtivacao>,+ /// QR code data associated with the recurrence+ #[serde(rename = "dadosQR")]+ pub dados_qr: Option<SantanderPixAutomaticQrData>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoPagador {+ /// ISPB code of the payer's financial institution participant+ pub ispb_participante: Option<String>,+ /// Municipality code where the payer is located+ pub cod_mun: Option<String>,+ /// Payer's CPF (individual tax ID)+ pub cpf: Option<Secret<String>>,+ /// Payer's CNPJ (business tax ID)+ pub cnpj: Option<Secret<String>>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoLoc {+ /// Unique identifier for the location/QR code+ pub id: Option<i64>,+ /// URL or reference to the QR code location+ pub location: Option<String>,+ /// Date/time when the location was created+ pub criacao: Option<String>,+ /// Recurrence identifier associated with this location+ pub id_rec: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoEncerramento {+ /// Rejection information if the recurrence was closed due to rejection+ pub rejeicao: Option<SantanderPixAutomaticoRejeicao>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoRejeicao {+ /// Error code for the rejection+ pub codigo: Option<String>,+ /// Description of the rejection reason+ pub descricao: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoAtivacao {+ /// Type of journey/flow used to activate the recurrence+ pub tipo_jornada: Option<String>,+ /// Data associated with the activation journey+ pub dados_jornada: Option<SantanderPixAutomaticoDadosJornada>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoDadosJornada {+ /// Transaction ID associated with the activation journey+ pub txid: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticQrData {+ /// Journey type/flow for the QR code+ pub jornada: Option<SantanderJourneyType>,+ /// PIX copy-and-paste string (Copia e Cola) for the QR code+ #[serde(rename = "pixCopiaECola")]+ pub pix_copia_e_cola: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct WaitScreenData {+ /// Timestamp from which the wait screen should be displayed+ pub display_from_timestamp: i128,+ /// Timestamp until which the wait screen should be displayed (optional)+ pub display_to_timestamp: Option<i128>,+ /// Configuration for polling updates during the wait screen+ pub poll_config: Option<PollConfig>,+}++#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]+pub enum SantanderJourneyType {+ // Paying user accepted the recurrence through external notification to the ecosystem+ #[serde(rename = "JORNADA_1")]+ Jornada1,+ // Paying user accepted the recurrence by reading the recurrence QR Code+ #[serde(rename = "JORNADA_2")]+ Jornada2,+ // Paying user initiated the recurrence by reading a composite QR Code + paying an immediate charge+ #[serde(rename = "JORNADA_3")]+ Jornada3,+ // Paying user initiated the recurrence by reading a composite QR Code + paying an scheduled charge+ #[serde(rename = "JORNADA_4")]+ Jornada4,+ // Initial value after creation and before recurrence activation+ #[serde(rename = "AGUARDANDO_DEFINICAO")]+ AguardandoDefinicao,+}++/// Status of the recurring payment mandate+#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "UPPERCASE")]+pub enum RecurrenceStatus {+ /// Created (awaiting approval)+ Criada,+ /// Approved (active)+ Aprovada,+ /// Rejected+ Rejeitada,+ /// Expired+ Expirada,+ /// Cancelled+ Cancelada,+ /// Received+ Recebida,+ // Sent+ Enviada,+ // Accepted+ Aceita,+ /// Unknown status+ #[serde(other)]+ Unknown,+}++#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct SantanderPixAutomaticoValor {+ /// Recurrence amount - the regular payment amount+ pub valor_rec: Option<StringMajorUnit>,+ /// Minimum amount required from the recipient/creditor+ pub valor_minimo_recebedor: Option<StringMajorUnit>,+}diff --git a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rsindex 64239f3712..9d1ebec3cc 100644--- a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs@@ -1,6 +1,6 @@use api_models::payments::{BeneficiaryDetails, BoletoPaymentTypeConstraints, CalculationType, ConnectorMetadata,- DiscountTier, DiscountType, ProtestType, QrCodeInformation, SantanderData,+ DiscountTier, DiscountType, PollConfig, ProtestType, QrCodeInformation, SantanderData,SantanderPaymentDiscountRules, VoucherNextStepData,};use common_enums::{enums, AttemptStatus, BoletoDocumentKind, ExpiryType, PixKey};@@ -14,12 +14,15 @@ use error_stack::ResultExt;use hyperswitch_domain_models::{payment_method_data::{BankTransferData, BoletoVoucherData, PaymentMethodData, VoucherData},router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},- router_flow_types::AuthorizeSessionToken,- router_request_types::{AuthorizeSessionTokenData, PaymentsUpdateMetadataData, ResponseId},- router_response_types::{PaymentsResponseData, RefundsResponseData},+ router_flow_types::{payments::PushNotification, AuthorizeSessionToken, GenerateQr},+ router_request_types::{+ AuthorizeSessionTokenData, GenerateQrRequestData, PaymentsUpdateMetadataData,+ PushNotificationRequestData, ResponseId,+ },+ router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData},types::{- PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsSyncRouterData,- PaymentsUpdateMetadataRouterData, RefundsRouterData,+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsPushNotificationRouterData,+ PaymentsSyncRouterData, PaymentsUpdateMetadataRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -38,20 +41,24 @@ use crate::{SantanderAuthType, SantanderBoletoCancelOperation, SantanderBoletoCancelRequest,SantanderBoletoPaymentRequest, SantanderBoletoUpdateRequest, SantanderDebtor,SantanderDiscountType, SantanderGrantType, SantanderMetadataObject,- SantanderPaymentRequest, SantanderPaymentsCancelRequest, SantanderPixCancelRequest,+ SantanderPaymentRequest, SantanderPaymentsCancelRequest,+ SantanderPixAutomaticCalendarRequest, SantanderPixAutomaticDestinationRequest,+ SantanderPixAutomaticSolicitationRequest, SantanderPixCancelRequest,SantanderPixDueDateCalendarRequest, SantanderPixImmediateCalendarRequest,SantanderPixQRPaymentRequest, SantanderPixRequestCalendar, SantanderProtestType,SantanderRefundRequest, SantanderRouterData, SantanderValue, SantanderValueType,},responses::{- Beneficiary, Key, NsuComposite, Payer, SanatanderAccessTokenResponse,+ Beneficiary, Key, NsuComposite, Payer, RecurrenceStatus, SanatanderAccessTokenResponse,SanatanderTokenResponse, SantanderAdditionalInfo, SantanderBoletoDocumentKind,SantanderBoletoPaymentType, SantanderBoletoStatus,SantanderCreatePixPayloadLocationResponse, SantanderDocumentKind,SantanderPaymentStatus, SantanderPaymentsResponse, SantanderPaymentsSyncResponse,+ SantanderPixAutomaticRecResponse, SantanderPixAutomaticSolicitationResponse,SantanderPixKeyType, SantanderPixQRCodePaymentsResponse,SantanderPixQRCodeSyncResponse, SantanderRefundResponse, SantanderRefundStatus,SantanderUpdateMetadataResponse, SantanderVoidResponse, SantanderVoidStatus,+ WaitScreenData,},},types::{RefreshTokenRouterData, RefundsResponseRouterData, ResponseRouterData},@@ -99,6 +106,131 @@ impl}}+impl+ TryFrom<+ ResponseRouterData<+ PushNotification,+ SantanderPixAutomaticSolicitationResponse,+ PushNotificationRequestData,+ PaymentsResponseData,+ >,+ > for RouterData<PushNotification, PushNotificationRequestData, PaymentsResponseData>+{+ type Error = Error;++ fn try_from(+ item: ResponseRouterData<+ PushNotification,+ SantanderPixAutomaticSolicitationResponse,+ PushNotificationRequestData,+ PaymentsResponseData,+ >,+ ) -> Result<Self, Self::Error> {+ let expires_in_secs = item+ .data+ .request+ .feature_metadata+ .as_ref()+ .ok_or(errors::ConnectorError::MissingRequiredField {+ field_name: "feature_metadata",+ })?+ .get_pix_automatico_push_expiry_time()+ .change_context(errors::ConnectorError::ParsingFailed)+ .attach_printable("Failed to get pix_automatico_push expiry time")?;++ let metadata = get_wait_screen_metadata(u64::from(expires_in_secs))?;++ let status = item+ .response+ .status+ .map(AttemptStatus::from)+ .unwrap_or(AttemptStatus::Pending);+ let resource_id =+ ResponseId::ConnectorTransactionId(item.data.connector_request_reference_id.clone());+ let connector_response_reference_id = Some(item.response.id_rec.clone());+ let mandate_reference = Some(MandateReference {+ connector_mandate_id: Some(item.response.id_rec.clone()),+ payment_method_id: None,+ mandate_metadata: None,+ connector_mandate_request_reference_id: Some(item.response.id_solic_rec),+ });++ Ok(Self {+ status,+ response: Ok(PaymentsResponseData::TransactionResponse {+ resource_id,+ redirection_data: Box::new(None),+ mandate_reference: Box::new(mandate_reference),+ connector_metadata: metadata,+ network_txn_id: None,+ connector_response_reference_id,+ incremental_authorization_allowed: None,+ authentication_data: None,+ charges: None,+ }),+ ..item.data+ })+ }+}++impl+ TryFrom<+ ResponseRouterData<+ GenerateQr,+ SantanderPixAutomaticRecResponse,+ GenerateQrRequestData,+ PaymentsResponseData,+ >,+ > for RouterData<GenerateQr, GenerateQrRequestData, PaymentsResponseData>+{+ type Error = Error;++ fn try_from(+ item: ResponseRouterData<+ GenerateQr,+ SantanderPixAutomaticRecResponse,+ GenerateQrRequestData,+ PaymentsResponseData,+ >,+ ) -> Result<Self, Self::Error> {+ let status = AttemptStatus::from(item.response.status);+ let connector_metadata = match item+ .response+ .dados_qr+ .as_ref()+ .and_then(|dados_qr| dados_qr.pix_copia_e_cola.clone())+ {+ Some(pix_copia_e_cola) => convert_pix_data_to_value(pix_copia_e_cola, None)?,+ None => None,+ };+ let mandate_reference = Box::new(Some(MandateReference {+ connector_mandate_id: Some(item.response.id_rec.clone()),+ payment_method_id: None,+ mandate_metadata: None,+ connector_mandate_request_reference_id: None,+ }));+ let resource_id =+ ResponseId::ConnectorTransactionId(item.data.connector_request_reference_id.clone());+ let connector_response_reference_id = Some(item.response.id_rec.clone());++ Ok(Self {+ status,+ response: Ok(PaymentsResponseData::TransactionResponse {+ resource_id,+ redirection_data: Box::new(None),+ mandate_reference,+ connector_metadata,+ network_txn_id: None,+ connector_response_reference_id,+ incremental_authorization_allowed: None,+ authentication_data: None,+ charges: None,+ }),+ ..item.data+ })+ }+}+impl TryFrom<&Option<common_utils::pii::SecretSerdeValue>> for SantanderMetadataObject {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(@@ -658,7 +790,7 @@ impl});let debt = Some(SantanderDebtor {cnpj,- nome: value.0.router_data.get_billing_full_name()?,+ nome: Some(value.0.router_data.get_billing_full_name()?),logradouro: None,cidade: None,uf: None,@@ -677,7 +809,7 @@ impllet debt = Some(SantanderDebtor {cpf,- nome: value.0.router_data.get_billing_full_name()?,+ nome: Some(value.0.router_data.get_billing_full_name()?),logradouro: None,cidade: None,uf: None,@@ -695,7 +827,7 @@ impllet debt = Some(SantanderDebtor {cnpj,- nome: value.0.router_data.get_billing_full_name()?,+ nome: Some(value.0.router_data.get_billing_full_name()?),logradouro: None,cidade: None,uf: None,@@ -773,6 +905,22 @@ impl From<SantanderBoletoStatus> for AttemptStatus {}}+impl From<RecurrenceStatus> for AttemptStatus {+ fn from(item: RecurrenceStatus) -> Self {+ match item {+ RecurrenceStatus::Criada => Self::AuthenticationPending,+ RecurrenceStatus::Aprovada => Self::Charged,+ RecurrenceStatus::Rejeitada => Self::Failure,+ RecurrenceStatus::Expirada => Self::Failure,+ RecurrenceStatus::Cancelada => Self::Voided,+ RecurrenceStatus::Recebida | RecurrenceStatus::Aceita | RecurrenceStatus::Enviada => {+ Self::Pending+ }+ _ => Self::Pending,+ }+ }+}+impl From<common_types::customers::DocumentKind> for SantanderDocumentKind {fn from(item: common_types::customers::DocumentKind) -> Self {match item {@@ -1661,3 +1809,119 @@ fn get_boleto_additional_fields_from_connector_metadata(}).unwrap_or_default()}++impl TryFrom<&PaymentsPushNotificationRouterData> for SantanderPixAutomaticSolicitationRequest {+ type Error = Error;++ fn try_from(item: &PaymentsPushNotificationRouterData) -> Result<Self, Self::Error> {+ // Extract expiration time from feature_metadata using the helper function+ let expires_in_secs = item+ .request+ .feature_metadata+ .as_ref()+ .ok_or(errors::ConnectorError::MissingRequiredField {+ field_name: "feature_metadata",+ })?+ .get_pix_automatico_push_expiry_time()+ .change_context(errors::ConnectorError::ParsingFailed)+ .attach_printable("Failed to get pix_automatico_push expiry time")?;++ // Calculate expiration datetime from current time + expires_in_secs+ let data_expiracao_solicitacao = (time::OffsetDateTime::now_utc()+ + time::Duration::seconds(i64::from(expires_in_secs)))+ .format(&time::format_description::well_known::Rfc3339)+ .change_context(errors::ConnectorError::InvalidDataFormat {+ field_name: "data_expiracao_solicitacao",+ })?;++ // Extract bank transfer data for PixAutomaticoPush+ let bank_transfer_data = match &item.request.payment_method_data {+ Some(PaymentMethodData::BankTransfer(boxed_data)) => match boxed_data.as_ref() {+ BankTransferData::PixAutomaticoPush {+ account_number,+ branch_code,+ bank_identifier,+ } => (account_number, branch_code, bank_identifier),+ _ => {+ return Err(errors::ConnectorError::MissingRequiredField {+ field_name: "payment_method_data.bank_transfer.pix_automatico_push",+ })?+ }+ },+ _ => {+ return Err(errors::ConnectorError::MissingRequiredField {+ field_name: "payment_method_data.bank_transfer.pix_automatico_push",+ })?+ }+ };++ // Extract customer document details+ let customer_document_details = item.customer_document_details.clone().ok_or(+ errors::ConnectorError::MissingRequiredField {+ field_name: "customer.document_details",+ },+ )?;++ let (cpf, cnpj) = match customer_document_details.document_type {+ common_types::customers::DocumentKind::Cpf => {+ (Some(customer_document_details.document_number), None)+ }+ common_types::customers::DocumentKind::Cnpj => {+ (None, Some(customer_document_details.document_number))+ }+ };++ Ok(Self {+ id_rec: item.connector_request_reference_id.clone(),+ calendario: SantanderPixAutomaticCalendarRequest {+ data_expiracao_solicitacao,+ },+ destinatario: SantanderPixAutomaticDestinationRequest {+ agencia: bank_transfer_data+ .1+ .clone()+ .ok_or(errors::ConnectorError::MissingRequiredField {+ field_name: "payment_method_data.bank_transfer.branch_code",+ })?+ .expose(),+ conta: bank_transfer_data+ .0+ .clone()+ .ok_or(errors::ConnectorError::MissingRequiredField {+ field_name: "payment_method_data.bank_transfer.account_number",+ })?+ .expose(),+ cpf,+ cnpj,+ ispb_participante: bank_transfer_data+ .2+ .clone()+ .ok_or(errors::ConnectorError::MissingRequiredField {+ field_name: "payment_method_data.bank_transfer.bank_identifier",+ })?+ .expose(),+ },+ })+ }+}++fn get_wait_screen_metadata(+ expiry_in_secs: u64,+) -> CustomResult<Option<Value>, errors::ConnectorError> {+ let current_time = time::OffsetDateTime::now_utc().unix_timestamp_nanos();+ let expiry_duration_nanos = i128::from(expiry_in_secs) * 1_000_000_000;+ // confirm this value from sdk team+ let delay_in_secs: u16 = 5;+ let frequency: u16 = u16::try_from(expiry_in_secs / u64::from(delay_in_secs))+ .change_context(errors::ConnectorError::ParsingFailed)+ .attach_printable("Failed to convert frequency to u16")?;++ Ok(Some(serde_json::json!(WaitScreenData {+ display_from_timestamp: current_time,+ display_to_timestamp: Some(current_time + expiry_duration_nanos),+ poll_config: Some(PollConfig {+ delay_in_secs,+ frequency,+ }),+ })))+}diff --git a/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rsindex b5bc3f5762..a5e7df9b9c 100644--- a/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/trustly/transformers.rs@@ -368,11 +368,14 @@ fn serialize_value(value: &serde_json::Value) -> String {match value {serde_json::Value::Object(map) => {let sorted: BTreeMap<_, _> = map.iter().collect();- sorted- .iter()- .filter(|(_, v)| !v.is_null())- .map(|(k, v)| format!("{}{}", k, serialize_data(v)))- .collect()+ sorted.iter().filter(|(_, v)| !v.is_null()).fold(+ String::new(),+ |mut output, (key, value)| {+ output.push_str(key);+ output.push_str(&serialize_data(value));+ output+ },+ )}serde_json::Value::Array(arr) => arr.iter().map(serialize_data).collect(),serde_json::Value::String(s) => s.clone(),@@ -419,8 +422,11 @@ fn serialize_data(value: &serde_json::Value) -> String {let sorted: BTreeMap<_, _> = map.iter().collect();sorted.iter()- .map(|(k, v)| format!("{}{}", k, serialize_data(v)))- .collect()+ .fold(String::new(), |mut output, (key, value)| {+ output.push_str(key);+ output.push_str(&serialize_data(value));+ output+ })}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/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rsindex 35c99d8d10..a30837c2d7 100644--- a/crates/hyperswitch_connectors/src/default_implementations.rs+++ b/crates/hyperswitch_connectors/src/default_implementations.rs@@ -34,9 +34,10 @@ use hyperswitch_domain_models::{merchant_connector_webhook_management::ConnectorWebhookRegister,payments::{Approve, AuthorizeSessionToken, CalculateTax, CompleteAuthorize,- CreateConnectorCustomer, CreateOrder, ExtendAuthorization, GiftCardBalanceCheck,- IncrementalAuthorization, PostCaptureVoid, PostProcessing, PostSessionTokens,- PreProcessing, Reject, SdkSessionUpdate, SettlementSplitCreate, UpdateMetadata,+ CreateConnectorCustomer, CreateOrder, ExtendAuthorization, GenerateQr,+ GiftCardBalanceCheck, IncrementalAuthorization, PostCaptureVoid, PostProcessing,+ PostSessionTokens, PreProcessing, PushNotification, Reject, SdkSessionUpdate,+ SettlementSplitCreate, UpdateMetadata,},subscriptions::{GetSubscriptionEstimate, GetSubscriptionItemPrices, GetSubscriptionItems,@@ -65,12 +66,13 @@ use hyperswitch_domain_models::{AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AuthorizeSessionTokenData,CompleteAuthorizeData, ConnectorCustomerData, CreateOrderRequestData,DefendDisputeRequestData, DisputeSyncData, ExternalVaultProxyPaymentsData,- FetchDisputesRequestData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,- PaymentsApproveData, PaymentsAuthenticateData, PaymentsCancelPostCaptureData,- PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,- PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,- PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RetrieveFileRequestData,+ FetchDisputesRequestData, GenerateQrRequestData, GiftCardBalanceCheckRequestData,+ MandateRevokeRequestData, PaymentsApproveData, PaymentsAuthenticateData,+ PaymentsCancelPostCaptureData, PaymentsExtendAuthorizationData,+ PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,+ PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,+ PaymentsPreProcessingData, PaymentsRejectData, PaymentsTaxCalculationData,+ PaymentsUpdateMetadataData, PushNotificationRequestData, RetrieveFileRequestData,SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SubmitEvidenceRequestData,UploadFileRequestData, VaultRequestData, VerifyWebhookSourceRequestData,},@@ -142,9 +144,10 @@ use hyperswitch_interfaces::{PaymentAuthorizeSessionToken, PaymentExtendAuthorization,PaymentIncrementalAuthorization, PaymentPostCaptureVoid, PaymentPostSessionTokens,PaymentReject, PaymentSessionUpdate, PaymentUpdateMetadata, PaymentsAuthenticate,- PaymentsCompleteAuthorize, PaymentsCreateOrder, PaymentsGiftCardBalanceCheck,- PaymentsPostAuthenticate, PaymentsPostProcessing, PaymentsPreAuthenticate,- PaymentsPreProcessing, PaymentsSettlementSplitCreate, TaxCalculation,+ PaymentsCompleteAuthorize, PaymentsCreateOrder, PaymentsGenerateQr,+ PaymentsGiftCardBalanceCheck, PaymentsPostAuthenticate, PaymentsPostProcessing,+ PaymentsPreAuthenticate, PaymentsPreProcessing, PaymentsPushNotification,+ PaymentsSettlementSplitCreate, TaxCalculation,},revenue_recovery::RevenueRecovery,subscriptions::{@@ -10802,6 +10805,23 @@ impl<const T: u8>{}+#[cfg(feature = "dummy_connector")]+impl<const T: u8> PaymentsPushNotification for connectors::DummyConnector<T> {}+#[cfg(feature = "dummy_connector")]+impl<const T: u8>+ ConnectorIntegration<PushNotification, PushNotificationRequestData, PaymentsResponseData>+ for connectors::DummyConnector<T>+{+}++#[cfg(feature = "dummy_connector")]+impl<const T: u8> PaymentsGenerateQr for connectors::DummyConnector<T> {}+#[cfg(feature = "dummy_connector")]+impl<const T: u8> ConnectorIntegration<GenerateQr, GenerateQrRequestData, PaymentsResponseData>+ for connectors::DummyConnector<T>+{+}+#[cfg(feature = "dummy_connector")]impl<const T: u8> RevenueRecovery for connectors::DummyConnector<T> {}@@ -11146,3 +11166,323 @@ default_impl_connector_access_token!(connectors::Sift,connectors::Fiservcommercehub);++macro_rules! default_imp_for_generate_qr_flow{+ ($($path:ident::$connector:ident),*)=> {+ $(+ impl PaymentsGenerateQr for $path::$connector {}+ impl+ ConnectorIntegration<+ GenerateQr,+ GenerateQrRequestData,+ PaymentsResponseData,+ > for $path::$connector+ {}+ )*+ };+}++default_imp_for_generate_qr_flow!(+ connectors::Plaid,+ connectors::Vgs,+ connectors::Aci,+ connectors::Adyen,+ connectors::Adyenplatform,+ connectors::Affirm,+ connectors::Airwallex,+ connectors::Amazonpay,+ connectors::Archipel,+ connectors::Authipay,+ connectors::Authorizedotnet,+ connectors::Bambora,+ connectors::Bamboraapac,+ connectors::Bankofamerica,+ connectors::Barclaycard,+ connectors::Billwerk,+ connectors::Bitpay,+ connectors::Blackhawknetwork,+ connectors::Calida,+ connectors::Bluesnap,+ connectors::Braintree,+ connectors::Boku,+ connectors::Breadpay,+ connectors::Cashtocode,+ connectors::Celero,+ connectors::Chargebee,+ connectors::Checkbook,+ connectors::Checkout,+ connectors::Coinbase,+ connectors::Coingate,+ connectors::Cryptopay,+ connectors::Custombilling,+ connectors::Cybersource,+ connectors::Cybersourcedecisionmanager,+ connectors::Datatrans,+ connectors::Deutschebank,+ connectors::Digitalvirgo,+ connectors::Dlocal,+ connectors::Dwolla,+ connectors::Ebanx,+ connectors::Elavon,+ connectors::Envoy,+ connectors::Facilitapay,+ connectors::Finix,+ connectors::Fiserv,+ connectors::Fiservcommercehub,+ connectors::Fiservemea,+ connectors::Fiuu,+ connectors::Flexiti,+ connectors::Forte,+ connectors::Getnet,+ connectors::Gigadat,+ connectors::Globalpay,+ connectors::Globepay,+ connectors::Gocardless,+ connectors::Gpayments,+ connectors::Hipay,+ connectors::Hyperpg,+ connectors::Helcim,+ connectors::HyperswitchVault,+ connectors::Hyperwallet,+ connectors::Iatapay,+ connectors::Inespay,+ connectors::Itaubank,+ connectors::Jpmorgan,+ connectors::Juspaythreedsserver,+ connectors::Katapult,+ connectors::Klarna,+ connectors::Loonio,+ connectors::Netcetera,+ connectors::Nmi,+ connectors::Nomupay,+ connectors::Noon,+ connectors::Nordea,+ connectors::Novalnet,+ connectors::Nexinets,+ connectors::Nexixpay,+ connectors::Opayo,+ connectors::Opennode,+ connectors::Nuvei,+ connectors::Paybox,+ connectors::Payeezy,+ connectors::Payjustnow,+ connectors::Payjustnowinstore,+ connectors::Payload,+ connectors::Payme,+ connectors::Payone,+ connectors::Paypal,+ connectors::Paysafe,+ connectors::Paystack,+ connectors::Paytm,+ connectors::Payu,+ connectors::Peachpayments,+ connectors::Phonepe,+ connectors::Placetopay,+ connectors::Powertranz,+ connectors::Prophetpay,+ connectors::Mifinity,+ connectors::Mollie,+ connectors::Moneris,+ connectors::Mpgs,+ connectors::Multisafepay,+ connectors::Rapyd,+ connectors::Razorpay,+ connectors::Recurly,+ connectors::Redsys,+ connectors::Revolv3,+ connectors::Riskified,+ connectors::Shift4,+ connectors::Sift,+ connectors::Silverflow,+ connectors::Signifyd,+ connectors::Stax,+ connectors::Square,+ connectors::Stripe,+ connectors::Stripebilling,+ connectors::Taxjar,+ connectors::Tesouro,+ connectors::Threedsecureio,+ connectors::Thunes,+ connectors::Tokenex,+ connectors::Tokenio,+ connectors::Truelayer,+ connectors::Trustly,+ connectors::Trustpay,+ connectors::Trustpayments,+ connectors::Tsys,+ connectors::UnifiedAuthenticationService,+ connectors::Wise,+ connectors::Worldline,+ connectors::Worldpay,+ connectors::Worldpaymodular,+ connectors::Worldpayvantiv,+ connectors::Worldpayxml,+ connectors::Wellsfargo,+ connectors::Wellsfargopayout,+ connectors::Volt,+ connectors::Xendit,+ connectors::Zift,+ connectors::Zen,+ connectors::Zsl,+ connectors::CtpMastercard+);++macro_rules! default_imp_for_push_notification_flow {+ ($($path:ident::$connector:ident),*) => {+ $(+ impl PaymentsPushNotification for $path::$connector {}+ impl+ ConnectorIntegration<+ PushNotification,+ PushNotificationRequestData,+ PaymentsResponseData,+ > for $path::$connector+ {}+ )*+ };+}++default_imp_for_push_notification_flow!(+ connectors::Plaid,+ connectors::Vgs,+ connectors::Aci,+ connectors::Adyen,+ connectors::Adyenplatform,+ connectors::Affirm,+ connectors::Airwallex,+ connectors::Amazonpay,+ connectors::Archipel,+ connectors::Authipay,+ connectors::Authorizedotnet,+ connectors::Bambora,+ connectors::Bamboraapac,+ connectors::Bankofamerica,+ connectors::Barclaycard,+ connectors::Billwerk,+ connectors::Bitpay,+ connectors::Blackhawknetwork,+ connectors::Calida,+ connectors::Bluesnap,+ connectors::Braintree,+ connectors::Boku,+ connectors::Breadpay,+ connectors::Cashtocode,+ connectors::Celero,+ connectors::Chargebee,+ connectors::Checkbook,+ connectors::Checkout,+ connectors::Coinbase,+ connectors::Coingate,+ connectors::Cryptopay,+ connectors::Custombilling,+ connectors::Cybersource,+ connectors::Cybersourcedecisionmanager,+ connectors::Datatrans,+ connectors::Deutschebank,+ connectors::Digitalvirgo,+ connectors::Dlocal,+ connectors::Dwolla,+ connectors::Ebanx,+ connectors::Elavon,+ connectors::Envoy,+ connectors::Facilitapay,+ connectors::Finix,+ connectors::Fiserv,+ connectors::Fiservcommercehub,+ connectors::Fiservemea,+ connectors::Fiuu,+ connectors::Flexiti,+ connectors::Forte,+ connectors::Getnet,+ connectors::Gigadat,+ connectors::Globalpay,+ connectors::Globepay,+ connectors::Gocardless,+ connectors::Gpayments,+ connectors::Hipay,+ connectors::Hyperpg,+ connectors::Helcim,+ connectors::HyperswitchVault,+ connectors::Hyperwallet,+ connectors::Iatapay,+ connectors::Inespay,+ connectors::Itaubank,+ connectors::Jpmorgan,+ connectors::Juspaythreedsserver,+ connectors::Katapult,+ connectors::Klarna,+ connectors::Loonio,+ connectors::Netcetera,+ connectors::Nmi,+ connectors::Nomupay,+ connectors::Noon,+ connectors::Nordea,+ connectors::Novalnet,+ connectors::Nexinets,+ connectors::Nexixpay,+ connectors::Opayo,+ connectors::Opennode,+ connectors::Nuvei,+ connectors::Paybox,+ connectors::Payeezy,+ connectors::Payjustnow,+ connectors::Payjustnowinstore,+ connectors::Payload,+ connectors::Payme,+ connectors::Payone,+ connectors::Paypal,+ connectors::Paysafe,+ connectors::Paystack,+ connectors::Paytm,+ connectors::Payu,+ connectors::Peachpayments,+ connectors::Phonepe,+ connectors::Placetopay,+ connectors::Powertranz,+ connectors::Prophetpay,+ connectors::Mifinity,+ connectors::Mollie,+ connectors::Moneris,+ connectors::Mpgs,+ connectors::Multisafepay,+ connectors::Rapyd,+ connectors::Razorpay,+ connectors::Recurly,+ connectors::Redsys,+ connectors::Revolv3,+ connectors::Riskified,+ connectors::Shift4,+ connectors::Sift,+ connectors::Silverflow,+ connectors::Signifyd,+ connectors::Stax,+ connectors::Square,+ connectors::Stripe,+ connectors::Stripebilling,+ connectors::Taxjar,+ connectors::Tesouro,+ connectors::Threedsecureio,+ connectors::Thunes,+ connectors::Tokenex,+ connectors::Tokenio,+ connectors::Truelayer,+ connectors::Trustly,+ connectors::Trustpay,+ connectors::Trustpayments,+ connectors::Tsys,+ connectors::UnifiedAuthenticationService,+ connectors::Wise,+ connectors::Worldline,+ connectors::Worldpay,+ connectors::Worldpaymodular,+ connectors::Worldpayvantiv,+ connectors::Worldpayxml,+ connectors::Wellsfargo,+ connectors::Wellsfargopayout,+ connectors::Volt,+ connectors::Xendit,+ connectors::Zift,+ connectors::Zen,+ connectors::Zsl,+ connectors::CtpMastercard+);diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rsindex 2d883fbe39..9a7139910c 100644--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs@@ -21,9 +21,10 @@ use hyperswitch_domain_models::{payments::{Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,CreateConnectorCustomer, CreateOrder, ExtendAuthorization, ExternalVaultProxy,- GiftCardBalanceCheck, IncrementalAuthorization, PSync, PaymentMethodToken,- PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, Reject,- SdkSessionUpdate, Session, SettlementSplitCreate, SetupMandate, UpdateMetadata, Void,+ GenerateQr, GiftCardBalanceCheck, IncrementalAuthorization, PSync, PaymentMethodToken,+ PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, PushNotification,+ Reject, SdkSessionUpdate, Session, SettlementSplitCreate, SetupMandate, UpdateMetadata,+ Void,},refunds::{Execute, RSync},revenue_recovery::{@@ -44,17 +45,17 @@ use hyperswitch_domain_models::{AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AccessTokenRequestData,AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,CreateOrderRequestData, DefendDisputeRequestData, DisputeSyncData,- ExternalVaultProxyPaymentsData, FetchDisputesRequestData, GiftCardBalanceCheckRequestData,- MandateRevokeRequestData, PaymentMethodTokenizationData, PaymentsApproveData,- PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,+ ExternalVaultProxyPaymentsData, FetchDisputesRequestData, GenerateQrRequestData,+ GiftCardBalanceCheckRequestData, MandateRevokeRequestData, PaymentMethodTokenizationData,+ PaymentsApproveData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsExtendAuthorizationData,PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData,- PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,- RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,- SetupMandateRequestData, SubmitEvidenceRequestData, UploadFileRequestData,- VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PushNotificationRequestData,+ RefundsData, RetrieveFileRequestData, SdkPaymentsSessionUpdateData,+ SettlementSplitRequestData, SetupMandateRequestData, SubmitEvidenceRequestData,+ UploadFileRequestData, VaultRequestData, VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::ConnectorWebhookRegisterResponse,@@ -120,9 +121,10 @@ use hyperswitch_interfaces::{PaymentPostCaptureVoidV2, PaymentPostSessionTokensV2, PaymentRejectV2,PaymentSessionUpdateV2, PaymentSessionV2, PaymentSyncV2, PaymentTokenV2,PaymentUpdateMetadataV2, PaymentV2, PaymentVoidV2, PaymentsAuthenticateV2,- PaymentsCompleteAuthorizeV2, PaymentsGiftCardBalanceCheckV2,+ PaymentsCompleteAuthorizeV2, PaymentsGenerateQrV2, PaymentsGiftCardBalanceCheckV2,PaymentsPostAuthenticateV2, PaymentsPostProcessingV2, PaymentsPreAuthenticateV2,- PaymentsPreProcessingV2, PaymentsSettlementSplitCreate, TaxCalculationV2,+ PaymentsPreProcessingV2, PaymentsPushNotificationV2, PaymentsSettlementSplitCreate,+ TaxCalculationV2,},refunds_v2::{RefundExecuteV2, RefundSyncV2, RefundV2},revenue_recovery_v2::{@@ -167,6 +169,8 @@ macro_rules! default_imp_for_new_connector_integration_payment {impl PaymentsAuthenticateV2 for $path::$connector{}impl PaymentsPostAuthenticateV2 for $path::$connector{}impl PaymentsPostProcessingV2 for $path::$connector{}+ impl PaymentsPushNotificationV2 for $path::$connector{}+ impl PaymentsGenerateQrV2 for $path::$connector{}impl TaxCalculationV2 for $path::$connector{}impl PaymentSessionUpdateV2 for $path::$connector{}impl PaymentPostSessionTokensV2 for $path::$connector{}@@ -263,6 +267,18 @@ macro_rules! default_imp_for_new_connector_integration_payment {PaymentsPostProcessingData,PaymentsResponseData,> for $path::$connector{}+ impl ConnectorIntegrationV2<+ PushNotification,+ PaymentFlowData,+ PushNotificationRequestData,+ PaymentsResponseData,+ > for $path::$connector{}+ impl ConnectorIntegrationV2<+ GenerateQr,+ PaymentFlowData,+ GenerateQrRequestData,+ PaymentsResponseData,+ > for $path::$connector{}implConnectorIntegrationV2<AuthorizeSessionToken,diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rsindex 6d8dbdcc74..d1c0efc30b 100644--- a/crates/hyperswitch_domain_models/src/lib.rs+++ b/crates/hyperswitch_domain_models/src/lib.rs@@ -121,6 +121,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {apple_pay_recurring_details,pix_additional_details,boleto_additional_details,+ pix_automatico_additional_details,..} = from;@@ -134,6 +135,8 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {.map(diesel_models::types::PixAdditionalDetails::convert_from),boleto_additional_details: boleto_additional_details.map(diesel_models::types::BoletoAdditionalDetails::convert_from),+ pix_automatico_additional_details: pix_automatico_additional_details+ .map(diesel_models::types::PixAutomaticoAdditionalDetails::convert_from),}}@@ -144,6 +147,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {apple_pay_recurring_details,pix_additional_details,boleto_additional_details,+ pix_automatico_additional_details,..} = self;@@ -153,6 +157,8 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {apple_pay_recurring_details: apple_pay_recurring_details.map(|v| v.convert_back()),pix_additional_details: pix_additional_details.map(|v| v.convert_back()),boleto_additional_details: boleto_additional_details.map(|v| v.convert_back()),+ pix_automatico_additional_details: pix_automatico_additional_details+ .map(|v| v.convert_back()),}}}@@ -221,6 +227,30 @@ impl ApiModelToDieselModelConvertor<api_models::payments::PixAdditionalDetails>}}+impl ApiModelToDieselModelConvertor<api_models::payments::PixAutomaticoAdditionalDetails>+ for diesel_models::types::PixAutomaticoAdditionalDetails+{+ fn convert_from(from: api_models::payments::PixAutomaticoAdditionalDetails) -> Self {+ match from {+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoPush(v) => {+ Self::PixAutomaticoPush(diesel_models::types::PixAutomaticoPushDetails {+ time: v.time,+ })+ }+ }+ }++ fn convert_back(self) -> api_models::payments::PixAutomaticoAdditionalDetails {+ match self {+ Self::PixAutomaticoPush(v) => {+ api_models::payments::PixAutomaticoAdditionalDetails::PixAutomaticoPush(+ api_models::payments::PixAutomaticoPushDetails { time: v.time },+ )+ }+ }+ }+}+#[cfg(feature = "v2")]impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {fn convert_from(from: ApiFeatureMetadata) -> Self {@@ -231,6 +261,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {revenue_recovery: payment_revenue_recovery_metadata,pix_additional_details,boleto_additional_details,+ pix_automatico_additional_details,} = from;Self {@@ -244,6 +275,8 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {.map(diesel_models::types::PixAdditionalDetails::convert_from),boleto_additional_details: boleto_additional_details.map(diesel_models::types::BoletoAdditionalDetails::convert_from),+ pix_automatico_additional_details: pix_automatico_additional_details+ .map(diesel_models::types::PixAutomaticoAdditionalDetails::convert_from),}}@@ -255,6 +288,7 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {payment_revenue_recovery_metadata,pix_additional_details,boleto_additional_details,+ pix_automatico_additional_details,} = self;ApiFeatureMetadata {@@ -266,6 +300,8 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {revenue_recovery: payment_revenue_recovery_metadata.map(|value| value.convert_back()),pix_additional_details: pix_additional_details.map(|v| v.convert_back()),boleto_additional_details: boleto_additional_details.map(|v| v.convert_back()),+ pix_automatico_additional_details: pix_automatico_additional_details+ .map(|v| v.convert_back()),}}}diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rsindex f0e9533aa3..f802e2f334 100644--- a/crates/hyperswitch_domain_models/src/payments.rs+++ b/crates/hyperswitch_domain_models/src/payments.rs@@ -1525,6 +1525,9 @@ whereboleto_additional_details: payment_intent_feature_metadata.as_ref().and_then(|data| data.boleto_additional_details.clone()),+ pix_automatico_additional_details: payment_intent_feature_metadata+ .as_ref()+ .and_then(|data| data.pix_automatico_additional_details.clone()),}))}}diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rsindex e01ad68454..5041aa4a5f 100644--- a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs+++ b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs@@ -47,6 +47,12 @@ pub struct SetupMandate;#[derive(Debug, Clone)]pub struct PreProcessing;+#[derive(Debug, Clone)]+pub struct PushNotification;++#[derive(Debug, Clone)]+pub struct GenerateQr;+#[derive(Debug, Clone)]pub struct IncrementalAuthorization;diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex 641fa7f50b..1d5a130dbe 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -410,6 +410,59 @@ impl TryFrom<SetupMandateRequestData> for PaymentsPreProcessingData {})}}++impl TryFrom<SetupMandateRequestData> for PushNotificationRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(data: SetupMandateRequestData) -> Result<Self, Self::Error> {+ Ok(Self {+ payment_method_data: Some(data.payment_method_data),+ feature_metadata: data.feature_metadata,+ mandate_id: data.mandate_id,+ amount: Some(data.amount),+ })+ }+}++impl TryFrom<PaymentsAuthorizeData> for PushNotificationRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> {+ Ok(Self {+ payment_method_data: Some(data.payment_method_data),+ feature_metadata: None,+ mandate_id: None,+ amount: None,+ })+ }+}++impl TryFrom<PaymentsAuthenticateData> for PushNotificationRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(data: PaymentsAuthenticateData) -> Result<Self, Self::Error> {+ Ok(Self {+ payment_method_data: data.payment_method_data,+ feature_metadata: None,+ mandate_id: None,+ amount: None,+ })+ }+}++impl TryFrom<CompleteAuthorizeData> for PushNotificationRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(data: CompleteAuthorizeData) -> Result<Self, Self::Error> {+ Ok(Self {+ payment_method_data: data.payment_method_data,+ feature_metadata: None,+ mandate_id: None,+ amount: None,+ })+ }+}+implTryFrom<&RouterData<flows::Authorize, PaymentsAuthorizeData, response_types::PaymentsResponseData>,@@ -1723,6 +1776,7 @@ pub struct SetupMandateRequestData {pub setup_mandate_details: Option<mandates::MandateData>,pub router_return_url: Option<String>,pub webhook_url: Option<String>,+ pub feature_metadata: Option<api_models::payments::FeatureMetadata>,pub browser_info: Option<BrowserInformation>,pub email: Option<pii::Email>,pub customer_name: Option<Secret<String>>,@@ -1765,3 +1819,93 @@ pub struct DisputeSyncData {pub dispute_id: String,pub connector_dispute_id: String,}++#[derive(Debug, Clone, Serialize)]+pub struct PushNotificationRequestData {+ pub payment_method_data: Option<PaymentMethodData>,+ pub feature_metadata: Option<api_models::payments::FeatureMetadata>,+ pub mandate_id: Option<api_models::payments::MandateIds>,+ pub amount: Option<i64>,+}++impl PushNotificationRequestData {+ pub fn get_connector_mandate_id(&self) -> Option<String> {+ self.mandate_id+ .as_ref()+ .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id {+ Some(api_models::payments::MandateReferenceId::ConnectorMandateId(+ connector_mandate_ids,+ )) => connector_mandate_ids.get_connector_mandate_id(),+ Some(api_models::payments::MandateReferenceId::NetworkMandateId(_))+ | Some(api_models::payments::MandateReferenceId::NetworkTokenWithNTI(_))+ | Some(api_models::payments::MandateReferenceId::CardWithLimitedData)+ | None => None,+ })+ }+}++#[derive(Debug, Clone, Serialize)]+pub struct GenerateQrRequestData {+ pub amount: Option<i64>,+ pub mandate_id: Option<api_models::payments::MandateIds>,+}++impl GenerateQrRequestData {+ pub fn get_connector_mandate_id(&self) -> Option<String> {+ self.mandate_id+ .as_ref()+ .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id {+ Some(api_models::payments::MandateReferenceId::ConnectorMandateId(+ connector_mandate_ids,+ )) => connector_mandate_ids.get_connector_mandate_id(),+ Some(api_models::payments::MandateReferenceId::NetworkMandateId(_))+ | Some(api_models::payments::MandateReferenceId::NetworkTokenWithNTI(_))+ | Some(api_models::payments::MandateReferenceId::CardWithLimitedData)+ | None => None,+ })+ }+}++impl TryFrom<SetupMandateRequestData> for GenerateQrRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(data: SetupMandateRequestData) -> Result<Self, Self::Error> {+ Ok(Self {+ amount: Some(data.amount),+ mandate_id: data.mandate_id,+ })+ }+}++impl TryFrom<PaymentsAuthorizeData> for GenerateQrRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> {+ Ok(Self {+ amount: Some(data.amount),+ mandate_id: data.mandate_id,+ })+ }+}++impl TryFrom<PaymentsAuthenticateData> for GenerateQrRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(_data: PaymentsAuthenticateData) -> Result<Self, Self::Error> {+ Ok(Self {+ amount: None,+ mandate_id: None,+ })+ }+}++impl TryFrom<CompleteAuthorizeData> for GenerateQrRequestData {+ type Error = error_stack::Report<ApiErrorResponse>;++ fn try_from(_data: CompleteAuthorizeData) -> Result<Self, Self::Error> {+ Ok(Self {+ amount: None,+ mandate_id: None,+ })+ }+}diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rsindex 10a09cc5c7..55a3894475 100644--- a/crates/hyperswitch_domain_models/src/types.rs+++ b/crates/hyperswitch_domain_models/src/types.rs@@ -15,10 +15,10 @@ use crate::{Authorize, AuthorizeSessionToken, BillingConnectorInvoiceSync,BillingConnectorPaymentsSync, CalculateTax, Capture, CompleteAuthorize,CreateConnectorCustomer, CreateOrder, Execute, ExtendAuthorization, ExternalVaultProxy,- GiftCardBalanceCheck, IncrementalAuthorization, PSync, PaymentMethodToken,+ GenerateQr, GiftCardBalanceCheck, IncrementalAuthorization, PSync, PaymentMethodToken,PostAuthenticate, PostCaptureVoid, PostSessionTokens, PreAuthenticate, PreProcessing,- ProcessIncomingWebhook, RSync, SdkSessionUpdate, Session, SettlementSplitCreate,- SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,+ ProcessIncomingWebhook, PushNotification, RSync, SdkSessionUpdate, Session,+ SettlementSplitCreate, SetupMandate, UpdateMetadata, VerifyWebhookSource, Void,},router_request_types::{merchant_connector_webhook_management::ConnectorWebhookRegisterRequest,@@ -38,15 +38,15 @@ use crate::{},AccessTokenAuthenticationRequestData, AccessTokenRequestData, AuthorizeSessionTokenData,CompleteAuthorizeData, ConnectorCustomerData, CreateOrderRequestData,- ExternalVaultProxyPaymentsData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,- PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,- PaymentsCancelData, PaymentsCancelPostCaptureData, PaymentsCaptureData,- PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,+ ExternalVaultProxyPaymentsData, GenerateQrRequestData, GiftCardBalanceCheckRequestData,+ MandateRevokeRequestData, PaymentMethodTokenizationData, PaymentsAuthenticateData,+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,+ PaymentsCaptureData, PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,- PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,- SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SetupMandateRequestData,- VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PushNotificationRequestData,+ RefundsData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,+ SetupMandateRequestData, VaultRequestData, VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::ConnectorWebhookRegisterResponse,@@ -75,6 +75,10 @@ pub type PaymentsAuthorizeSessionTokenRouterData =RouterData<AuthorizeSessionToken, AuthorizeSessionTokenData, PaymentsResponseData>;pub type PaymentsPreProcessingRouterData =RouterData<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;+pub type PaymentsPushNotificationRouterData =+ RouterData<PushNotification, PushNotificationRequestData, PaymentsResponseData>;+pub type PaymentsGenerateQrRouterData =+ RouterData<GenerateQr, GenerateQrRequestData, PaymentsResponseData>;pub type PaymentsPreAuthenticateRouterData =RouterData<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>;pub type PaymentsAuthenticateRouterData =diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rsindex 610c65f9e0..9893bdd687 100644--- a/crates/hyperswitch_interfaces/src/api.rs+++ b/crates/hyperswitch_interfaces/src/api.rs@@ -469,10 +469,18 @@ pub trait ConnectorSpecifications {fn is_post_authentication_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {false}- /// Check if pre-authentication flow is required+ /// Check if settlement split flow is requiredfn is_settlement_split_call_required(&self, _current_flow: CurrentFlowInfo) -> bool {false}+ /// Check if payment trigger flow is required+ fn is_push_notification_flow_required(&self, _current_flow: CurrentFlowInfo) -> bool {+ false+ }+ /// Check if generate QR flow is required+ fn is_generate_qr_flow_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,diff --git a/crates/hyperswitch_interfaces/src/api/payments.rs b/crates/hyperswitch_interfaces/src/api/payments.rsindex b334f8af18..edd63a5c27 100644--- a/crates/hyperswitch_interfaces/src/api/payments.rs+++ b/crates/hyperswitch_interfaces/src/api/payments.rs@@ -4,25 +4,25 @@ use hyperswitch_domain_models::{router_flow_types::{payments::{Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,- CreateConnectorCustomer, ExtendAuthorization, IncrementalAuthorization, PSync,- PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing,- Reject, SdkSessionUpdate, Session, SettlementSplitCreate, SetupMandate, UpdateMetadata,- Void,+ CreateConnectorCustomer, ExtendAuthorization, GenerateQr, IncrementalAuthorization,+ PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens,+ PreProcessing, PushNotification, Reject, SdkSessionUpdate, Session,+ SettlementSplitCreate, SetupMandate, UpdateMetadata, Void,},Authenticate, CreateOrder, ExternalVaultProxy, GiftCardBalanceCheck, PostAuthenticate,PreAuthenticate,},router_request_types::{AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,- CreateOrderRequestData, ExternalVaultProxyPaymentsData, GiftCardBalanceCheckRequestData,- PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthenticateData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,- PaymentsCaptureData, PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,- PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,- PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,- PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,- SetupMandateRequestData,+ CreateOrderRequestData, ExternalVaultProxyPaymentsData, GenerateQrRequestData,+ GiftCardBalanceCheckRequestData, PaymentMethodTokenizationData, PaymentsApproveData,+ PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,+ PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsExtendAuthorizationData,+ PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,+ PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,+ PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PushNotificationRequestData,+ SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SetupMandateRequestData,},router_response_types::{GiftCardBalanceCheckResponseData, PaymentsResponseData, TaxCalculationResponseData,@@ -52,6 +52,8 @@ pub trait Payment:+ PaymentSession+ PaymentToken+ PaymentsPostProcessing+ + PaymentsPushNotification+ + PaymentsGenerateQr+ ConnectorCustomer+ PaymentIncrementalAuthorization+ PaymentExtendAuthorization@@ -217,6 +219,18 @@ pub trait PaymentsPostProcessing:{}+/// trait PaymentsPushNotification+pub trait PaymentsPushNotification:+ api::ConnectorIntegration<PushNotification, PushNotificationRequestData, PaymentsResponseData>+{+}++/// trait PaymentsGenerateQr+pub trait PaymentsGenerateQr:+ api::ConnectorIntegration<GenerateQr, GenerateQrRequestData, PaymentsResponseData>+{+}+/// trait PaymentsCreateOrderpub trait PaymentsCreateOrder:api::ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData>diff --git a/crates/hyperswitch_interfaces/src/api/payments_v2.rs b/crates/hyperswitch_interfaces/src/api/payments_v2.rsindex 20bd73fef1..54795bf9b3 100644--- a/crates/hyperswitch_interfaces/src/api/payments_v2.rs+++ b/crates/hyperswitch_interfaces/src/api/payments_v2.rs@@ -6,23 +6,23 @@ use hyperswitch_domain_models::{payments::{Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize,CreateConnectorCustomer, CreateOrder, ExtendAuthorization, ExternalVaultProxy,- IncrementalAuthorization, PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing,- PostSessionTokens, PreProcessing, Reject, SdkSessionUpdate, Session,- SettlementSplitCreate, SetupMandate, UpdateMetadata, Void,+ GenerateQr, IncrementalAuthorization, PSync, PaymentMethodToken, PostCaptureVoid,+ PostProcessing, PostSessionTokens, PreProcessing, PushNotification, Reject,+ SdkSessionUpdate, Session, SettlementSplitCreate, SetupMandate, UpdateMetadata, Void,},Authenticate, GiftCardBalanceCheck, PostAuthenticate, PreAuthenticate,},router_request_types::{AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,- CreateOrderRequestData, ExternalVaultProxyPaymentsData, GiftCardBalanceCheckRequestData,- PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthenticateData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,- PaymentsCaptureData, PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,- PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,- PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,- PaymentsUpdateMetadataData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,- SetupMandateRequestData,+ CreateOrderRequestData, ExternalVaultProxyPaymentsData, GenerateQrRequestData,+ GiftCardBalanceCheckRequestData, PaymentMethodTokenizationData, PaymentsApproveData,+ PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,+ PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsExtendAuthorizationData,+ PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,+ PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,+ PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PushNotificationRequestData,+ SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SetupMandateRequestData,},router_response_types::{GiftCardBalanceCheckResponseData, PaymentsResponseData, TaxCalculationResponseData,@@ -284,6 +284,23 @@ pub trait PaymentsPostProcessingV2:{}+/// trait PaymentsPushNotificationV2+pub trait PaymentsPushNotificationV2:+ ConnectorIntegrationV2<+ PushNotification,+ PaymentFlowData,+ PushNotificationRequestData,+ PaymentsResponseData,+>+{+}++/// trait PaymentsGenerateQrV2+pub trait PaymentsGenerateQrV2:+ ConnectorIntegrationV2<GenerateQr, PaymentFlowData, GenerateQrRequestData, PaymentsResponseData>+{+}+/// trait ExternalVaultProxyPaymentsCreatepub trait ExternalVaultProxyPaymentsCreate:ConnectorIntegrationV2<@@ -316,6 +333,8 @@ pub trait PaymentV2:+ PaymentSessionV2+ PaymentTokenV2+ PaymentsPostProcessingV2+ + PaymentsPushNotificationV2+ + PaymentsGenerateQrV2+ ConnectorCustomerV2+ PaymentIncrementalAuthorizationV2+ PaymentExtendAuthorizationV2diff --git a/crates/hyperswitch_interfaces/src/connector_integration_interface.rs b/crates/hyperswitch_interfaces/src/connector_integration_interface.rsindex 33f1a5b61b..c9088e0b56 100644--- a/crates/hyperswitch_interfaces/src/connector_integration_interface.rs+++ b/crates/hyperswitch_interfaces/src/connector_integration_interface.rs@@ -612,6 +612,18 @@ impl ConnectorSpecifications for ConnectorEnum {Self::New(connector) => connector.is_settlement_split_call_required(current_flow),}}+ fn is_push_notification_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {+ match self {+ Self::Old(connector) => connector.is_push_notification_flow_required(current_flow),+ Self::New(connector) => connector.is_push_notification_flow_required(current_flow),+ }+ }+ fn is_generate_qr_flow_required(&self, current_flow: CurrentFlowInfo) -> bool {+ match self {+ Self::Old(connector) => connector.is_generate_qr_flow_required(current_flow),+ Self::New(connector) => connector.is_generate_qr_flow_required(current_flow),+ }+ }fn get_preprocessing_flow_if_needed(&self,current_flow_info: CurrentFlowInfo,diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rsindex 9599312073..ee8e1c9aee 100644--- a/crates/hyperswitch_interfaces/src/types.rs+++ b/crates/hyperswitch_interfaces/src/types.rs@@ -11,10 +11,10 @@ use hyperswitch_domain_models::{merchant_connector_webhook_management::ConnectorWebhookRegister,payments::{Authorize, AuthorizeSessionToken, Balance, CalculateTax, Capture, CompleteAuthorize,- CreateConnectorCustomer, CreateOrder, ExtendAuthorization, IncrementalAuthorization,- InitPayment, PSync, PaymentMethodToken, PostCaptureVoid, PostProcessing,- PostSessionTokens, PreProcessing, SdkSessionUpdate, Session, SettlementSplitCreate,- SetupMandate, UpdateMetadata, Void,+ CreateConnectorCustomer, CreateOrder, ExtendAuthorization, GenerateQr,+ IncrementalAuthorization, InitPayment, PSync, PaymentMethodToken, PostCaptureVoid,+ PostProcessing, PostSessionTokens, PreProcessing, PushNotification, SdkSessionUpdate,+ Session, SettlementSplitCreate, SetupMandate, UpdateMetadata, Void,},refunds::{Execute, RSync},revenue_recovery::{BillingConnectorPaymentsSync, InvoiceRecordBack},@@ -52,16 +52,17 @@ use hyperswitch_domain_models::{AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AccessTokenRequestData,AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,CreateOrderRequestData, DefendDisputeRequestData, DisputeSyncData,- FetchDisputesRequestData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,- PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,- PaymentsCancelData, PaymentsCancelPostCaptureData, PaymentsCaptureData,- PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,+ FetchDisputesRequestData, GenerateQrRequestData, GiftCardBalanceCheckRequestData,+ MandateRevokeRequestData, PaymentMethodTokenizationData, PaymentsAuthenticateData,+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,+ PaymentsCaptureData, PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsSessionData,- PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,- RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SettlementSplitRequestData,- SetupMandateRequestData, SubmitEvidenceRequestData, UploadFileRequestData,- VaultRequestData, VerifyWebhookSourceRequestData,+ PaymentsSyncData, PaymentsTaxCalculationData, PaymentsUpdateMetadataData,+ PushNotificationRequestData, RefundsData, RetrieveFileRequestData,+ SdkPaymentsSessionUpdateData, SettlementSplitRequestData, SetupMandateRequestData,+ SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,+ VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::ConnectorWebhookRegisterResponse,@@ -157,6 +158,12 @@ pub type PaymentsPostAuthenticateType =/// Type alias for `ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>`pub type PaymentsPostProcessingType =dyn ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>;+/// Type alias for `ConnectorIntegration<PushNotification, PushNotificationRequestData, PaymentsResponseData>`+pub type PaymentsPushNotificationType =+ dyn ConnectorIntegration<PushNotification, PushNotificationRequestData, PaymentsResponseData>;+/// Type alias for `ConnectorIntegration<GenerateQr, GenerateQrRequestData, PaymentsResponseData>`+pub type PaymentsGenerateQrType =+ dyn ConnectorIntegration<GenerateQr, GenerateQrRequestData, PaymentsResponseData>;/// Type alias for `ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>`pub type PaymentsCompleteAuthorizeType =dyn ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>;diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex 89f1128f1d..3da5009695 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -556,6 +556,8 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::ApplepayConnectorMetadataRequest,api_models::payments::SessionTokenInfo,api_models::payments::PixAdditionalDetails,+ api_models::payments::PixAutomaticoPushDetails,+ api_models::payments::PixAutomaticoAdditionalDetails,api_models::payments::ImmediateExpirationTime,api_models::payments::ScheduledExpirationTime,api_models::payments::BoletoAdditionalDetails,diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rsindex 45db353b49..4d0c4c2640 100644--- a/crates/openapi/src/openapi_v2.rs+++ b/crates/openapi/src/openapi_v2.rs@@ -481,6 +481,8 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::ApplepayConnectorMetadataRequest,api_models::payments::SessionTokenInfo,api_models::payments::PixAdditionalDetails,+ api_models::payments::PixAutomaticoPushDetails,+ api_models::payments::PixAutomaticoAdditionalDetails,api_models::payments::ImmediateExpirationTime,api_models::payments::ScheduledExpirationTime,api_models::payments::BoletoAdditionalDetails,diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex 724e647fe9..3df8baebea 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -3631,6 +3631,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {apple_pay_recurring_details: None,pix_additional_details: None,boleto_additional_details: None,+ pix_automatico_additional_details: None,}),..Default::default()};@@ -4140,6 +4141,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {apple_pay_recurring_details: None,pix_additional_details: None,boleto_additional_details: None,+ pix_automatico_additional_details: None,}),..Default::default()};@@ -4717,6 +4719,7 @@ where*payment_data = new_payment_data;let mut router_data = call_connector_service_response.router_data;+ let gateway_context = call_connector_service_response.gateway_context;let router_data = if call_connector_service_response.should_continue_further {// The status of payment_attempt and intent will be updated in the previous step// update this in router_data.@@ -4732,13 +4735,33 @@ wherebusiness_profile,header_payload,return_raw_connector_response,- call_connector_service_response.gateway_context,+ gateway_context.clone(),).await} else {Ok(router_data)}?;+ let should_continue_payment = router_data.response.is_ok();++ // Call push notification step after the authorize/setup mandate flow completes+ let (router_data, _should_continue_trigger) = if should_continue_payment {+ router_data+ .push_notification_step(state, connector, &gateway_context)+ .await?+ } else {+ (router_data, false)+ };++ // Call generate QR step after the authorize/setup mandate flow completes+ let (router_data, _should_continue_generate_qr) = if should_continue_payment {+ router_data+ .generate_qr_step(state, connector, &gateway_context)+ .await?+ } else {+ (router_data, false)+ };+Ok((router_data, merchant_connector_account))}@@ -5185,6 +5208,7 @@ where*payment_data = new_payment_data;let mut router_data = call_connector_service_response.router_data;+ let gateway_context = call_connector_service_response.gateway_context;let router_data = if call_connector_service_response.should_continue_further {// The status of payment_attempt and intent will be updated in the previous step// update this in router_data.@@ -5199,15 +5223,35 @@ wherecall_connector_action,call_connector_service_response.connector_request,business_profile,- header_payload,+ header_payload.clone(),return_raw_connector_response,- call_connector_service_response.gateway_context,+ gateway_context.clone(),).await} else {Ok(router_data)}?;+ let should_continue_payment = router_data.response.is_ok();++ // Call push notification step after the authorize/setup mandate flow completes+ let (router_data, should_continue_trigger) = if should_continue_payment {+ router_data+ .push_notification_step(state, connector, &gateway_context)+ .await?+ } else {+ (router_data, false)+ };++ // Call generate QR step after the authorize/setup mandate flow completes+ let (router_data, _should_continue_generate_qr) = if should_continue_payment {+ router_data+ .generate_qr_step(state, connector, &gateway_context)+ .await?+ } else {+ (router_data, false)+ };+Ok((router_data, merchant_connector_account_type_details))}diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rsindex 79f06e7bc0..b662ef142e 100644--- a/crates/router/src/core/payments/flows.rs+++ b/crates/router/src/core/payments/flows.rs@@ -213,6 +213,32 @@ pub trait Feature<F, T> {Ok((self, true))}+ async fn push_notification_step<'a>(+ self,+ _state: &SessionState,+ _connector: &api::ConnectorData,+ _gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ F: Clone,+ Self: Sized,+ {+ Ok((self, true))+ }++ async fn generate_qr_step<'a>(+ self,+ _state: &SessionState,+ _connector: &api::ConnectorData,+ _gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ F: Clone,+ Self: Sized,+ {+ Ok((self, true))+ }+async fn postprocessing_steps<'a>(self,_state: &SessionState,diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rsindex c39ec296c2..3de5311981 100644--- a/crates/router/src/core/payments/flows/authorize_flow.rs+++ b/crates/router/src/core/payments/flows/authorize_flow.rs@@ -718,6 +718,130 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAuauthorize_postprocessing_steps(state, &self, true, connector).await}+ async fn push_notification_step<'a>(+ self,+ state: &SessionState,+ connector: &api::ConnectorData,+ gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ Self: Sized,+ {+ if connector.connector.is_push_notification_flow_required(+ api_interface::CurrentFlowInfo::Authorize {+ auth_type: self.auth_type,+ request_data: Box::new(self.request.clone()),+ },+ ) {+ logger::info!(+ "Push Notification flow is required for connector: {} for Authorize flow",+ connector.connector_name+ );+ let authorize_request_data = self.request.clone();+ let push_notification_request_data =+ types::PushNotificationRequestData::try_from(self.request.to_owned())?;+ let push_notification_response_data: Result<+ types::PaymentsResponseData,+ types::ErrorResponse,+ > = Err(types::ErrorResponse::default());+ let push_notification_router_data =+ helpers::router_data_type_conversion::<_, api::PushNotification, _, _, _, _>(+ self.clone(),+ push_notification_request_data,+ push_notification_response_data,+ );+ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<+ api::PushNotification,+ types::PushNotificationRequestData,+ types::PaymentsResponseData,+ > = connector.connector.get_connector_integration();+ let push_notification_router_data = gateway::execute_payment_gateway(+ state,+ connector_integration,+ &push_notification_router_data,+ payments::CallConnectorAction::Trigger,+ None,+ None,+ gateway_context.clone(),+ )+ .await+ .to_payment_failed_response()?;+ let push_notification_response = push_notification_router_data.response.clone();+ let authorize_router_data =+ helpers::router_data_type_conversion::<_, api::Authorize, _, _, _, _>(+ push_notification_router_data,+ authorize_request_data,+ push_notification_response,+ );+ let should_continue_payment = authorize_router_data.response.is_ok();+ Ok((authorize_router_data, should_continue_payment))+ } else {+ Ok((self, true))+ }+ }++ async fn generate_qr_step<'a>(+ self,+ state: &SessionState,+ connector: &api::ConnectorData,+ gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ Self: Sized,+ {+ if connector.connector.is_generate_qr_flow_required(+ api_interface::CurrentFlowInfo::Authorize {+ auth_type: self.auth_type,+ request_data: Box::new(self.request.clone()),+ },+ ) {+ logger::info!(+ "Generate Qr flow is required for connector: {} for Authorize flow",+ connector.connector_name+ );+ let authorize_request_data = self.request.clone();+ let generate_qr_request_data =+ types::GenerateQrRequestData::try_from(self.request.to_owned())?;+ let generate_qr_response_data: Result<+ types::PaymentsResponseData,+ types::ErrorResponse,+ > = Err(types::ErrorResponse::default());+ let generate_qr_router_data =+ helpers::router_data_type_conversion::<_, api::GenerateQr, _, _, _, _>(+ self.clone(),+ generate_qr_request_data,+ generate_qr_response_data,+ );+ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<+ api::GenerateQr,+ types::GenerateQrRequestData,+ types::PaymentsResponseData,+ > = connector.connector.get_connector_integration();+ let generate_qr_router_data = gateway::execute_payment_gateway(+ state,+ connector_integration,+ &generate_qr_router_data,+ payments::CallConnectorAction::Trigger,+ None,+ None,+ gateway_context.clone(),+ )+ .await+ .to_payment_failed_response()?;+ let generate_qr_response = generate_qr_router_data.response.clone();+ let authorize_router_data =+ helpers::router_data_type_conversion::<_, api::Authorize, _, _, _, _>(+ generate_qr_router_data,+ authorize_request_data,+ generate_qr_response,+ );+ let should_continue_payment = authorize_router_data.response.is_ok();+ Ok((authorize_router_data, should_continue_payment))+ } else {+ Ok((self, true))+ }+ }+async fn create_connector_customer<'a>(&self,state: &SessionState,diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rsindex 7bab3e897e..1d40df1fba 100644--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs@@ -525,6 +525,132 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>Ok((self, true))}}++ async fn push_notification_step<'a>(+ self,+ state: &SessionState,+ connector: &api::ConnectorData,+ gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ Self: Sized,+ {+ if connector.connector.is_push_notification_flow_required(+ api_interface::CurrentFlowInfo::CompleteAuthorize {+ auth_type: self.auth_type,+ request_data: Box::new(self.request.clone()),+ payment_method: Some(self.payment_method),+ },+ ) {+ logger::info!(+ "Payment trigger flow is required for connector: {} for Complete Authorize flow",+ connector.connector_name+ );+ let complete_authorize_request_data = self.request.clone();+ let push_notification_request_data =+ types::PushNotificationRequestData::try_from(self.request.to_owned())?;+ let push_notification_response_data: Result<+ types::PaymentsResponseData,+ types::ErrorResponse,+ > = Err(types::ErrorResponse::default());+ let push_notification_router_data =+ helpers::router_data_type_conversion::<_, api::PushNotification, _, _, _, _>(+ self.clone(),+ push_notification_request_data,+ push_notification_response_data,+ );+ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<+ api::PushNotification,+ types::PushNotificationRequestData,+ types::PaymentsResponseData,+ > = connector.connector.get_connector_integration();+ let push_notification_router_data = gateway::execute_payment_gateway(+ state,+ connector_integration,+ &push_notification_router_data,+ payments::CallConnectorAction::Trigger,+ None,+ None,+ gateway_context.clone(),+ )+ .await+ .to_payment_failed_response()?;+ let push_notification_response = push_notification_router_data.response.clone();+ let complete_authorize_router_data =+ helpers::router_data_type_conversion::<_, api::CompleteAuthorize, _, _, _, _>(+ push_notification_router_data,+ complete_authorize_request_data,+ push_notification_response,+ );+ let should_continue_payment = complete_authorize_router_data.response.is_ok();+ Ok((complete_authorize_router_data, should_continue_payment))+ } else {+ Ok((self, true))+ }+ }++ async fn generate_qr_step<'a>(+ self,+ state: &SessionState,+ connector: &api::ConnectorData,+ gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ Self: Sized,+ {+ if connector.connector.is_generate_qr_flow_required(+ api_interface::CurrentFlowInfo::CompleteAuthorize {+ auth_type: self.auth_type,+ request_data: Box::new(self.request.clone()),+ payment_method: Some(self.payment_method),+ },+ ) {+ logger::info!(+ "Generate Qr flow is required for connector: {} for Complete Authorize flow",+ connector.connector_name+ );+ let complete_authorize_request_data = self.request.clone();+ let generate_qr_request_data =+ types::GenerateQrRequestData::try_from(self.request.to_owned())?;+ let generate_qr_response_data: Result<+ types::PaymentsResponseData,+ types::ErrorResponse,+ > = Err(types::ErrorResponse::default());+ let generate_qr_router_data =+ helpers::router_data_type_conversion::<_, api::GenerateQr, _, _, _, _>(+ self.clone(),+ generate_qr_request_data,+ generate_qr_response_data,+ );+ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<+ api::GenerateQr,+ types::GenerateQrRequestData,+ types::PaymentsResponseData,+ > = connector.connector.get_connector_integration();+ let generate_qr_router_data = gateway::execute_payment_gateway(+ state,+ connector_integration,+ &generate_qr_router_data,+ payments::CallConnectorAction::Trigger,+ None,+ None,+ gateway_context.clone(),+ )+ .await+ .to_payment_failed_response()?;+ let generate_qr_response = generate_qr_router_data.response.clone();+ let complete_authorize_router_data =+ helpers::router_data_type_conversion::<_, api::CompleteAuthorize, _, _, _, _>(+ generate_qr_router_data,+ complete_authorize_request_data,+ generate_qr_response,+ );+ let should_continue_payment = complete_authorize_router_data.response.is_ok();+ Ok((complete_authorize_router_data, should_continue_payment))+ } else {+ Ok((self, true))+ }+ }}fn transform_redirection_response_for_authenticate_flow(diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rsindex 10b4b0e398..10d2b5b1e8 100644--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs@@ -433,6 +433,130 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup.await}+ async fn generate_qr_step<'a>(+ self,+ state: &SessionState,+ connector: &api::ConnectorData,+ gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ Self: Sized,+ {+ if connector.connector.is_generate_qr_flow_required(+ api_interface::CurrentFlowInfo::SetupMandate {+ auth_type: self.auth_type,+ request_data: Box::new(self.request.clone()),+ },+ ) {+ logger::info!(+ "Generate QR flow is required for connector: {} for Setup Mandate flow",+ connector.connector_name+ );+ let setup_mandate_request_data = self.request.clone();+ let generate_qr_request_data =+ types::GenerateQrRequestData::try_from(self.request.to_owned())?;+ let generate_qr_response_data: Result<+ types::PaymentsResponseData,+ types::ErrorResponse,+ > = Err(types::ErrorResponse::default());+ let generate_qr_router_data =+ helpers::router_data_type_conversion::<_, api::GenerateQr, _, _, _, _>(+ self.clone(),+ generate_qr_request_data,+ generate_qr_response_data,+ );+ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<+ api::GenerateQr,+ types::GenerateQrRequestData,+ types::PaymentsResponseData,+ > = connector.connector.get_connector_integration();+ let generate_qr_router_data = gateway::execute_payment_gateway(+ state,+ connector_integration,+ &generate_qr_router_data,+ payments::CallConnectorAction::Trigger,+ None,+ None,+ gateway_context.clone(),+ )+ .await+ .to_payment_failed_response()?;+ let generate_qr_response = generate_qr_router_data.response.clone();+ let setup_mandate_router_data =+ helpers::router_data_type_conversion::<_, api::SetupMandate, _, _, _, _>(+ generate_qr_router_data,+ setup_mandate_request_data,+ generate_qr_response,+ );+ let should_continue_payment = setup_mandate_router_data.response.is_ok();+ Ok((setup_mandate_router_data, should_continue_payment))+ } else {+ Ok((self, true))+ }+ }++ async fn push_notification_step<'a>(+ self,+ state: &SessionState,+ connector: &api::ConnectorData,+ gateway_context: &gateway_context::RouterGatewayContext,+ ) -> RouterResult<(Self, bool)>+ where+ Self: Sized,+ {+ if connector.connector.is_push_notification_flow_required(+ api_interface::CurrentFlowInfo::SetupMandate {+ auth_type: self.auth_type,+ request_data: Box::new(self.request.clone()),+ },+ ) {+ logger::info!(+ "Push Notification flow is required for connector: {} for Setup Mandate flow",+ connector.connector_name+ );+ let setup_mandate_request_data = self.request.clone();+ let push_notification_request_data =+ types::PushNotificationRequestData::try_from(self.request.to_owned())?;+ let push_notification_response_data: Result<+ types::PaymentsResponseData,+ types::ErrorResponse,+ > = Err(types::ErrorResponse::default());+ let push_notification_router_data =+ helpers::router_data_type_conversion::<_, api::PushNotification, _, _, _, _>(+ self.clone(),+ push_notification_request_data,+ push_notification_response_data,+ );+ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<+ api::PushNotification,+ types::PushNotificationRequestData,+ types::PaymentsResponseData,+ > = connector.connector.get_connector_integration();+ let push_notification_router_data = gateway::execute_payment_gateway(+ state,+ connector_integration,+ &push_notification_router_data,+ payments::CallConnectorAction::Trigger,+ None,+ None,+ gateway_context.clone(),+ )+ .await+ .to_payment_failed_response()?;+ let push_notification_response = push_notification_router_data.response.clone();+ let setup_mandate_router_data =+ helpers::router_data_type_conversion::<_, api::SetupMandate, _, _, _, _>(+ push_notification_router_data,+ setup_mandate_request_data,+ push_notification_response,+ );+ let should_continue_payment = setup_mandate_router_data.response.is_ok();+ Ok((setup_mandate_router_data, should_continue_payment))+ } else {+ Ok((self, true))+ }+ }+async fn build_flow_specific_connector_request(&mut self,state: &SessionState,diff --git a/crates/router/src/core/payments/gateway.rs b/crates/router/src/core/payments/gateway.rsindex 4dc57295b5..5b4d054eac 100644--- a/crates/router/src/core/payments/gateway.rs+++ b/crates/router/src/core/payments/gateway.rs@@ -7,11 +7,13 @@ pub mod complete_authorize_gateway;pub mod context;pub mod create_customer_gateway;pub mod create_order_gateway;+pub mod generate_qr_gateway;pub mod incremental_authorization_gateway;pub mod payment_method_token_create_gateway;pub mod post_authenticate_gateway;pub mod pre_authenticate_gateway;pub mod psync_gateway;+pub mod push_notification_gateway;pub mod session_gateway;pub mod session_token_gateway;pub mod setup_mandate;diff --git a/crates/router/src/core/payments/gateway/generate_qr_gateway.rs b/crates/router/src/core/payments/gateway/generate_qr_gateway.rsnew file mode 100644index 0000000000..8097106ddd--- /dev/null+++ b/crates/router/src/core/payments/gateway/generate_qr_gateway.rs@@ -0,0 +1,53 @@+use common_enums::ExecutionPath;+use hyperswitch_domain_models::router_flow_types as domain;+use hyperswitch_interfaces::{+ api::gateway as payment_gateway, connector_integration_interface::RouterDataConversion,+};++use crate::{core::payments::gateway::context::RouterGatewayContext, routes::SessionState, types};++// =============================================================================+// FlowGateway Implementation for domain::GenerateQr+// =============================================================================++/// Implementation of FlowGateway for GenerateQr+///+/// This allows the flow to provide its specific gateway based on execution path+impl<RCD>+ payment_gateway::FlowGateway<+ SessionState,+ RCD,+ types::GenerateQrRequestData,+ types::PaymentsResponseData,+ RouterGatewayContext,+ > for domain::GenerateQr+where+ RCD: Clone+ + Send+ + Sync+ + 'static+ + RouterDataConversion<Self, types::GenerateQrRequestData, types::PaymentsResponseData>,+{+ fn get_gateway(+ execution_path: ExecutionPath,+ ) -> Box<+ dyn payment_gateway::PaymentGateway<+ SessionState,+ RCD,+ Self,+ types::GenerateQrRequestData,+ types::PaymentsResponseData,+ RouterGatewayContext,+ >,+ > {+ match execution_path {+ // GenerateQr currently only supports DirectGateway+ // UCS support can be added when the gRPC generate_qr methods are implemented+ ExecutionPath::Direct+ | ExecutionPath::UnifiedConnectorService+ | ExecutionPath::ShadowUnifiedConnectorService => {+ Box::new(payment_gateway::DirectGateway)+ }+ }+ }+}diff --git a/crates/router/src/core/payments/gateway/push_notification_gateway.rs b/crates/router/src/core/payments/gateway/push_notification_gateway.rsnew file mode 100644index 0000000000..6e6e04fe32--- /dev/null+++ b/crates/router/src/core/payments/gateway/push_notification_gateway.rs@@ -0,0 +1,53 @@+use common_enums::ExecutionPath;+use hyperswitch_domain_models::router_flow_types as domain;+use hyperswitch_interfaces::{+ api::gateway as payment_gateway, connector_integration_interface::RouterDataConversion,+};++use crate::{core::payments::gateway::context::RouterGatewayContext, routes::SessionState, types};++// =============================================================================+// FlowGateway Implementation for domain::PushNotification+// =============================================================================++/// Implementation of FlowGateway for PushNotification+///+/// This allows the flow to provide its specific gateway based on execution path+impl<RCD>+ payment_gateway::FlowGateway<+ SessionState,+ RCD,+ types::PushNotificationRequestData,+ types::PaymentsResponseData,+ RouterGatewayContext,+ > for domain::PushNotification+where+ RCD: Clone+ + Send+ + Sync+ + 'static+ + RouterDataConversion<Self, types::PushNotificationRequestData, types::PaymentsResponseData>,+{+ fn get_gateway(+ execution_path: ExecutionPath,+ ) -> Box<+ dyn payment_gateway::PaymentGateway<+ SessionState,+ RCD,+ Self,+ types::PushNotificationRequestData,+ types::PaymentsResponseData,+ RouterGatewayContext,+ >,+ > {+ match execution_path {+ // PushNotification currently only supports DirectGateway+ // UCS support can be added when the gRPC push_notification methods are implemented+ ExecutionPath::Direct+ | ExecutionPath::UnifiedConnectorService+ | ExecutionPath::ShadowUnifiedConnectorService => {+ Box::new(payment_gateway::DirectGateway)+ }+ }+ }+}diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 77b77897aa..ce778b1070 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -1579,6 +1579,7 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(split_payments: None,partner_merchant_identifier_details: None,authentication_data: None,+ feature_metadata: None,};let connector_mandate_request_reference_id = payment_data.payment_attempt@@ -6178,6 +6179,17 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ.as_ref().map(AuthenticationData::foreign_try_from).transpose()?),+ feature_metadata: payment_data+ .payment_intent+ .feature_metadata+ .clone()+ .map(|metadata| {+ metadata+ .parse_value::<api_models::payments::FeatureMetadata>("FeatureMetadata")+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Failed parsing FeatureMetadata")+ })+ .transpose()?,})}}@@ -6769,6 +6781,7 @@ impl ForeignFrom<&diesel_models::types::FeatureMetadata> for api_models::paymentsearch_tags: feature_metadata.search_tags.clone(),pix_additional_details: None,boleto_additional_details: None,+ pix_automatico_additional_details: None,}}}diff --git a/crates/router/src/types.rs b/crates/router/src/types.rsindex 8b5378f0a2..e0fb09e223 100644--- a/crates/router/src/types.rs+++ b/crates/router/src/types.rs@@ -39,9 +39,9 @@ use hyperswitch_domain_models::router_flow_types::{payments::{Approve, Authorize, AuthorizeSessionToken, Balance, CalculateTax, Capture,CompleteAuthorize, CreateConnectorCustomer, CreateOrder, ExtendAuthorization,- ExternalVaultProxy, IncrementalAuthorization, InitPayment, PSync, PostCaptureVoid,- PostProcessing, PostSessionTokens, PreProcessing, Reject, SdkSessionUpdate, Session,- SetupMandate, UpdateMetadata, Void,+ ExternalVaultProxy, GenerateQr, IncrementalAuthorization, InitPayment, PSync,+ PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing, PushNotification,+ Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,},refunds::{Execute, RSync},webhooks::VerifyWebhookSource,@@ -75,17 +75,17 @@ pub use hyperswitch_domain_models::{CompleteAuthorizeData, CompleteAuthorizeRedirectResponse, ConnectorCustomerData,CreateOrderRequestData, DefendDisputeRequestData, DestinationChargeRefund,DirectChargeRefund, DisputeSyncData, ExternalVaultProxyPaymentsData,- FetchDisputesRequestData, MandateRevokeRequestData, MultipleCaptureRequestData,- PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthenticateData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCancelPostCaptureData,- PaymentsCaptureData, PaymentsExtendAuthorizationData, PaymentsIncrementalAuthorizationData,- PaymentsPostAuthenticateData, PaymentsPostProcessingData, PaymentsPostSessionTokensData,- PaymentsPreAuthenticateData, PaymentsPreProcessingData, PaymentsRejectData,- PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData,- PaymentsUpdateMetadataData, RefundsData, ResponseId, RetrieveFileRequestData,- SdkPaymentsSessionUpdateData, SetupMandateRequestData, SplitRefundsRequest,- SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData, VaultRequestData,- VerifyWebhookSourceRequestData,+ FetchDisputesRequestData, GenerateQrRequestData, MandateRevokeRequestData,+ MultipleCaptureRequestData, PaymentMethodTokenizationData, PaymentsApproveData,+ PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelData,+ PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsExtendAuthorizationData,+ PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,+ PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,+ PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData,+ PaymentsTaxCalculationData, PaymentsUpdateMetadataData, PushNotificationRequestData,+ RefundsData, ResponseId, RetrieveFileRequestData, SdkPaymentsSessionUpdateData,+ SetupMandateRequestData, SplitRefundsRequest, SubmitEvidenceRequestData, SyncRequestType,+ UploadFileRequestData, VaultRequestData, VerifyWebhookSourceRequestData,},router_response_types::{merchant_connector_webhook_management::ConnectorWebhookRegisterResponse,@@ -117,10 +117,11 @@ pub use hyperswitch_interfaces::{IncrementalAuthorizationType, MandateRevokeType, PaymentsAuthorizeType,PaymentsBalanceType, PaymentsCaptureType, PaymentsCompleteAuthorizeType, PaymentsInitType,PaymentsPostCaptureVoidType, PaymentsPostProcessingType, PaymentsPostSessionTokensType,- PaymentsPreAuthorizeType, PaymentsPreProcessingType, PaymentsSessionType, PaymentsSyncType,- PaymentsUpdateMetadataType, PaymentsVoidType, RefreshTokenType, RefundExecuteType,- RefundSyncType, Response, RetrieveFileType, SdkSessionUpdateType, SetupMandateType,- SubmitEvidenceType, TokenizationType, UploadFileType, VerifyWebhookSourceType,+ PaymentsPreAuthorizeType, PaymentsPreProcessingType, PaymentsPushNotificationType,+ PaymentsSessionType, PaymentsSyncType, PaymentsUpdateMetadataType, PaymentsVoidType,+ RefreshTokenType, RefundExecuteType, RefundSyncType, Response, RetrieveFileType,+ SdkSessionUpdateType, SetupMandateType, SubmitEvidenceType, TokenizationType,+ UploadFileType, VerifyWebhookSourceType,},};@@ -140,6 +141,10 @@ pub type ExternalVaultProxyPaymentsRouterData =RouterData<ExternalVaultProxy, ExternalVaultProxyPaymentsData, PaymentsResponseData>;pub type PaymentsPreProcessingRouterData =RouterData<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;+pub type PaymentsPushNotificationRouterData =+ RouterData<PushNotification, PushNotificationRequestData, PaymentsResponseData>;+pub type PaymentsGenerateQrRouterData =+ RouterData<GenerateQr, GenerateQrRequestData, PaymentsResponseData>;pub type PaymentsPostProcessingRouterData =RouterData<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>;pub type PaymentsAuthorizeSessionTokenRouterData =diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rsindex e10ab33230..156bccd6cc 100644--- a/crates/router/src/types/api/payments.rs+++ b/crates/router/src/types/api/payments.rs@@ -38,19 +38,19 @@ pub use common_types::payments::{AcceptanceType, CustomerAcceptance, OnlineMandause error_stack::ResultExt;pub use hyperswitch_domain_models::router_flow_types::payments::{Approve, Authorize, AuthorizeSessionToken, Balance, CalculateTax, Capture, CompleteAuthorize,- CreateConnectorCustomer, CreateOrder, ExtendAuthorization, ExternalVaultProxy,+ CreateConnectorCustomer, CreateOrder, ExtendAuthorization, ExternalVaultProxy, GenerateQr,IncrementalAuthorization, InitPayment, PSync, PaymentCreateIntent, PaymentGetIntent,PaymentMethodToken, PaymentUpdateIntent, PostCaptureVoid, PostProcessing, PostSessionTokens,- PreProcessing, RecordAttempt, Reject, SdkSessionUpdate, Session, SetupMandate, UpdateMetadata,- Void,+ PreProcessing, PushNotification, RecordAttempt, Reject, SdkSessionUpdate, Session,+ SetupMandate, UpdateMetadata, Void,};pub use hyperswitch_interfaces::api::payments::{ConnectorCustomer, MandateSetup, Payment, PaymentApprove, PaymentAuthorize,PaymentAuthorizeSessionToken, PaymentCapture, PaymentIncrementalAuthorization,PaymentPostCaptureVoid, PaymentPostSessionTokens, PaymentReject, PaymentSession,PaymentSessionUpdate, PaymentSync, PaymentToken, PaymentUpdateMetadata, PaymentVoid,- PaymentsCompleteAuthorize, PaymentsCreateOrder, PaymentsPostProcessing, PaymentsPreProcessing,- TaxCalculation,+ PaymentsCompleteAuthorize, PaymentsCreateOrder, PaymentsGenerateQr, PaymentsPostProcessing,+ PaymentsPreProcessing, PaymentsPushNotification, TaxCalculation,};pub use super::payments_v2::{@@ -59,7 +59,8 @@ pub use super::payments_v2::{PaymentIncrementalAuthorizationV2, PaymentPostCaptureVoidV2, PaymentPostSessionTokensV2,PaymentRejectV2, PaymentSessionUpdateV2, PaymentSessionV2, PaymentSyncV2, PaymentTokenV2,PaymentUpdateMetadataV2, PaymentV2, PaymentVoidV2, PaymentsCompleteAuthorizeV2,- PaymentsPostProcessingV2, PaymentsPreProcessingV2, TaxCalculationV2,+ PaymentsGenerateQrV2, PaymentsPostProcessingV2, PaymentsPreProcessingV2,+ PaymentsPushNotificationV2, TaxCalculationV2,};use crate::core::errors;diff --git a/crates/router/src/types/api/payments_v2.rs b/crates/router/src/types/api/payments_v2.rsindex db5fc39fcc..6fd312ea0c 100644--- a/crates/router/src/types/api/payments_v2.rs+++ b/crates/router/src/types/api/payments_v2.rs@@ -4,5 +4,6 @@ pub use hyperswitch_interfaces::api::payments_v2::{PaymentIncrementalAuthorizationV2, PaymentPostCaptureVoidV2, PaymentPostSessionTokensV2,PaymentRejectV2, PaymentSessionUpdateV2, PaymentSessionV2, PaymentSyncV2, PaymentTokenV2,PaymentUpdateMetadataV2, PaymentV2, PaymentVoidV2, PaymentsCompleteAuthorizeV2,- PaymentsPostProcessingV2, PaymentsPreProcessingV2, TaxCalculationV2,+ PaymentsGenerateQrV2, PaymentsPostProcessingV2, PaymentsPreProcessingV2,+ PaymentsPushNotificationV2, TaxCalculationV2,};