Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): [JPMORGAN, PAYU, DIGITALVIRGO, BITPAY, HELCIM, PAYBOX] Replaced lazystatic macros with LazyLock (#7524)
Sayak Bhattacharyafcbd863bc79b
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rsindex 992196c61d..11faa641f3 100644--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs@@ -1,4 +1,6 @@pub mod transformers;+use std::sync::LazyLock;+use api_models::webhooks::IncomingWebhookEvent;use common_enums::enums;use common_utils::{@@ -40,7 +42,6 @@ use hyperswitch_interfaces::{types::{PaymentsAuthorizeType, PaymentsSyncType, Response},webhooks,};-use lazy_static::lazy_static;use masking::{Mask, PeekInterface};use transformers as bitpay;@@ -421,42 +422,37 @@ impl webhooks::IncomingWebhook for Bitpay {Ok(Box::new(notif))}}--lazy_static! {- static ref BITPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {- let supported_capture_methods = vec![- enums::CaptureMethod::Automatic,- ];-- let mut bitpay_supported_payment_methods = SupportedPaymentMethods::new();-- bitpay_supported_payment_methods.add(- enums::PaymentMethod::Crypto,- enums::PaymentMethodType::CryptoCurrency,- PaymentMethodDetails{- mandates: enums::FeatureStatus::NotSupported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: None,- }- );-- bitpay_supported_payment_methods- };-- static ref BITPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+static BITPAY_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {+ let supported_capture_methods = vec![enums::CaptureMethod::Automatic];++ let mut bitpay_supported_payment_methods = SupportedPaymentMethods::new();++ bitpay_supported_payment_methods.add(+ enums::PaymentMethod::Crypto,+ enums::PaymentMethodType::CryptoCurrency,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods,+ specific_features: None,+ },+ );++ bitpay_supported_payment_methods+});++static BITPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {display_name: "Bitpay",description:"BitPay is a cryptocurrency payment processor that enables businesses to accept Bitcoin and other digital currencies ",connector_type: enums::PaymentConnectorCategory::AlternativePaymentMethod,};- static ref BITPAY_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = vec![enums::EventClass::Payments];-}+static BITPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];impl ConnectorSpecifications for Bitpay {fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {- Some(&*BITPAY_CONNECTOR_INFO)+ Some(&BITPAY_CONNECTOR_INFO)}fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {@@ -464,6 +460,6 @@ impl ConnectorSpecifications for Bitpay {}fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {- Some(&*BITPAY_SUPPORTED_WEBHOOK_FLOWS)+ Some(&BITPAY_SUPPORTED_WEBHOOK_FLOWS)}}diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rsindex 55294d6a58..59f02a5e83 100644--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs@@ -1,4 +1,6 @@pub mod transformers;+use std::sync::LazyLock;+use base64::Engine;use common_enums::enums;use common_utils::{@@ -45,7 +47,6 @@ use hyperswitch_interfaces::{types::{self, Response},webhooks,};-use lazy_static::lazy_static;use masking::{Mask, PeekInterface};use transformers as digitalvirgo;@@ -526,9 +527,8 @@ impl webhooks::IncomingWebhook for Digitalvirgo {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}--lazy_static! {- static ref DIGITALVIRGO_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {+static DIGITALVIRGO_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =+ LazyLock::new(|| {let supported_capture_methods = vec![enums::CaptureMethod::Automatic,enums::CaptureMethod::SequentialAutomatic,@@ -539,31 +539,29 @@ lazy_static! {digitalvirgo_supported_payment_methods.add(enums::PaymentMethod::MobilePayment,enums::PaymentMethodType::DirectCarrierBilling,- PaymentMethodDetails{+ PaymentMethodDetails {mandates: enums::FeatureStatus::NotSupported,refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),+ supported_capture_methods,specific_features: None,- }+ },);digitalvirgo_supported_payment_methods- };+ });- static ref DIGITALVIRGO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+static DIGITALVIRGO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {display_name: "Digital Virgo",description:"Digital Virgo is an alternative payment provider specializing in carrier billing and mobile payments ",connector_type: enums::PaymentConnectorCategory::AlternativePaymentMethod,};- static ref DIGITALVIRGO_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();--}+static DIGITALVIRGO_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];impl ConnectorSpecifications for Digitalvirgo {fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {- Some(&*DIGITALVIRGO_CONNECTOR_INFO)+ Some(&DIGITALVIRGO_CONNECTOR_INFO)}fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {@@ -571,6 +569,6 @@ impl ConnectorSpecifications for Digitalvirgo {}fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {- Some(&*DIGITALVIRGO_SUPPORTED_WEBHOOK_FLOWS)+ Some(&DIGITALVIRGO_SUPPORTED_WEBHOOK_FLOWS)}}diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rsindex f625b09f68..ed7a40ccfb 100644--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs+++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs@@ -1,4 +1,5 @@pub mod transformers;+use std::sync::LazyLock;use api_models::webhooks::IncomingWebhookEvent;use common_enums::enums;@@ -44,7 +45,6 @@ use hyperswitch_interfaces::{types::{self, Response},webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},};-use lazy_static::lazy_static;#[cfg(feature = "v2")]use masking::PeekInterface;use masking::{ExposeInterface, Mask};@@ -834,83 +834,80 @@ impl IncomingWebhook for Helcim {}}-lazy_static! {- static ref HELCIM_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {- let supported_capture_methods = vec![- enums::CaptureMethod::Automatic,- enums::CaptureMethod::Manual,- enums::CaptureMethod::SequentialAutomatic,- ];-- let supported_card_network = vec![- common_enums::CardNetwork::Visa,- common_enums::CardNetwork::Mastercard,- common_enums::CardNetwork::Interac,- common_enums::CardNetwork::AmericanExpress,- common_enums::CardNetwork::JCB,- common_enums::CardNetwork::DinersClub,- common_enums::CardNetwork::Discover,- common_enums::CardNetwork::CartesBancaires,- common_enums::CardNetwork::UnionPay,- ];-- let mut helcim_supported_payment_methods = SupportedPaymentMethods::new();-- helcim_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Credit,- PaymentMethodDetails{- mandates: enums::FeatureStatus::Supported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: Some(- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({- api_models::feature_matrix::CardSpecificFeatures {- three_ds: common_enums::FeatureStatus::NotSupported,- no_three_ds: common_enums::FeatureStatus::Supported,- supported_card_networks: supported_card_network.clone(),- }- }),- ),- }- );-- helcim_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Debit,- PaymentMethodDetails{- mandates: enums::FeatureStatus::Supported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: Some(- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({- api_models::feature_matrix::CardSpecificFeatures {- three_ds: common_enums::FeatureStatus::NotSupported,- no_three_ds: common_enums::FeatureStatus::Supported,- supported_card_networks: supported_card_network.clone(),- }- }),- ),- }- );-- helcim_supported_payment_methods- };+static HELCIM_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {+ let supported_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ enums::CaptureMethod::SequentialAutomatic,+ ];++ let supported_card_network = vec![+ common_enums::CardNetwork::Visa,+ common_enums::CardNetwork::Mastercard,+ common_enums::CardNetwork::Interac,+ common_enums::CardNetwork::AmericanExpress,+ common_enums::CardNetwork::JCB,+ common_enums::CardNetwork::DinersClub,+ common_enums::CardNetwork::Discover,+ common_enums::CardNetwork::CartesBancaires,+ common_enums::CardNetwork::UnionPay,+ ];++ let mut helcim_supported_payment_methods = SupportedPaymentMethods::new();++ helcim_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Credit,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::Supported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::NotSupported,+ no_three_ds: common_enums::FeatureStatus::Supported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),+ },+ );++ helcim_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Debit,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::Supported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::NotSupported,+ no_three_ds: common_enums::FeatureStatus::Supported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),+ },+ );- static ref HELCIM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+ helcim_supported_payment_methods+});++static HELCIM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {display_name: "Helcim",description:"Helcim is a payment processing company that offers transparent, affordable merchant services for businesses of all sizes",connector_type: enums::PaymentConnectorCategory::PaymentGateway,};- static ref HELCIM_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();--}+static HELCIM_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];impl ConnectorSpecifications for Helcim {fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {- Some(&*HELCIM_CONNECTOR_INFO)+ Some(&HELCIM_CONNECTOR_INFO)}fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {@@ -918,7 +915,7 @@ impl ConnectorSpecifications for Helcim {}fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {- Some(&*HELCIM_SUPPORTED_WEBHOOK_FLOWS)+ Some(&HELCIM_SUPPORTED_WEBHOOK_FLOWS)}}diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rsindex 68529f725a..ddefb30419 100644--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs@@ -1,4 +1,6 @@pub mod transformers;+use std::sync::LazyLock;+use base64::Engine;use common_enums::enums;use common_utils::{@@ -40,7 +42,6 @@ use hyperswitch_interfaces::{types::{self, RefreshTokenType, Response},webhooks,};-use lazy_static::lazy_static;use masking::{Mask, Maskable, PeekInterface};use transformers::{self as jpmorgan, JpmorganErrorResponse};@@ -811,9 +812,8 @@ impl webhooks::IncomingWebhook for Jpmorgan {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}--lazy_static! {- static ref JPMORGAN_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {+static JPMORGAN_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =+ LazyLock::new(|| {let supported_capture_methods = vec![enums::CaptureMethod::Automatic,enums::CaptureMethod::Manual,@@ -834,7 +834,7 @@ lazy_static! {jpmorgan_supported_payment_methods.add(enums::PaymentMethod::Card,enums::PaymentMethodType::Debit,- PaymentMethodDetails{+ PaymentMethodDetails {mandates: enums::FeatureStatus::NotSupported,refunds: enums::FeatureStatus::NotSupported,supported_capture_methods: supported_capture_methods.clone(),@@ -847,14 +847,13 @@ lazy_static! {}}),),-},);jpmorgan_supported_payment_methods.add(enums::PaymentMethod::Card,enums::PaymentMethodType::Credit,- PaymentMethodDetails{+ PaymentMethodDetails {mandates: enums::FeatureStatus::NotSupported,refunds: enums::FeatureStatus::NotSupported,supported_capture_methods: supported_capture_methods.clone(),@@ -867,27 +866,24 @@ lazy_static! {}}),),-},);jpmorgan_supported_payment_methods- };+ });- static ref JPMORGAN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+static JPMORGAN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {display_name: "Jpmorgan",description:"J.P. Morgan is a global financial services firm and investment bank, offering banking, asset management, and payment processing solutions",connector_type: enums::PaymentConnectorCategory::BankAcquirer,};- static ref JPMORGAN_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();--}+static JPMORGAN_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];impl ConnectorSpecifications for Jpmorgan {fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {- Some(&*JPMORGAN_CONNECTOR_INFO)+ Some(&JPMORGAN_CONNECTOR_INFO)}fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {@@ -895,6 +891,6 @@ impl ConnectorSpecifications for Jpmorgan {}fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {- Some(&*JPMORGAN_SUPPORTED_WEBHOOK_FLOWS)+ Some(&JPMORGAN_SUPPORTED_WEBHOOK_FLOWS)}}diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rsindex 0c8577a29d..58c07ca73e 100644--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs+++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs@@ -1,4 +1,6 @@pub mod transformers;+use std::sync::LazyLock;+use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId};use common_enums::{enums, CallConnectorAction, PaymentAction};use common_utils::{@@ -43,7 +45,6 @@ use hyperswitch_interfaces::{types::{self, Response},webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},};-use lazy_static::lazy_static;use masking::{ExposeInterface, Mask};use transformers as paybox;@@ -691,84 +692,80 @@ impl ConnectorRedirectResponse for Paybox {}}}--lazy_static! {- static ref PAYBOX_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {- let supported_capture_methods = vec![- enums::CaptureMethod::Automatic,- enums::CaptureMethod::Manual,- enums::CaptureMethod::SequentialAutomatic,- ];-- let supported_card_network = vec![- common_enums::CardNetwork::Visa,- common_enums::CardNetwork::Mastercard,- common_enums::CardNetwork::Interac,- common_enums::CardNetwork::AmericanExpress,- common_enums::CardNetwork::JCB,- common_enums::CardNetwork::DinersClub,- common_enums::CardNetwork::Discover,- common_enums::CardNetwork::CartesBancaires,- common_enums::CardNetwork::UnionPay,- ];-- let mut paybox_supported_payment_methods = SupportedPaymentMethods::new();-- paybox_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Debit,- PaymentMethodDetails{- mandates: enums::FeatureStatus::Supported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: Some(- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({- api_models::feature_matrix::CardSpecificFeatures {- three_ds: common_enums::FeatureStatus::Supported,- no_three_ds: common_enums::FeatureStatus::Supported,- supported_card_networks: supported_card_network.clone(),- }- }),- ),- }- );-- paybox_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Credit,- PaymentMethodDetails{- mandates: enums::FeatureStatus::Supported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: Some(- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({- api_models::feature_matrix::CardSpecificFeatures {- three_ds: common_enums::FeatureStatus::Supported,- no_three_ds: common_enums::FeatureStatus::Supported,- supported_card_networks: supported_card_network.clone(),- }- }),- ),- }- );-- paybox_supported_payment_methods- };-- static ref PAYBOX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+static PAYBOX_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {+ let supported_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ enums::CaptureMethod::SequentialAutomatic,+ ];++ let supported_card_network = vec![+ common_enums::CardNetwork::Visa,+ common_enums::CardNetwork::Mastercard,+ common_enums::CardNetwork::Interac,+ common_enums::CardNetwork::AmericanExpress,+ common_enums::CardNetwork::JCB,+ common_enums::CardNetwork::DinersClub,+ common_enums::CardNetwork::Discover,+ common_enums::CardNetwork::CartesBancaires,+ common_enums::CardNetwork::UnionPay,+ ];++ let mut paybox_supported_payment_methods = SupportedPaymentMethods::new();++ paybox_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Debit,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::Supported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::Supported,+ no_three_ds: common_enums::FeatureStatus::Supported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),+ },+ );++ paybox_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Credit,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::Supported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::Supported,+ no_three_ds: common_enums::FeatureStatus::Supported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),+ },+ );++ paybox_supported_payment_methods+});++static PAYBOX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {display_name: "Paybox",description:"Paybox is a payment gateway that enables businesses to process online transactions securely ",connector_type: enums::PaymentConnectorCategory::PaymentGateway,};- static ref PAYBOX_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();--}+static PAYBOX_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];impl ConnectorSpecifications for Paybox {fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {- Some(&*PAYBOX_CONNECTOR_INFO)+ Some(&PAYBOX_CONNECTOR_INFO)}fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {@@ -776,6 +773,6 @@ impl ConnectorSpecifications for Paybox {}fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {- Some(&*PAYBOX_SUPPORTED_WEBHOOK_FLOWS)+ Some(&PAYBOX_SUPPORTED_WEBHOOK_FLOWS)}}diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rsindex 6d09c85d91..d3435a9feb 100644--- a/crates/hyperswitch_connectors/src/connectors/payu.rs+++ b/crates/hyperswitch_connectors/src/connectors/payu.rs@@ -1,4 +1,6 @@pub mod transformers;+use std::sync::LazyLock;+use api_models::webhooks::IncomingWebhookEvent;use common_enums::enums;use common_utils::{@@ -43,7 +45,6 @@ use hyperswitch_interfaces::{},webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},};-use lazy_static::lazy_static;use masking::{Mask, PeekInterface};use transformers as payu;@@ -790,105 +791,102 @@ impl IncomingWebhook for Payu {}}-lazy_static! {- static ref PAYU_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {- let supported_capture_methods = vec![- enums::CaptureMethod::Automatic,- enums::CaptureMethod::Manual,- enums::CaptureMethod::SequentialAutomatic,- ];-- let supported_card_network = vec![- common_enums::CardNetwork::Visa,- common_enums::CardNetwork::Mastercard,- common_enums::CardNetwork::Interac,- common_enums::CardNetwork::AmericanExpress,- common_enums::CardNetwork::JCB,- common_enums::CardNetwork::DinersClub,- common_enums::CardNetwork::Discover,- common_enums::CardNetwork::CartesBancaires,- common_enums::CardNetwork::UnionPay,- ];-- let mut payu_supported_payment_methods = SupportedPaymentMethods::new();-- payu_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Credit,- PaymentMethodDetails{- mandates: enums::FeatureStatus::NotSupported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: Some(- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({- api_models::feature_matrix::CardSpecificFeatures {- three_ds: common_enums::FeatureStatus::Supported,- no_three_ds: common_enums::FeatureStatus::NotSupported,- supported_card_networks: supported_card_network.clone(),- }- }),- ),- }- );-- payu_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Debit,- PaymentMethodDetails{- mandates: enums::FeatureStatus::NotSupported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: Some(- api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({- api_models::feature_matrix::CardSpecificFeatures {- three_ds: common_enums::FeatureStatus::Supported,- no_three_ds: common_enums::FeatureStatus::NotSupported,- supported_card_networks: supported_card_network.clone(),- }- }),- ),- }- );-- payu_supported_payment_methods.add(- enums::PaymentMethod::Wallet,- enums::PaymentMethodType::GooglePay,- PaymentMethodDetails{- mandates: enums::FeatureStatus::NotSupported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: None,- }- );-- payu_supported_payment_methods.add(- enums::PaymentMethod::Wallet,- enums::PaymentMethodType::ApplePay,- PaymentMethodDetails{- mandates: enums::FeatureStatus::NotSupported,- refunds: enums::FeatureStatus::Supported,- supported_capture_methods: supported_capture_methods.clone(),- specific_features: None,- }- );-- payu_supported_payment_methods- };-- static ref PAYU_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+static PAYU_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {+ let supported_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ enums::CaptureMethod::SequentialAutomatic,+ ];++ let supported_card_network = vec![+ common_enums::CardNetwork::Visa,+ common_enums::CardNetwork::Mastercard,+ common_enums::CardNetwork::Interac,+ common_enums::CardNetwork::AmericanExpress,+ common_enums::CardNetwork::JCB,+ common_enums::CardNetwork::DinersClub,+ common_enums::CardNetwork::Discover,+ common_enums::CardNetwork::CartesBancaires,+ common_enums::CardNetwork::UnionPay,+ ];++ let mut payu_supported_payment_methods = SupportedPaymentMethods::new();++ payu_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Credit,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::Supported,+ no_three_ds: common_enums::FeatureStatus::NotSupported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),+ },+ );++ payu_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Debit,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::Supported,+ no_three_ds: common_enums::FeatureStatus::NotSupported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),+ },+ );++ payu_supported_payment_methods.add(+ enums::PaymentMethod::Wallet,+ enums::PaymentMethodType::GooglePay,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: None,+ },+ );++ payu_supported_payment_methods.add(+ enums::PaymentMethod::Wallet,+ enums::PaymentMethodType::ApplePay,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: None,+ },+ );++ payu_supported_payment_methods+});++static PAYU_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {display_name: "Payu",description:"PayU is a global fintech company providing online payment solutions, including card processing, UPI, wallets, and BNPL services across multiple markets ",connector_type: enums::PaymentConnectorCategory::PaymentGateway,};- static ref PAYU_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();--}+static PAYU_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];impl ConnectorSpecifications for Payu {fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {- Some(&*PAYU_CONNECTOR_INFO)+ Some(&PAYU_CONNECTOR_INFO)}fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {@@ -896,6 +894,6 @@ impl ConnectorSpecifications for Payu {}fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {- Some(&*PAYU_SUPPORTED_WEBHOOK_FLOWS)+ Some(&PAYU_SUPPORTED_WEBHOOK_FLOWS)}}