Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(connector): [Hyperpg] Implement UCS based default implementation for Hyperpg (#11050)

Swangi Kumarie56cb03671a3
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 8ffef95bc4..a14f5db8b8 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -14829,6 +14829,7 @@
"gpayments",
"hipay",
"helcim",
+ "hyperpg",
"hyperswitch_vault",
"inespay",
"iatapay",
@@ -35579,6 +35580,7 @@
"gocardless",
"hipay",
"helcim",
+ "hyperpg",
"iatapay",
"inespay",
"itaubank",
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index efc77c8adf..b1b4c5e225 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -9230,6 +9230,7 @@
"gpayments",
"hipay",
"helcim",
+ "hyperpg",
"hyperswitch_vault",
"inespay",
"iatapay",
@@ -25758,6 +25759,7 @@
"gocardless",
"hipay",
"helcim",
+ "hyperpg",
"iatapay",
"inespay",
"itaubank",
diff --git a/config/config.example.toml b/config/config.example.toml
index 1b935b652f..bb703f0949 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -253,6 +253,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://stage-secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hyperswitch_vault.base_url = "http://localhost:8080"
hyperwallet.base_url = "https://uat-api.paylution.com"
hipay.secondary_base_url = "https://stage-secure2-vault.hipay-tpp.com/rest/"
@@ -706,6 +707,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.plaid]
open_banking_pis = {currency = "EUR,GBP"}
@@ -1288,7 +1293,7 @@ url = "http://localhost:8080" # Open Router URL
[grpc_client.unified_connector_service]
base_url = "http://localhost:8000" # Unified Connector Service Base URL
connection_timeout = 10 # Connection Timeout Duration in Seconds
-ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "paytm, phonepe, hyperpg" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
[grpc_client.recovery_decider_client] # Revenue recovery client base url
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index d2f7c193da..e2cee8ffdb 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -404,7 +404,7 @@ connector_names = "connector_names" # Comma-separated list of allowed connec
[grpc_client.unified_connector_service]
base_url = "http://localhost:8000" # Unified Connector Service Base URL
connection_timeout = 10 # Connection Timeout Duration in Seconds
-ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "paytm, phonepe, hyperpg" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
[revenue_recovery]
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index cbfbde1efd..f8dc292fb1 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -81,6 +81,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://stage-secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hipay.secondary_base_url = "https://stage-secure2-vault.hipay-tpp.com/rest/"
hipay.third_base_url = "https://stage-api-gateway.hipay.com/"
hyperwallet.base_url = "https://uat-api.paylution.com"
@@ -637,6 +638,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.redsys]
credit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
debit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
@@ -966,7 +971,7 @@ connector_list = "juspaythreedsserver, ctp_mastercard, ctp_visa"
connector_list = "worldpayvantiv"
[grpc_client.unified_connector_service]
-ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "paytm, phonepe, hyperpg" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
# Merchant Advice Code Configuration
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 76754e3e11..9e7cffe811 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -84,6 +84,7 @@ gocardless.base_url = "https://api.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hipay.secondary_base_url = "https://secure2-vault.hipay-tpp.com/rest/"
hipay.third_base_url = "https://api-gateway.hipay.com/"
hyperwallet.base_url = "https://uat-api.paylution.com"
@@ -677,6 +678,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.redsys]
credit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
debit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
@@ -971,7 +976,7 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
connector_list = "juspaythreedsserver, ctp_mastercard, ctp_visa"
[grpc_client.unified_connector_service]
-ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "paytm, phonepe, hyperpg" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
# Merchant Advice Code Configuration
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index c04020e17f..775a7c543f 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -84,6 +84,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://stage-secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hipay.secondary_base_url = "https://stage-secure2-vault.hipay-tpp.com/rest/"
hipay.third_base_url = "https://stage-api-gateway.hipay.com/"
hyperwallet.base_url = "https://uat-api.paylution.com"
@@ -685,6 +686,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.redsys]
credit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
debit = { currency = "AUD,BGN,CAD,CHF,COP,CZK,DKK,EUR,GBP,HRK,HUF,ILS,INR,JPY,MYR,NOK,NZD,PEN,PLN,RUB,SAR,SEK,SGD,THB,USD,ZAR", country="ES" }
@@ -981,7 +986,7 @@ connector_list = "juspaythreedsserver, ctp_mastercard, ctp_visa"
connector_list = "worldpayvantiv"
[grpc_client.unified_connector_service]
-ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "paytm, phonepe, hyperpg" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
# Merchant Advice Code Configuration
diff --git a/config/development.toml b/config/development.toml
index 0cf081e37f..6688e6590b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -283,6 +283,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://stage-secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hyperswitch_vault.base_url = "http://localhost:8080"
hyperwallet.base_url = "https://uat-api.paylution.com"
hipay.secondary_base_url = "https://stage-secure2-vault.hipay-tpp.com/rest/"
@@ -520,6 +521,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.plaid]
open_banking_pis = { currency = "EUR,GBP" }
@@ -1415,7 +1420,7 @@ enabled = "true"
[grpc_client.unified_connector_service]
base_url = "http://localhost:8000"
connection_timeout = 10
-ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "paytm, phonepe, hyperpg" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode" # Comma-separated list of connectors to disable UCS PSync call
[revenue_recovery]
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index d8502d7198..c6f919726d 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -184,6 +184,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://stage-secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hyperswitch_vault.base_url = "http://localhost:8080"
hyperwallet.base_url = "https://uat-api.paylution.com"
hipay.secondary_base_url = "https://stage-secure2-vault.hipay-tpp.com/rest/"
@@ -622,6 +623,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.payu]
debit = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH, BI, BM, BN, BO, BR, BS, BW, BY, BZ, CA, CD, LI, CL, CN, CO, CR, CV, CZ, DJ, DK, DO, DZ, EG, ET, AD, FJ, FK, GG, GE, GH, GI, GM, GN, GT, GY, HK, HN, HR, HT, HU, ID, IL, IQ, IS, JM, JO, JP, KG, KH, KM, KR, KW, KY, KZ, LA, LB, LR, LS, MA, MD, MG, MK, MN, MO, MR, MV, MW, MX, MY, MZ, NA, NG, NI, BV, CK, OM, PA, PE, PG, PL, PY, QA, RO, RS, RW, SA, SB, SC, SE, SG, SH, SO, SR, SV, SZ, TH, TJ, TM, TN, TO, TR, TT, TW, TZ, UG, AS, UY, UZ, VE, VN, VU, WS, CM, AI, BJ, PF, YE, ZA, ZM, ZW", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IQD, ISK, JMD, JOD, JPY, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LRD, LSL, MAD, MDL, MGA, MKD, MNT, MOP, MRU, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NZD, OMR, PAB, PEN, PGK, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SOS, SRD, SVC, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL" }
credit = { country = "AE, AF, AL, AM, CW, AO, AR, AU, AW, AZ, BA, BB, BG, BH, BI, BM, BN, BO, BR, BS, BW, BY, BZ, CA, CD, LI, CL, CN, CO, CR, CV, CZ, DJ, DK, DO, DZ, EG, ET, AD, FJ, FK, GG, GE, GH, GI, GM, GN, GT, GY, HK, HN, HR, HT, HU, ID, IL, IQ, IS, JM, JO, JP, KG, KH, KM, KR, KW, KY, KZ, LA, LB, LR, LS, MA, MD, MG, MK, MN, MO, MR, MV, MW, MX, MY, MZ, NA, NG, NI, BV, CK, OM, PA, PE, PG, PL, PY, QA, RO, RS, RW, SA, SB, SC, SE, SG, SH, SO, SR, SV, SZ, TH, TJ, TM, TN, TO, TR, TT, TW, TZ, UG, AS, UY, UZ, VE, VN, VU, WS, CM, AI, BJ, PF, YE, ZA, ZM, ZW", currency = "AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IQD, ISK, JMD, JOD, JPY, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LRD, LSL, MAD, MDL, MGA, MKD, MNT, MOP, MRU, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NZD, OMR, PAB, PEN, PGK, PLN, PYG, QAR, RON, RSD, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SOS, SRD, SVC, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL" }
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index e1ff6e80e3..166974abfd 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -117,6 +117,7 @@ pub enum Connector {
Gpayments,
Hipay,
Helcim,
+ Hyperpg,
HyperswitchVault,
// Hyperwallet, added as template code for future usage
Inespay,
@@ -332,6 +333,7 @@ impl Connector {
| Self::Gpayments
| Self::Hipay
| Self::Helcim
+ | Self::Hyperpg
| Self::HyperswitchVault
| Self::Iatapay
| Self::Inespay
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 88cdb9f5cb..36e783a671 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -299,6 +299,7 @@ pub struct ConnectorConfig {
pub gocardless: Option<ConnectorTomlConfig>,
pub gpayments: Option<ConnectorTomlConfig>,
pub hipay: Option<ConnectorTomlConfig>,
+ pub hyperpg: Option<ConnectorTomlConfig>,
pub helcim: Option<ConnectorTomlConfig>,
pub hyperswitch_vault: Option<ConnectorTomlConfig>,
pub hyperwallet: Option<ConnectorTomlConfig>,
@@ -547,6 +548,7 @@ impl ConnectorConfig {
Connector::Gpayments => Ok(connector_data.gpayments),
Connector::Hipay => Ok(connector_data.hipay),
Connector::HyperswitchVault => Ok(connector_data.hyperswitch_vault),
+ Connector::Hyperpg => Ok(connector_data.hyperpg),
Connector::Helcim => Ok(connector_data.helcim),
Connector::Inespay => Ok(connector_data.inespay),
Connector::Jpmorgan => Ok(connector_data.jpmorgan),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 453d416077..aba8a1363c 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -7225,6 +7225,47 @@ type="Text"
[calida.connector_webhook_details]
merchant_secret="Source verification key"
+[hyperpg]
+[[hyperpg.credit]]
+payment_method_type = "Mastercard"
+[[hyperpg.credit]]
+payment_method_type = "Visa"
+[[hyperpg.credit]]
+payment_method_type = "Interac"
+[[hyperpg.credit]]
+payment_method_type = "AmericanExpress"
+[[hyperpg.credit]]
+payment_method_type = "JCB"
+[[hyperpg.credit]]
+payment_method_type = "DinersClub"
+[[hyperpg.credit]]
+payment_method_type = "Discover"
+[[hyperpg.credit]]
+payment_method_type = "CartesBancaires"
+[[hyperpg.credit]]
+payment_method_type = "UnionPay"
+[[hyperpg.debit]]
+payment_method_type = "Mastercard"
+[[hyperpg.debit]]
+payment_method_type = "Visa"
+[[hyperpg.debit]]
+payment_method_type = "Interac"
+[[hyperpg.debit]]
+payment_method_type = "AmericanExpress"
+[[hyperpg.debit]]
+payment_method_type = "JCB"
+[[hyperpg.debit]]
+payment_method_type = "DinersClub"
+[[hyperpg.debit]]
+payment_method_type = "Discover"
+[[hyperpg.debit]]
+payment_method_type = "CartesBancaires"
+[[hyperpg.debit]]
+payment_method_type = "UnionPay"
+[hyperpg.connector_auth.BodyKey]
+api_key="Username"
+key1="Password"
+
[katapult]
[katapult.connector_auth.HeaderKey]
api_key = "API Key"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index f43507a7c7..339b1ec70b 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -6060,6 +6060,47 @@ api_key="Signing key"
api_secret="website name"
key1="merchant_id"
+[hyperpg]
+[[hyperpg.credit]]
+payment_method_type = "Mastercard"
+[[hyperpg.credit]]
+payment_method_type = "Visa"
+[[hyperpg.credit]]
+payment_method_type = "Interac"
+[[hyperpg.credit]]
+payment_method_type = "AmericanExpress"
+[[hyperpg.credit]]
+payment_method_type = "JCB"
+[[hyperpg.credit]]
+payment_method_type = "DinersClub"
+[[hyperpg.credit]]
+payment_method_type = "Discover"
+[[hyperpg.credit]]
+payment_method_type = "CartesBancaires"
+[[hyperpg.credit]]
+payment_method_type = "UnionPay"
+[[hyperpg.debit]]
+payment_method_type = "Mastercard"
+[[hyperpg.debit]]
+payment_method_type = "Visa"
+[[hyperpg.debit]]
+payment_method_type = "Interac"
+[[hyperpg.debit]]
+payment_method_type = "AmericanExpress"
+[[hyperpg.debit]]
+payment_method_type = "JCB"
+[[hyperpg.debit]]
+payment_method_type = "DinersClub"
+[[hyperpg.debit]]
+payment_method_type = "Discover"
+[[hyperpg.debit]]
+payment_method_type = "CartesBancaires"
+[[hyperpg.debit]]
+payment_method_type = "UnionPay"
+[hyperpg.connector_auth.BodyKey]
+api_key="Username"
+key1="Password"
+
[mpgs]
[mpgs.connector_auth.HeaderKey]
api_key = "API Key"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index bbad264527..a189add606 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -7186,6 +7186,48 @@ payment_method_type = "upi_intent"
api_key="Signing key"
api_secret="website name"
key1="merchant_id"
+
+[hyperpg]
+[[hyperpg.credit]]
+payment_method_type = "Mastercard"
+[[hyperpg.credit]]
+payment_method_type = "Visa"
+[[hyperpg.credit]]
+payment_method_type = "Interac"
+[[hyperpg.credit]]
+payment_method_type = "AmericanExpress"
+[[hyperpg.credit]]
+payment_method_type = "JCB"
+[[hyperpg.credit]]
+payment_method_type = "DinersClub"
+[[hyperpg.credit]]
+payment_method_type = "Discover"
+[[hyperpg.credit]]
+payment_method_type = "CartesBancaires"
+[[hyperpg.credit]]
+payment_method_type = "UnionPay"
+[[hyperpg.debit]]
+payment_method_type = "Mastercard"
+[[hyperpg.debit]]
+payment_method_type = "Visa"
+[[hyperpg.debit]]
+payment_method_type = "Interac"
+[[hyperpg.debit]]
+payment_method_type = "AmericanExpress"
+[[hyperpg.debit]]
+payment_method_type = "JCB"
+[[hyperpg.debit]]
+payment_method_type = "DinersClub"
+[[hyperpg.debit]]
+payment_method_type = "Discover"
+[[hyperpg.debit]]
+payment_method_type = "CartesBancaires"
+[[hyperpg.debit]]
+payment_method_type = "UnionPay"
+[hyperpg.connector_auth.BodyKey]
+api_key="Username"
+key1="Password"
+
[calida]
[[calida.wallet]]
payment_method_type = "bluecode"
diff --git a/crates/euclid/src/enums.rs b/crates/euclid/src/enums.rs
index 73e781b3cb..ca48a514e1 100644
--- a/crates/euclid/src/enums.rs
+++ b/crates/euclid/src/enums.rs
@@ -276,6 +276,7 @@ pub enum RoutableConnectors {
Gocardless,
Hipay,
Helcim,
+ Hyperpg,
Iatapay,
Inespay,
Itaubank,
@@ -428,6 +429,7 @@ impl TryFrom<Connector> for RoutableConnectors {
Connector::Globepay => Ok(Self::Globepay),
Connector::Gocardless => Ok(Self::Gocardless),
Connector::Helcim => Ok(Self::Helcim),
+ Connector::Hyperpg => Ok(Self::Hyperpg),
Connector::Iatapay => Ok(Self::Iatapay),
Connector::Itaubank => Ok(Self::Itaubank),
Connector::Jpmorgan => Ok(Self::Jpmorgan),
@@ -582,6 +584,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Globepay => Self::Globepay,
RoutableConnectors::Gocardless => Self::Gocardless,
RoutableConnectors::Helcim => Self::Helcim,
+ RoutableConnectors::Hyperpg => Self::Hyperpg,
RoutableConnectors::Iatapay => Self::Iatapay,
RoutableConnectors::Itaubank => Self::Itaubank,
RoutableConnectors::Jpmorgan => Self::Jpmorgan,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 31d0d74531..91b73f382b 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -55,6 +55,7 @@ pub mod gocardless;
pub mod gpayments;
pub mod helcim;
pub mod hipay;
+pub mod hyperpg;
pub mod hyperswitch_vault;
pub mod hyperwallet;
pub mod iatapay;
@@ -153,7 +154,7 @@ pub use self::{
ebanx::Ebanx, elavon::Elavon, envoy::Envoy, facilitapay::Facilitapay, finix::Finix,
fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, flexiti::Flexiti, forte::Forte,
getnet::Getnet, gigadat::Gigadat, globalpay::Globalpay, globepay::Globepay,
- gocardless::Gocardless, gpayments::Gpayments, helcim::Helcim, hipay::Hipay,
+ gocardless::Gocardless, gpayments::Gpayments, helcim::Helcim, hipay::Hipay, hyperpg::Hyperpg,
hyperswitch_vault::HyperswitchVault, hyperwallet::Hyperwallet, iatapay::Iatapay,
inespay::Inespay, itaubank::Itaubank, jpmorgan::Jpmorgan,
juspaythreedsserver::Juspaythreedsserver, katapult::Katapult, klarna::Klarna, loonio::Loonio,
diff --git a/crates/hyperswitch_connectors/src/connectors/hyperpg.rs b/crates/hyperswitch_connectors/src/connectors/hyperpg.rs
new file mode 100644
index 0000000000..7ae3cc9e4e
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/hyperpg.rs
@@ -0,0 +1,675 @@
+pub mod transformers;
+
+use common_enums::enums;
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods, SupportedPaymentMethodsExt,
+ },
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use lazy_static::lazy_static;
+use transformers as hyperpg;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Hyperpg {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Hyperpg {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Hyperpg {}
+impl api::PaymentSession for Hyperpg {}
+impl api::ConnectorAccessToken for Hyperpg {}
+impl api::MandateSetup for Hyperpg {}
+impl api::PaymentAuthorize for Hyperpg {}
+impl api::PaymentSync for Hyperpg {}
+impl api::PaymentCapture for Hyperpg {}
+impl api::PaymentVoid for Hyperpg {}
+impl api::Refund for Hyperpg {}
+impl api::RefundExecute for Hyperpg {}
+impl api::RefundSync for Hyperpg {}
+impl api::PaymentToken for Hyperpg {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Hyperpg
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Hyperpg
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &RouterData<Flow, Request, Response>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Hyperpg {
+ fn id(&self) -> &'static str {
+ "hyperpg"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Base
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.hyperpg.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ _auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ // This method is not implemented for Phonepe, as it will always call the UCS service which has the logic to create headers.
+ Err(errors::ConnectorError::NotImplemented("get_auth_header method".to_string()).into())
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: hyperpg::HyperpgErrorResponse = res
+ .response
+ .parse_struct("HyperpgErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ connector_response_reference_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ connector_metadata: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Hyperpg {
+ fn validate_mandate_payment(
+ &self,
+ _pm_type: Option<enums::PaymentMethodType>,
+ pm_data: PaymentMethodData,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ match pm_data {
+ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
+ "validate_mandate_payment does not support cards".to_string(),
+ )
+ .into()),
+ _ => Ok(()),
+ }
+ }
+
+ fn validate_psync_reference_id(
+ &self,
+ _data: &PaymentsSyncData,
+ _is_three_ds: bool,
+ _status: enums::AttemptStatus,
+ _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ Ok(())
+ }
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Hyperpg {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Hyperpg {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Hyperpg {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Hyperpg {
+ fn get_headers(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::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: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = hyperpg::HyperpgRouterData::from((amount, req));
+ let connector_req = hyperpg::HyperpgPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: hyperpg::HyperpgPaymentsResponse = res
+ .response
+ .parse_struct("Hyperpg PaymentsAuthorizeResponse")
+ .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<PSync, PaymentsSyncData, PaymentsResponseData> for Hyperpg {
+ fn get_headers(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::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: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: hyperpg::HyperpgPaymentsResponse = res
+ .response
+ .parse_struct("hyperpg PaymentsSyncResponse")
+ .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<Capture, PaymentsCaptureData, PaymentsResponseData> for Hyperpg {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::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: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: hyperpg::HyperpgPaymentsResponse = res
+ .response
+ .parse_struct("Hyperpg PaymentsCaptureResponse")
+ .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<Void, PaymentsCancelData, PaymentsResponseData> for Hyperpg {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Hyperpg {
+ fn get_headers(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::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: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = hyperpg::HyperpgRouterData::from((refund_amount, req));
+ let connector_req = hyperpg::HyperpgRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundsRouterData<Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ let response: hyperpg::RefundResponse = res
+ .response
+ .parse_struct("hyperpg RefundResponse")
+ .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<RSync, RefundsData, RefundsResponseData> for Hyperpg {
+ fn get_headers(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::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: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ let response: hyperpg::RefundResponse = res
+ .response
+ .parse_struct("hyperpg RefundSyncResponse")
+ .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)
+ }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Hyperpg {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+lazy_static! {
+ static ref HYPERPG_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
+ let supported_capture_methods = vec![enums::CaptureMethod::Automatic];
+
+ let supported_card_network = vec![
+ common_enums::CardNetwork::Mastercard,
+ common_enums::CardNetwork::Visa,
+ 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,
+ common_enums::CardNetwork::Maestro,
+ ];
+
+ let mut hyperpg_supported_payment_methods = SupportedPaymentMethods::new();
+ hyperpg_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(),
+ }
+ }),
+ ),
+ },
+ );
+
+ hyperpg_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,
+ }
+ }),
+ ),
+ },
+ );
+
+ hyperpg_supported_payment_methods
+ };
+
+ static ref HYPERPG_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Hyperpg",
+ description: "Hyperpg is your trusted payment gateway solution. Seamlessly manage transactions, enhance security, and empower your business to thrive in the digital age.",
+ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
+ integration_status: enums::ConnectorIntegrationStatus::Live,
+ };
+
+ static ref HYPERPG_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
+
+}
+
+impl ConnectorSpecifications for Hyperpg {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&HYPERPG_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*HYPERPG_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&HYPERPG_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/hyperpg/transformers.rs b/crates/hyperswitch_connectors/src/connectors/hyperpg/transformers.rs
new file mode 100644
index 0000000000..677bafade5
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/hyperpg/transformers.rs
@@ -0,0 +1,228 @@
+use common_enums::enums;
+use common_utils::types::StringMinorUnit;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{ConnectorAuthType, RouterData},
+ router_flow_types::refunds::{Execute, RSync},
+ router_request_types::ResponseId,
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::types::{RefundsResponseRouterData, ResponseRouterData};
+
+//TODO: Fill the struct with respective fields
+pub struct HyperpgRouterData<T> {
+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for HyperpgRouterData<T> {
+ fn from((amount, item): (StringMinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct HyperpgPaymentsRequest {
+ amount: StringMinorUnit,
+ card: HyperpgCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct HyperpgCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&HyperpgRouterData<&PaymentsAuthorizeRouterData>> for HyperpgPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &HyperpgRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
+ "Card payment method not implemented".to_string(),
+ )
+ .into()),
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct HyperpgAuthType {
+ pub username: Secret<String>,
+ pub password: Secret<String>,
+ pub merchant_id: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for HyperpgAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self {
+ username: api_key.to_owned(),
+ password: key1.to_owned(),
+ merchant_id: api_secret.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
+// PaymentsResponse
+//TODO: Append the remaining status flags
+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum HyperpgPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<HyperpgPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: HyperpgPaymentStatus) -> Self {
+ match item {
+ HyperpgPaymentStatus::Succeeded => Self::Charged,
+ HyperpgPaymentStatus::Failed => Self::Failure,
+ HyperpgPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct HyperpgPaymentsResponse {
+ status: HyperpgPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, HyperpgPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, HyperpgPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ authentication_data: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct HyperpgRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&HyperpgRouterData<&RefundsRouterData<F>>> for HyperpgRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &HyperpgRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct HyperpgErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+ pub network_advice_code: Option<String>,
+ pub network_decline_code: Option<String>,
+ pub network_error_message: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 5ca8b1bd4e..ddb5bc0c8d 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -229,6 +229,7 @@ default_imp_for_authorize_session_token!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -381,6 +382,7 @@ default_imp_for_payment_settlement_split_create!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -534,6 +536,7 @@ default_imp_for_calculate_tax!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -745,6 +748,7 @@ default_imp_for_session_update!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
@@ -897,6 +901,7 @@ default_imp_for_post_session_tokens!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
@@ -1046,6 +1051,7 @@ default_imp_for_create_order!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
@@ -1197,6 +1203,7 @@ default_imp_for_update_metadata!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
@@ -1350,6 +1357,7 @@ default_imp_for_cancel_post_capture!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
@@ -1439,6 +1447,7 @@ default_imp_for_complete_authorize!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -1577,6 +1586,7 @@ default_imp_for_incremental_authorization!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -1781,6 +1791,7 @@ default_imp_for_extend_authorization!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
@@ -1873,6 +1884,7 @@ default_imp_for_create_customer!(
connectors::Globepay,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -2019,6 +2031,7 @@ default_imp_for_connector_redirect_response!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2155,6 +2168,7 @@ default_imp_for_pre_authenticate_steps!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -2304,6 +2318,7 @@ default_imp_for_authenticate_steps!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -2456,6 +2471,7 @@ default_imp_for_post_authenticate_steps!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -2606,6 +2622,7 @@ default_imp_for_pre_processing_steps!(
connectors::Globepay,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2747,6 +2764,7 @@ default_imp_for_post_processing_steps!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2901,6 +2919,7 @@ default_imp_for_approve!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3056,6 +3075,7 @@ default_imp_for_reject!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3212,6 +3232,7 @@ default_imp_for_webhook_source_verification!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3364,6 +3385,7 @@ default_imp_for_accept_dispute!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3516,6 +3538,7 @@ default_imp_for_submit_evidence!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3667,6 +3690,7 @@ default_imp_for_defend_dispute!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -3822,6 +3846,7 @@ default_imp_for_fetch_disputes!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -3976,6 +4001,7 @@ default_imp_for_dispute_sync!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -4137,6 +4163,7 @@ default_imp_for_file_upload!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4280,6 +4307,7 @@ default_imp_for_payouts!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4423,6 +4451,7 @@ default_imp_for_payouts_create!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4575,6 +4604,7 @@ default_imp_for_payouts_retrieve!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4724,6 +4754,7 @@ default_imp_for_payouts_eligibility!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4876,6 +4907,7 @@ default_imp_for_payouts_fulfill!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5020,6 +5052,7 @@ default_imp_for_payouts_cancel!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5171,6 +5204,7 @@ default_imp_for_payouts_quote!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5325,6 +5359,7 @@ default_imp_for_payouts_recipient!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5479,6 +5514,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5634,6 +5670,7 @@ default_imp_for_frm_sale!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5789,6 +5826,7 @@ default_imp_for_frm_checkout!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -5944,6 +5982,7 @@ default_imp_for_frm_transaction!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -6099,6 +6138,7 @@ default_imp_for_frm_fulfillment!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -6254,6 +6294,7 @@ default_imp_for_frm_record_return!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -6404,6 +6445,7 @@ default_imp_for_revoking_mandates!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -6557,6 +6599,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -6709,6 +6752,7 @@ default_imp_for_uas_webhook!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -6861,6 +6905,7 @@ default_imp_for_uas_post_authentication!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -7014,6 +7059,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -7159,6 +7205,7 @@ default_imp_for_connector_request_id!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -7307,6 +7354,7 @@ default_imp_for_fraud_check!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -7482,6 +7530,7 @@ default_imp_for_connector_authentication!(
connectors::Globepay,
connectors::Gocardless,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -7634,6 +7683,7 @@ default_imp_for_uas_authentication!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -7778,6 +7828,7 @@ default_imp_for_revenue_recovery!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -7983,6 +8034,7 @@ default_imp_for_subscriptions!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -8139,6 +8191,7 @@ default_imp_for_billing_connector_payment_sync!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -8286,6 +8339,7 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -8440,6 +8494,7 @@ default_imp_for_billing_connector_invoice_sync!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -8588,6 +8643,7 @@ default_imp_for_external_vault!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -8741,6 +8797,7 @@ default_imp_for_external_vault_insert!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -8891,6 +8948,7 @@ default_imp_for_gift_card_balance_check!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -9046,6 +9104,7 @@ default_imp_for_external_vault_retrieve!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -9199,6 +9258,7 @@ default_imp_for_external_vault_delete!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -9355,6 +9415,7 @@ default_imp_for_external_vault_create!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
@@ -9508,6 +9569,7 @@ default_imp_for_connector_authentication_token!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -9659,6 +9721,7 @@ default_imp_for_external_vault_proxy_payments_create!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 2bbf468650..8068efab13 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -366,6 +366,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -522,6 +523,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Iatapay,
@@ -669,6 +671,7 @@ default_imp_for_new_connector_integration_connector_authentication_token!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -814,6 +817,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -969,6 +973,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -1125,6 +1130,7 @@ default_imp_for_new_connector_integration_fetch_disputes!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -1281,6 +1287,7 @@ default_imp_for_new_connector_integration_dispute_sync!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
@@ -1436,6 +1443,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -1590,6 +1598,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -1755,6 +1764,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -1912,6 +1922,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2069,6 +2080,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2226,6 +2238,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2383,6 +2396,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2540,6 +2554,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2697,6 +2712,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -2854,6 +2870,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3011,6 +3028,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3166,6 +3184,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3323,6 +3342,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3480,6 +3500,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3637,6 +3658,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3794,6 +3816,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -3951,6 +3974,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4106,6 +4130,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4243,6 +4268,7 @@ default_imp_for_new_connector_integration_frm!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Inespay,
@@ -4397,6 +4423,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Inespay,
@@ -4540,6 +4567,7 @@ default_imp_for_new_connector_integration_revenue_recovery!(
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Inespay,
@@ -4703,6 +4731,7 @@ default_imp_for_new_connector_integration_external_vault!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
@@ -4857,6 +4886,7 @@ default_imp_for_new_connector_integration_external_vault_proxy!(
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
+ connectors::Hyperpg,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
diff --git a/crates/hyperswitch_domain_models/src/connector_endpoints.rs b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
index 269f0d38a3..44a265275a 100644
--- a/crates/hyperswitch_domain_models/src/connector_endpoints.rs
+++ b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
@@ -69,6 +69,7 @@ pub struct Connectors {
pub gpayments: ConnectorParams,
pub helcim: ConnectorParams,
pub hipay: ConnectorParamsWithThreeUrls,
+ pub hyperpg: ConnectorParams,
pub hyperswitch_vault: ConnectorParams,
pub hyperwallet: ConnectorParams,
pub iatapay: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index c9c2437453..7f61f7cd3c 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -22,7 +22,7 @@ pub use hyperswitch_connectors::connectors::{
fiservemea::Fiservemea, fiuu, fiuu::Fiuu, flexiti, flexiti::Flexiti, forte, forte::Forte,
getnet, getnet::Getnet, gigadat, gigadat::Gigadat, globalpay, globalpay::Globalpay, globepay,
globepay::Globepay, gocardless, gocardless::Gocardless, gpayments, gpayments::Gpayments,
- helcim, helcim::Helcim, hipay, hipay::Hipay, hyperswitch_vault,
+ helcim, helcim::Helcim, hipay, hipay::Hipay, hyperpg, hyperpg::Hyperpg, hyperswitch_vault,
hyperswitch_vault::HyperswitchVault, hyperwallet, hyperwallet::Hyperwallet, iatapay,
iatapay::Iatapay, inespay, inespay::Inespay, itaubank, itaubank::Itaubank, jpmorgan,
jpmorgan::Jpmorgan, juspaythreedsserver, juspaythreedsserver::Juspaythreedsserver, katapult,
diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs
index 64fd8fdf3b..26175c08d4 100644
--- a/crates/router/src/core/connector_validation.rs
+++ b/crates/router/src/core/connector_validation.rs
@@ -306,6 +306,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
)?;
Ok(())
}
+ api_enums::Connector::Hyperpg => {
+ hyperpg::transformers::HyperpgAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Iatapay => {
iatapay::transformers::IatapayAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs
index 3516dd626d..6d5c5ef55a 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -295,6 +295,9 @@ impl ConnectorData {
enums::Connector::HyperswitchVault => {
Ok(ConnectorEnum::Old(Box::new(&connector::HyperswitchVault)))
}
+ enums::Connector::Hyperpg => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Hyperpg::new())))
+ }
enums::Connector::Iatapay => {
Ok(ConnectorEnum::Old(Box::new(connector::Iatapay::new())))
}
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index e6a6386a6f..b2e3b43f4b 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -209,6 +209,9 @@ impl FeatureMatrixConnectorData {
enums::Connector::HyperswitchVault => {
Ok(ConnectorEnum::Old(Box::new(&connector::HyperswitchVault)))
}
+ enums::Connector::Hyperpg => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Hyperpg::new())))
+ }
enums::Connector::Iatapay => {
Ok(ConnectorEnum::Old(Box::new(connector::Iatapay::new())))
}
diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs
index bd0d1f9a9f..75a3b6eaf3 100644
--- a/crates/router/src/types/connector_transformers.rs
+++ b/crates/router/src/types/connector_transformers.rs
@@ -79,6 +79,7 @@ impl ForeignTryFrom<api_enums::Connector> for euclid::enums::RoutableConnectors
}
api_enums::Connector::Hipay => Self::Hipay,
api_enums::Connector::Helcim => Self::Helcim,
+ api_enums::Connector::Hyperpg => Self::Hyperpg,
api_enums::Connector::HyperswitchVault => {
Err(common_utils::errors::ValidationError::InvalidValue {
message: "Hyperswitch Vault is not a routable connector".to_string(),
diff --git a/crates/router/tests/connectors/hyperpg.rs b/crates/router/tests/connectors/hyperpg.rs
new file mode 100644
index 0000000000..c334c3cdad
--- /dev/null
+++ b/crates/router/tests/connectors/hyperpg.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct HyperpgTest;
+impl ConnectorActions for HyperpgTest {}
+impl utils::Connector for HyperpgTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Hyperpg;
+ utils::construct_connector_data_old(
+ Box::new(Hyperpg::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .hyperpg
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "hyperpg".to_string()
+ }
+}
+
+static CONNECTOR: HyperpgTest = HyperpgTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 058a58d40a..09625a8e0e 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -58,6 +58,7 @@ mod gocardless;
mod gpayments;
mod helcim;
mod hipay;
+mod hyperpg;
mod hyperswitch_vault;
mod hyperwallet;
mod iatapay;
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index a367828d43..c0dc00fc9b 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -68,6 +68,7 @@ pub struct ConnectorAuthentication {
pub gpayments: Option<HeaderKey>,
pub helcim: Option<HeaderKey>,
pub hipay: Option<HeaderKey>,
+ pub hyperpg: Option<HeaderKey>,
pub hyperswitch_vault: Option<SignatureKey>,
pub hyperwallet: Option<BodyKey>,
pub iatapay: Option<SignatureKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index d4e41bc309..1fac2ffc5f 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -146,6 +146,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
hipay.base_url = "https://stage-secure-gateway.hipay-tpp.com/rest/"
+hyperpg.base_url = "https://sandbox.hyperpg.in"
hyperswitch_vault.base_url = "http://localhost:8080"
hyperwallet.base_url = "https://uat-api.paylution.com"
hipay.secondary_base_url = "https://stage-secure2-vault.hipay-tpp.com/rest/"
@@ -438,6 +439,10 @@ upi_intent = { country = "IN", currency = "INR" }
upi_collect = { country = "IN", currency = "INR" }
upi_intent = { country = "IN", currency = "INR" }
+[pm_filters.hyperpg]
+credit = { currency = "INR,USD,GBP,EUR" }
+debit = { currency = "INR,USD,GBP,EUR" }
+
[pm_filters.adyen]
boleto = { country = "BR", currency = "BRL" }
sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR" }
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 0a64d79b6d..ac63a3e522 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluesnap boku braintree breadpay calida cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon envoy facilitapay finix fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna loonio mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payjustnow payjustnowinstore payload payme payone paypal paysafe paystack paytm payu peachpayments phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar tesouro threedsecureio thunes tokenex tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpaymodular worldpayvantiv worldpayxml xendit zift zsl "$1")
+ connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluesnap boku braintree breadpay calida cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon envoy facilitapay finix fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperpg hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna loonio mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payjustnow payjustnowinstore payload payme payone paypal paysafe paystack paytm payu peachpayments phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar tesouro threedsecureio thunes tokenex tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpaymodular worldpayvantiv worldpayxml xendit zift zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS