mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 20:23:43 +08:00
feat(connector): revert [paypal, trustpay] add in feature matrix (#8042)
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
pub mod transformers;
|
||||
|
||||
use std::{fmt::Write, sync::LazyLock};
|
||||
use std::fmt::Write;
|
||||
|
||||
use base64::Engine;
|
||||
use common_enums::{enums, CallConnectorAction, PaymentAction};
|
||||
@ -32,8 +31,7 @@ use hyperswitch_domain_models::{
|
||||
SetupMandateRequestData, VerifyWebhookSourceRequestData,
|
||||
},
|
||||
router_response_types::{
|
||||
ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
|
||||
SupportedPaymentMethods, SupportedPaymentMethodsExt, VerifyWebhookSourceResponseData,
|
||||
PaymentsResponseData, RefundsResponseData, VerifyWebhookSourceResponseData,
|
||||
},
|
||||
types::{
|
||||
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
|
||||
@ -363,6 +361,22 @@ impl ConnectorCommon for Paypal {
|
||||
}
|
||||
|
||||
impl ConnectorValidation for Paypal {
|
||||
fn validate_connector_against_payment_request(
|
||||
&self,
|
||||
capture_method: Option<enums::CaptureMethod>,
|
||||
_payment_method: enums::PaymentMethod,
|
||||
_pmt: Option<enums::PaymentMethodType>,
|
||||
) -> CustomResult<(), errors::ConnectorError> {
|
||||
let capture_method = capture_method.unwrap_or_default();
|
||||
match capture_method {
|
||||
enums::CaptureMethod::Automatic
|
||||
| enums::CaptureMethod::Manual
|
||||
| enums::CaptureMethod::SequentialAutomatic => Ok(()),
|
||||
enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
|
||||
connector_utils::construct_not_implemented_error_report(capture_method, self.id()),
|
||||
),
|
||||
}
|
||||
}
|
||||
fn validate_mandate_payment(
|
||||
&self,
|
||||
pm_type: Option<enums::PaymentMethodType>,
|
||||
@ -2160,140 +2174,4 @@ impl ConnectorErrorTypeMapping for Paypal {
|
||||
}
|
||||
}
|
||||
|
||||
static PAYPAL_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
|
||||
let supported_capture_methods = vec![
|
||||
enums::CaptureMethod::Automatic,
|
||||
enums::CaptureMethod::Manual,
|
||||
enums::CaptureMethod::SequentialAutomatic,
|
||||
];
|
||||
|
||||
let mut paypal_supported_payment_methods = SupportedPaymentMethods::new();
|
||||
let supported_card_network = vec![
|
||||
common_enums::CardNetwork::Visa,
|
||||
common_enums::CardNetwork::Mastercard,
|
||||
common_enums::CardNetwork::AmericanExpress,
|
||||
common_enums::CardNetwork::DinersClub,
|
||||
common_enums::CardNetwork::Discover,
|
||||
common_enums::CardNetwork::Interac,
|
||||
common_enums::CardNetwork::JCB,
|
||||
common_enums::CardNetwork::CartesBancaires,
|
||||
];
|
||||
|
||||
paypal_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(),
|
||||
}
|
||||
}),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
paypal_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(),
|
||||
}
|
||||
}),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
paypal_supported_payment_methods.add(
|
||||
enums::PaymentMethod::Wallet,
|
||||
enums::PaymentMethodType::Paypal,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::Supported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
|
||||
paypal_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Eps,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
paypal_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Giropay,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
paypal_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Ideal,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
paypal_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Sofort,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
|
||||
paypal_supported_payment_methods
|
||||
});
|
||||
|
||||
static PAYPAL_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
|
||||
display_name: "Paypal",
|
||||
description: "PayPal is a Slovakia-based company specializing in secure e-commerce payments, particularly within the EEA area.",
|
||||
connector_type: enums::PaymentConnectorCategory::PaymentGateway,
|
||||
};
|
||||
|
||||
static PAYPAL_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [
|
||||
enums::EventClass::Payments,
|
||||
enums::EventClass::Refunds,
|
||||
enums::EventClass::Disputes,
|
||||
];
|
||||
|
||||
impl ConnectorSpecifications for Paypal {
|
||||
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
|
||||
Some(&PAYPAL_CONNECTOR_INFO)
|
||||
}
|
||||
|
||||
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
|
||||
Some(&*PAYPAL_SUPPORTED_PAYMENT_METHODS)
|
||||
}
|
||||
|
||||
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
|
||||
Some(&PAYPAL_SUPPORTED_WEBHOOK_FLOWS)
|
||||
}
|
||||
}
|
||||
impl ConnectorSpecifications for Paypal {}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
pub mod transformers;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use base64::Engine;
|
||||
use common_enums::{enums, PaymentAction};
|
||||
use common_utils::{
|
||||
@ -25,10 +23,7 @@ use hyperswitch_domain_models::{
|
||||
PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData,
|
||||
PaymentsSyncData, RefundsData, SetupMandateRequestData,
|
||||
},
|
||||
router_response_types::{
|
||||
ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
|
||||
SupportedPaymentMethods, SupportedPaymentMethodsExt,
|
||||
},
|
||||
router_response_types::{PaymentsResponseData, RefundsResponseData},
|
||||
types::{
|
||||
PaymentsAuthorizeRouterData, PaymentsPreProcessingRouterData, PaymentsSyncRouterData,
|
||||
RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData,
|
||||
@ -1060,158 +1055,4 @@ impl utils::ConnectorErrorTypeMapping for Trustpay {
|
||||
}
|
||||
}
|
||||
|
||||
static TRUSTPAY_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
|
||||
LazyLock::new(|| {
|
||||
let supported_capture_methods = Vec::new();
|
||||
|
||||
let mut trustpay_supported_payment_methods = SupportedPaymentMethods::new();
|
||||
let supported_card_network = vec![
|
||||
common_enums::CardNetwork::Visa,
|
||||
common_enums::CardNetwork::Mastercard,
|
||||
common_enums::CardNetwork::AmericanExpress,
|
||||
common_enums::CardNetwork::DinersClub,
|
||||
common_enums::CardNetwork::Discover,
|
||||
common_enums::CardNetwork::Interac,
|
||||
common_enums::CardNetwork::JCB,
|
||||
common_enums::CardNetwork::CartesBancaires,
|
||||
common_enums::CardNetwork::UnionPay,
|
||||
];
|
||||
|
||||
trustpay_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::NotSupported,
|
||||
no_three_ds: common_enums::FeatureStatus::Supported,
|
||||
supported_card_networks: supported_card_network.clone(),
|
||||
}
|
||||
}),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
trustpay_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::NotSupported,
|
||||
no_three_ds: common_enums::FeatureStatus::Supported,
|
||||
supported_card_networks: supported_card_network.clone(),
|
||||
}
|
||||
}),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Giropay,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Eps,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Ideal,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Sofort,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankRedirect,
|
||||
enums::PaymentMethodType::Blik,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankTransfer,
|
||||
enums::PaymentMethodType::SepaBankTransfer,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
trustpay_supported_payment_methods.add(
|
||||
enums::PaymentMethod::BankTransfer,
|
||||
enums::PaymentMethodType::InstantBankTransfer,
|
||||
PaymentMethodDetails {
|
||||
mandates: enums::FeatureStatus::NotSupported,
|
||||
refunds: enums::FeatureStatus::Supported,
|
||||
supported_capture_methods: supported_capture_methods.clone(),
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
trustpay_supported_payment_methods
|
||||
});
|
||||
|
||||
static TRUSTPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
|
||||
display_name: "Trustpay",
|
||||
description: "TrustPay is a Slovakia-based company specializing in secure e-commerce payments, particularly within the EEA area.",
|
||||
connector_type: enums::PaymentConnectorCategory::PaymentGateway,
|
||||
};
|
||||
|
||||
static TRUSTPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [
|
||||
enums::EventClass::Payments,
|
||||
enums::EventClass::Refunds,
|
||||
enums::EventClass::Disputes,
|
||||
];
|
||||
|
||||
impl ConnectorSpecifications for Trustpay {
|
||||
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
|
||||
Some(&TRUSTPAY_CONNECTOR_INFO)
|
||||
}
|
||||
|
||||
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
|
||||
Some(&*TRUSTPAY_SUPPORTED_PAYMENT_METHODS)
|
||||
}
|
||||
|
||||
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
|
||||
Some(&TRUSTPAY_SUPPORTED_WEBHOOK_FLOWS)
|
||||
}
|
||||
}
|
||||
impl ConnectorSpecifications for Trustpay {}
|
||||
|
||||
Reference in New Issue
Block a user