Skip to content

Commit

Permalink
feat(connector): [RazorPay] Add new connector and Implement payment f…
Browse files Browse the repository at this point in the history
…lows for UPI payment method (#5200)

Co-authored-by: AkshayaFoiger <[email protected]>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent d9c7849 commit fdac313
Show file tree
Hide file tree
Showing 30 changed files with 2,644 additions and 6 deletions.
8 changes: 8 additions & 0 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7763,6 +7763,7 @@
"powertranz",
"prophetpay",
"rapyd",
"razorpay",
"shift4",
"square",
"stax",
Expand Down Expand Up @@ -9757,6 +9758,12 @@
"enum": [
"user_date_of_birth"
]
},
{
"type": "string",
"enum": [
"user_vpa_id"
]
}
],
"description": "Possible field type of required fields in payment_method_data"
Expand Down Expand Up @@ -19468,6 +19475,7 @@
"powertranz",
"prophetpay",
"rapyd",
"razorpay",
"riskified",
"shift4",
"signifyd",
Expand Down
4 changes: 4 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ placetopay.base_url = "https://test.placetopay.com/rest/gateway"
powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
Expand Down Expand Up @@ -477,6 +478,9 @@ boleto = { country = "BR", currency = "BRL" }
[pm_filters.volt]
open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }

[pm_filters.razorpay]
upi_collect = {country = "IN", currency = "INR"}

[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
Expand Down
4 changes: 4 additions & 0 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ placetopay.base_url = "https://test.placetopay.com/rest/gateway"
powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
riskified.base_url = "https://sandbox.riskified.com/api"
Expand Down Expand Up @@ -287,6 +288,9 @@ sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }
[pm_filters.volt]
open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"}

[pm_filters.razorpay]
upi_collect = {country = "IN", currency = "INR"}

[pm_filters.worldpay]
apple_pay.country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US"
google_pay.country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN"
Expand Down
4 changes: 4 additions & 0 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ placetopay.base_url = "https://checkout.placetopay.com/rest/gateway"
powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://api.juspay.in"
riskified.base_url = "https://wh.riskified.com/api/"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
Expand Down Expand Up @@ -306,6 +307,9 @@ sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }
[pm_filters.volt]
open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"}

[pm_filters.razorpay]
upi_collect = {country = "IN", currency = "INR"}

[pm_filters.worldpay]
apple_pay.country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US"
google_pay.country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN"
Expand Down
4 changes: 4 additions & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ placetopay.base_url = "https://test.placetopay.com/rest/gateway"
powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
Expand Down Expand Up @@ -310,6 +311,9 @@ sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }
[pm_filters.volt]
open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }

[pm_filters.razorpay]
upi_collect = {country = "IN", currency = "INR"}

[pm_filters.worldpay]
apple_pay.country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US"
google_pay.country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN"
Expand Down
4 changes: 4 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ placetopay.base_url = "https://test.placetopay.com/rest/gateway"
powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
Expand Down Expand Up @@ -336,6 +337,9 @@ cashapp = { country = "US", currency = "USD" }
[pm_filters.volt]
open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }

[pm_filters.razorpay]
upi_collect = {country = "IN", currency = "INR"}

[pm_filters.adyen]
google_pay = { country = "AU,NZ,JP,HK,SG,MY,TH,VN,BH,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,RO,HR,LI,MT,SI,GR,PT,IE,CZ,EE,LT,LV,IT,PL,TR,IS,CA,US", currency = "AED,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HTG,HUF,IDR,ILS,INR,IQD,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LYD,MAD,MDL,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLE,SOS,SRD,STN,SVC,SZL,THB,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" }
apple_pay = { country = "AU,NZ,CN,JP,HK,SG,MY,BH,AE,KW,BR,ES,GB,SE,NO,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,LI,UA,MT,SI,GR,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }
Expand Down
4 changes: 4 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ placetopay.base_url = "https://test.placetopay.com/rest/gateway"
powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
Expand Down Expand Up @@ -346,6 +347,9 @@ sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR" }
[pm_filters.volt]
open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }

[pm_filters.razorpay]
upi_collect = {country = "IN", currency = "INR"}

