refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)

Co-authored-by: Nishanth Challa <nishanth.challa@Nishanth-Challa-C0WGKCFHLF.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
CHALLA NISHANTH BABU
2025-07-22 00:38:33 +05:30
committed by GitHub
parent db14764671
commit 110beaff9a
21 changed files with 1365 additions and 36 deletions

View File

@ -13,34 +13,35 @@ pub use hyperswitch_connectors::connectors::{
boku::Boku, braintree, braintree::Braintree, cashtocode, cashtocode::Cashtocode, celero,
celero::Celero, chargebee, chargebee::Chargebee, checkbook, checkbook::Checkbook, checkout,
checkout::Checkout, coinbase, coinbase::Coinbase, coingate, coingate::Coingate, cryptopay,
cryptopay::Cryptopay, ctp_mastercard, ctp_mastercard::CtpMastercard, cybersource,
cybersource::Cybersource, datatrans, datatrans::Datatrans, deutschebank,
deutschebank::Deutschebank, digitalvirgo, digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal,
dwolla, dwolla::Dwolla, ebanx, ebanx::Ebanx, elavon, elavon::Elavon, facilitapay,
facilitapay::Facilitapay, fiserv, fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu,
fiuu::Fiuu, forte, forte::Forte, getnet, getnet::Getnet, globalpay, globalpay::Globalpay,
globepay, globepay::Globepay, gocardless, gocardless::Gocardless, gpayments,
gpayments::Gpayments, helcim, helcim::Helcim, hipay, hipay::Hipay, hyperswitch_vault,
hyperswitch_vault::HyperswitchVault, iatapay, iatapay::Iatapay, inespay, inespay::Inespay,
itaubank, itaubank::Itaubank, jpmorgan, jpmorgan::Jpmorgan, juspaythreedsserver,
juspaythreedsserver::Juspaythreedsserver, klarna, klarna::Klarna, mifinity, mifinity::Mifinity,
mollie, mollie::Mollie, moneris, moneris::Moneris, multisafepay, multisafepay::Multisafepay,
netcetera, netcetera::Netcetera, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay,
nmi, nmi::Nmi, nomupay, nomupay::Nomupay, noon, noon::Noon, nordea, nordea::Nordea, novalnet,
novalnet::Novalnet, nuvei, nuvei::Nuvei, opayo, opayo::Opayo, opennode, opennode::Opennode,
paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payload, payload::Payload, payme,
payme::Payme, payone, payone::Payone, paypal, paypal::Paypal, paystack, paystack::Paystack,
payu, payu::Payu, placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz,
powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay,
razorpay::Razorpay, recurly, recurly::Recurly, redsys, redsys::Redsys, riskified,
riskified::Riskified, santander, santander::Santander, shift4, shift4::Shift4, signifyd,
signifyd::Signifyd, silverflow, silverflow::Silverflow, square, square::Square, stax,
stax::Stax, stripe, stripe::Stripe, stripebilling, stripebilling::Stripebilling, taxjar,
taxjar::Taxjar, threedsecureio, threedsecureio::Threedsecureio, thunes, thunes::Thunes,
tokenio, tokenio::Tokenio, trustpay, trustpay::Trustpay, tsys, tsys::Tsys,
unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService,
vgs, vgs::Vgs, volt, volt::Volt, wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout,
wellsfargopayout::Wellsfargopayout, wise, wise::Wise, worldline, worldline::Worldline,
worldpay, worldpay::Worldpay, worldpayvantiv, worldpayvantiv::Worldpayvantiv, worldpayxml,
worldpayxml::Worldpayxml, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
cryptopay::Cryptopay, ctp_mastercard, ctp_mastercard::CtpMastercard, custombilling,
custombilling::Custombilling, cybersource, cybersource::Cybersource, datatrans,
datatrans::Datatrans, deutschebank, deutschebank::Deutschebank, digitalvirgo,
digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, dwolla, dwolla::Dwolla, ebanx,
ebanx::Ebanx, elavon, elavon::Elavon, facilitapay, facilitapay::Facilitapay, fiserv,
fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, forte, forte::Forte,
getnet, getnet::Getnet, globalpay, globalpay::Globalpay, globepay, globepay::Globepay,
gocardless, gocardless::Gocardless, gpayments, gpayments::Gpayments, helcim, helcim::Helcim,
hipay, hipay::Hipay, hyperswitch_vault, hyperswitch_vault::HyperswitchVault, iatapay,
iatapay::Iatapay, inespay, inespay::Inespay, itaubank, itaubank::Itaubank, jpmorgan,
jpmorgan::Jpmorgan, juspaythreedsserver, juspaythreedsserver::Juspaythreedsserver, klarna,
klarna::Klarna, mifinity, mifinity::Mifinity, mollie, mollie::Mollie, moneris,
moneris::Moneris, multisafepay, multisafepay::Multisafepay, netcetera, netcetera::Netcetera,
nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, nmi, nmi::Nmi, nomupay,
nomupay::Nomupay, noon, noon::Noon, nordea, nordea::Nordea, novalnet, novalnet::Novalnet,
nuvei, nuvei::Nuvei, opayo, opayo::Opayo, opennode, opennode::Opennode, paybox, paybox::Paybox,
payeezy, payeezy::Payeezy, payload, payload::Payload, payme, payme::Payme, payone,
payone::Payone, paypal, paypal::Paypal, paystack, paystack::Paystack, payu, payu::Payu,
placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz, powertranz::Powertranz,
prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, recurly,
recurly::Recurly, redsys, redsys::Redsys, riskified, riskified::Riskified, santander,
santander::Santander, shift4, shift4::Shift4, signifyd, signifyd::Signifyd, silverflow,
silverflow::Silverflow, square, square::Square, stax, stax::Stax, stripe, stripe::Stripe,
stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, threedsecureio,
threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenio, tokenio::Tokenio, trustpay,
trustpay::Trustpay, tsys, tsys::Tsys, unified_authentication_service,
unified_authentication_service::UnifiedAuthenticationService, vgs, vgs::Vgs, volt, volt::Volt,
wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, wellsfargopayout::Wellsfargopayout, wise,
wise::Wise, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, worldpayvantiv,
worldpayvantiv::Worldpayvantiv, worldpayxml, worldpayxml::Worldpayxml, xendit, xendit::Xendit,
zen, zen::Zen, zsl, zsl::Zsl,
};