[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
Expand Down
4 changes: 4 additions & 0 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ pub enum Connector {
Powertranz,
Prophetpay,
Rapyd,
Razorpay,
Shift4,
Square,
Stax,
Expand Down Expand Up @@ -252,6 +253,7 @@ impl Connector {
| Self::Zsl
| Self::Signifyd
| Self::Plaid
| Self::Razorpay
| Self::Riskified
| Self::Threedsecureio
// | Self::Datatrans
Expand Down Expand Up @@ -466,6 +468,7 @@ pub enum FieldType {
Text,
DropDown { options: Vec<String> },
UserDateOfBirth,
UserVpaId,
}

impl FieldType {
Expand Down Expand Up @@ -551,6 +554,7 @@ impl PartialEq for FieldType {
},
) => options_self.eq(options_other),
(Self::UserDateOfBirth, Self::UserDateOfBirth) => true,
(Self::UserVpaId, Self::UserVpaId) => true,
_unused => false,
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ pub enum RoutableConnectors {
Powertranz,
Prophetpay,
Rapyd,
Razorpay,
Riskified,
Shift4,
Signifyd,
Expand Down
2 changes: 2 additions & 0 deletions crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ pub struct ConnectorConfig {
pub plaid: Option<ConnectorTomlConfig>,
pub powertranz: Option<ConnectorTomlConfig>,
pub prophetpay: Option<ConnectorTomlConfig>,
pub razorpay: Option<ConnectorTomlConfig>,
pub riskified: Option<ConnectorTomlConfig>,
pub rapyd: Option<ConnectorTomlConfig>,
pub shift4: Option<ConnectorTomlConfig>,
Expand Down Expand Up @@ -312,6 +313,7 @@ impl ConnectorConfig {
Connector::Placetopay => Ok(connector_data.placetopay),
Connector::Plaid => Ok(connector_data.plaid),
Connector::Powertranz => Ok(connector_data.powertranz),
Connector::Razorpay => Ok(connector_data.razorpay),
Connector::Rapyd => Ok(connector_data.rapyd),
Connector::Riskified => Ok(connector_data.riskified),
Connector::Shift4 => Ok(connector_data.shift4),
Expand Down
7 changes: 7 additions & 0 deletions crates/connector_configs/toml/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,13 @@ api_key="key"
brand_id="Brand ID"
destination_account_number="Destination Account Number"

[razorpay]
[razorpay.upi]
payment_method_type = "upiCollect"
[razorpay.connector_auth.BodyKey]
api_key="Razorpay Id"
key1 = "Razorpay Secret"

[mollie]
[[mollie.credit]]
payment_method_type = "Mastercard"
Expand Down
6 changes: 6 additions & 0 deletions crates/connector_configs/toml/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,12 @@ api_key="key"
brand_id="Brand ID"
destination_account_number="Destination Account Number"

[razorpay]
[razorpay.upi]
payment_method_type = "upiCollect"
[razorpay.connector_auth.BodyKey]
api_key="Razorpay Id"
key1 = "Razorpay Secret"

[mollie]
[[mollie.credit]]
Expand Down
7 changes: 7 additions & 0 deletions crates/connector_configs/toml/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,13 @@ api_key="key"
brand_id="Brand ID"
destination_account_number="Destination Account Number"

[razorpay]
[razorpay.upi]
payment_method_type = "upiCollect"
[razorpay.connector_auth.BodyKey]
api_key="Razorpay Id"
key1 = "Razorpay Secret"

[mollie]
[[mollie.credit]]
payment_method_type = "Mastercard"
Expand Down
14 changes: 14 additions & 0 deletions crates/hyperswitch_interfaces/src/configs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Configs interface
use masking::Secret;
use router_derive;
use serde::Deserialize;
use storage_impl::errors::ApplicationError;
Expand Down Expand Up @@ -63,6 +64,7 @@ pub struct Connectors {
pub powertranz: ConnectorParams,
pub prophetpay: ConnectorParams,
pub rapyd: ConnectorParams,
pub razorpay: ConnectorParamsWithKeys,
pub riskified: ConnectorParams,
pub shift4: ConnectorParams,
pub signifyd: ConnectorParams,
Expand Down Expand Up @@ -90,6 +92,18 @@ pub struct ConnectorParams {
pub secondary_base_url: Option<String>,
}

/// struct ConnectorParamsWithKeys
#[derive(Debug, Deserialize, Clone, Default, router_derive::ConfigValidate)]
#[serde(default)]
pub struct ConnectorParamsWithKeys {
/// base url
pub base_url: String,
/// api key
pub api_key: Secret<String>,
/// merchant ID
pub merchant_id: Secret<String>,
}

/// struct ConnectorParamsWithModeType
#[derive(Debug, Deserialize, Clone, Default, router_derive::ConfigValidate)]
#[serde(default)]
Expand Down
30 changes: 30 additions & 0 deletions crates/router/src/configs/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8641,6 +8641,36 @@ impl Default for super::settings::RequiredFields {
),
])),
),
(
enums::PaymentMethod::Upi,
PaymentMethodType(HashMap::from([
(
enums::PaymentMethodType::UpiCollect,
ConnectorFields {
fields: HashMap::from([
(
enums::Connector::Razorpay,
RequiredFieldFinal {
mandate : HashMap::new(),
non_mandate : HashMap::new(),
common : HashMap::from([
(
"payment_method_data.upi.upi_collect.vpa_id".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.upi.upi_collect.vpa_id".to_string(),
display_name: "vpa_id".to_string(),
field_type: enums::FieldType::UserVpaId,
value: None,
}
),
]),
}
),
]),
},
),
])),
),
(
enums::PaymentMethod::BankDebit,
PaymentMethodType(HashMap::from([(
Expand Down
9 changes: 5 additions & 4 deletions crates/router/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub mod placetopay;
pub mod powertranz;
pub mod prophetpay;
pub mod rapyd;
pub mod razorpay;
pub mod riskified;
pub mod shift4;
pub mod signifyd;
Expand Down Expand Up @@ -80,8 +81,8 @@ pub use self::{
multisafepay::Multisafepay, netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon,
nuvei::Nuvei, opayo::Opayo, opennode::Opennode, payeezy::Payeezy, payme::Payme, payone::Payone,
paypal::Paypal, payu::Payu, placetopay::Placetopay, powertranz::Powertranz,
prophetpay::Prophetpay, rapyd::Rapyd, riskified::Riskified, shift4::Shift4, signifyd::Signifyd,
square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay,
tsys::Tsys, volt::Volt, wise::Wise, worldline::Worldline, worldpay::Worldpay, zen::Zen,
zsl::Zsl,
prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, riskified::Riskified, shift4::Shift4,
signifyd::Signifyd, square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio,
trustpay::Trustpay, tsys::Tsys, volt::Volt, wise::Wise, worldline::Worldline,
worldpay::Worldpay, zen::Zen, zsl::Zsl,
};
Loading

0 comments on commit fdac313

Please sign in to comment.