View File

@ -171,6 +171,7 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
Ok(())
}
api_enums::Connector::CtpMastercard => Ok(()),
api_enums::Connector::Custombilling => Ok(()),
api_enums::Connector::CtpVisa => Ok(()),
api_enums::Connector::Cybersource => {
cybersource::transformers::CybersourceAuthType::try_from(self.auth_type)?;

View File

@ -5047,6 +5047,12 @@ impl ForeignFrom<&hyperswitch_domain_models::payments::payment_attempt::PaymentA
fn foreign_from(
attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt,
) -> Self {
let payment_method_data: Option<
api_models::payments::PaymentMethodDataResponseWithBilling,
> = attempt
.payment_method_data
.clone()
.and_then(|data| serde_json::from_value(data.expose().clone()).ok());
Self {
id: attempt.get_id().to_owned(),
status: attempt.status,
@ -5078,6 +5084,7 @@ impl ForeignFrom<&hyperswitch_domain_models::payments::payment_attempt::PaymentA
.feature_metadata
.as_ref()
.map(api_models::payments::PaymentAttemptFeatureMetadata::foreign_from),
payment_method_data,
}
}
}

View File

@ -175,6 +175,9 @@ impl ConnectorData {
enums::Connector::CtpMastercard => {
Ok(ConnectorEnum::Old(Box::new(&connector::CtpMastercard)))
}
enums::Connector::Custombilling => Ok(ConnectorEnum::Old(Box::new(
connector::Custombilling::new(),
))),
enums::Connector::CtpVisa => Ok(ConnectorEnum::Old(Box::new(
connector::UnifiedAuthenticationService::new(),
))),

View File

@ -32,6 +32,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Coinbase => Self::Coinbase,
api_enums::Connector::Coingate => Self::Coingate,
api_enums::Connector::Cryptopay => Self::Cryptopay,
api_enums::Connector::Custombilling => Self::Custombilling,
api_enums::Connector::CtpVisa => {
Err(common_utils::errors::ValidationError::InvalidValue {
message: "ctp visa is not a routable connector".to_string(),