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): [PAYJUSTNOW] Add payjustnow payment flow (#10025)

sweta-sharma494df42e8f7a
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index ae55315094..80cd3335ae 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -13477,6 +13477,7 @@
"paytm",
"payu",
"peachpayments",
+ "payjustnow",
"phonepe",
"placetopay",
"powertranz",
@@ -22566,6 +22567,17 @@
"type": "object"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "payjustnow_redirect"
+ ],
+ "properties": {
+ "payjustnow_redirect": {
+ "type": "object"
+ }
+ }
}
]
},
@@ -24571,6 +24583,7 @@
"permata_bank_transfer",
"open_banking_uk",
"pay_bright",
+ "payjustnow",
"paypal",
"paze",
"pix",
@@ -33017,6 +33030,7 @@
"paytm",
"payu",
"peachpayments",
+ "payjustnow",
"phonepe",
"placetopay",
"powertranz",
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 32f67f6ded..256315c7a7 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -9053,6 +9053,7 @@
"paytm",
"payu",
"peachpayments",
+ "payjustnow",
"phonepe",
"placetopay",
"powertranz",
@@ -16943,6 +16944,17 @@
"type": "object"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "payjustnow_redirect"
+ ],
+ "properties": {
+ "payjustnow_redirect": {
+ "type": "object"
+ }
+ }
}
]
},
@@ -19299,6 +19311,7 @@
"permata_bank_transfer",
"open_banking_uk",
"pay_bright",
+ "payjustnow",
"paypal",
"paze",
"pix",
@@ -24731,6 +24744,7 @@
"paytm",
"payu",
"peachpayments",
+ "payjustnow",
"phonepe",
"placetopay",
"powertranz",
diff --git a/config/config.example.toml b/config/config.example.toml
index d29ee38850..49906bc333 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -969,6 +969,9 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD
google_pay = { country = "AD, AE, AG, AI, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BZ, CA, CC, CG, CH, CI, CK, CL, CM, CN, CO, CR, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KR, KW, KY, KZ, LA, LC, LI, LK, LR, LS, LT, LU, LV, MA, MC, MD, ME, MF, MG, MH, MK, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PT, PW, PY, QA, RE, RO, RS, RW, SA, SB, SC, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SR, ST, SV, SX, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TT, TV, TZ, UG, UM, UY, UZ, VA, VC, VG, VI, VN, VU, WF, WS, YT, ZA, ZM, US", currency = "USD, CAD" }
apple_pay = { currency = "USD, CAD" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
[connector_customer]
payout_connector_list = "nomupay,stripe,wise"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index e97b2b5cec..3c08ccb1bd 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -863,6 +863,9 @@ credit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
debit = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
[temp_locker_enable_config]
bluesnap.payment_method = "card"
nuvei.payment_method = "card"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 0a4fbddb91..41554d450a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -858,6 +858,9 @@ apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
[pm_filters.paysafe]
apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
[payout_method_filters.adyenplatform]
sepa = { country = "AT,BE,CH,CZ,DE,EE,ES,FI,FR,GB,HU,IE,IT,LT,LV,NL,NO,PL,PT,SE,SK", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF,CAD,JPY" }
credit = { country = "AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,US", currency = "EUR,USD,GBP,CAD,JPY" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 52d11bbd71..aa15321211 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -869,6 +869,9 @@ apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
[pm_filters.paysafe]
apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
[payout_method_filters.stripe]
ach = { country = "US", currency = "USD" }
diff --git a/config/development.toml b/config/development.toml
index 7811a9d0c9..01ffdc380c 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1018,6 +1018,9 @@ apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }
[pm_filters.paysafe]
apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,NL,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,VG,VI,WF,EH,YE,ZM,ZW", currency = "ARS,AUD,AZN,BHD,BOB,BAM,BRL,BGN,CAD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,ETB,EUR,FJD,GEL,GTQ,HTG,HNL,HKD,HUF,INR,IDR,JMD,JPY,JOD,KZT,KES,KRW,KWD,LBP,LYD,MWK,MUR,MXN,MDL,MAD,ILS,NZD,NGN,NOK,OMR,PKR,PAB,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SAR,RSD,SGD,ZAR,LKR,SEK,CHF,SYP,TWD,THB,TTD,TND,TRY,UAH,AED,UYU,USD,VND" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization", google_pay_pre_decrypt_flow = "network_tokenization" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index c63d74980e..57fa72da27 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -997,6 +997,9 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD
google_pay = { country = "AD, AE, AG, AI, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BZ, CA, CC, CG, CH, CI, CK, CL, CM, CN, CO, CR, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KR, KW, KY, KZ, LA, LC, LI, LK, LR, LS, LT, LU, LV, MA, MC, MD, ME, MF, MG, MH, MK, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PT, PW, PY, QA, RE, RO, RS, RW, SA, SB, SC, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SR, ST, SV, SX, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TT, TV, TZ, UG, UM, UY, UZ, VA, VC, VG, VI, VN, VU, WF, WS, YT, ZA, ZM, US", currency = "USD, CAD" }
apple_pay = { currency = "USD, CAD" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
[bank_config.online_banking_fpx]
adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
fiuu.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_of_china,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 042c5833f0..6c47c6505a 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2379,6 +2379,7 @@ pub enum PayLaterData {
AlmaRedirect {},
AtomeRedirect {},
BreadpayRedirect {},
+ PayjustnowRedirect {},
}
impl GetAddressFromPaymentMethodData for PayLaterData {
@@ -2421,7 +2422,8 @@ impl GetAddressFromPaymentMethodData for PayLaterData {
| Self::KlarnaSdk { .. }
| Self::AffirmRedirect {}
| Self::AtomeRedirect {}
- | Self::BreadpayRedirect {} => None,
+ | Self::BreadpayRedirect {}
+ | Self::PayjustnowRedirect {} => None,
}
}
}
@@ -3014,6 +3016,7 @@ impl GetPaymentMethodType for PayLaterData {
Self::AlmaRedirect {} => api_enums::PaymentMethodType::Alma,
Self::AtomeRedirect {} => api_enums::PaymentMethodType::Atome,
Self::BreadpayRedirect {} => api_enums::PaymentMethodType::Breadpay,
+ Self::PayjustnowRedirect {} => api_enums::PaymentMethodType::Payjustnow,
}
}
}
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 9490221d90..7bb9cbeb3e 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -141,6 +141,7 @@ pub enum RoutableConnectors {
Paytm,
Payu,
Peachpayments,
+ Payjustnow,
Phonepe,
Placetopay,
Powertranz,
@@ -326,6 +327,7 @@ pub enum Connector {
Paytm,
Payu,
Peachpayments,
+ Payjustnow,
Phonepe,
Placetopay,
Powertranz,
@@ -573,6 +575,7 @@ impl Connector {
| Self::Stripe
| Self::Datatrans
| Self::Paytm
+ | Self::Payjustnow
| Self::Phonepe => false,
Self::Checkout | Self::Nmi |Self::Cybersource | Self::Archipel | Self::Nuvei => true,
}
@@ -747,6 +750,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Hipay => Self::Hipay,
RoutableConnectors::Paytm => Self::Paytm,
RoutableConnectors::Phonepe => Self::Phonepe,
+ RoutableConnectors::Payjustnow => Self::Payjustnow,
}
}
}
@@ -886,6 +890,7 @@ impl TryFrom<Connector> for RoutableConnectors {
Connector::Redsys => Ok(Self::Redsys),
Connector::Paytm => Ok(Self::Paytm),
Connector::Phonepe => Ok(Self::Phonepe),
+ Connector::Payjustnow => Ok(Self::Payjustnow),
Connector::CtpMastercard
| Connector::Gpayments
| Connector::HyperswitchVault
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 445569c6b6..7b81dd1a5e 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2093,6 +2093,7 @@ pub enum PaymentMethodType {
PermataBankTransfer,
OpenBankingUk,
PayBright,
+ Payjustnow,
Paypal,
Paze,
Pix,
@@ -2221,6 +2222,7 @@ impl PaymentMethodType {
Self::PermataBankTransfer => "Permata Bank Transfer",
Self::OpenBankingUk => "Open Banking UK",
Self::PayBright => "PayBright",
+ Self::Payjustnow => "Payjustnow",
Self::Paypal => "PayPal",
Self::Paze => "Paze",
Self::Pix => "Pix",
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index b4c326e333..83cdfd9947 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -1888,6 +1888,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::WeChatPay => Self::Wallet,
PaymentMethodType::TouchNGo => Self::Wallet,
PaymentMethodType::Atome => Self::PayLater,
+ PaymentMethodType::Payjustnow => Self::PayLater,
PaymentMethodType::Boleto => Self::Voucher,
PaymentMethodType::Efecty => Self::Voucher,
PaymentMethodType::PagoEfectivo => Self::Voucher,
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index e105fab53b..fbc6f5adbc 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -328,6 +328,7 @@ pub struct ConnectorConfig {
pub paytm: Option<ConnectorTomlConfig>,
pub payu: Option<ConnectorTomlConfig>,
pub peachpayments: Option<ConnectorTomlConfig>,
+ pub payjustnow: Option<ConnectorTomlConfig>,
pub phonepe: Option<ConnectorTomlConfig>,
pub placetopay: Option<ConnectorTomlConfig>,
pub plaid: Option<ConnectorTomlConfig>,
@@ -600,6 +601,7 @@ impl ConnectorConfig {
Connector::Xendit => Ok(connector_data.xendit),
Connector::Paytm => Ok(connector_data.paytm),
Connector::Phonepe => Ok(connector_data.phonepe),
+ Connector::Payjustnow => Ok(connector_data.payjustnow),
}
}
}
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 67369ea6e2..ff655c6868 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -7647,5 +7647,9 @@ type="MultiSelect"
options=["CRYPTOGRAM_3DS"]
[payjustnow]
-[payjustnow.connector_auth.HeaderKey]
-api_key = "API Key"
+[payjustnow.connector_auth.BodyKey]
+api_key = "Signing Key"
+key1 = "Merchant Account Id"
+
+[[payjustnow.pay_later]]
+ payment_method_type = "payjustnow"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index d3c8a8cc49..dc206745b8 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -6382,5 +6382,10 @@ type="MultiSelect"
options=["CRYPTOGRAM_3DS"]
[payjustnow]
-[payjustnow.connector_auth.HeaderKey]
-api_key = "API Key"
+[payjustnow.connector_auth.BodyKey]
+api_key = "Signing Key"
+key1 = "Merchant Account Id"
+
+[[payjustnow.pay_later]]
+ payment_method_type = "payjustnow"
+
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 1fce874a71..a5f4beecf0 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -7621,5 +7621,10 @@ type="MultiSelect"
options=["CRYPTOGRAM_3DS"]
[payjustnow]
-[payjustnow.connector_auth.HeaderKey]
-api_key = "API Key"
+[payjustnow.connector_auth.BodyKey]
+api_key = "Signing Key"
+key1 = "Merchant Account Id"
+
+[[payjustnow.pay_later]]
+ payment_method_type = "payjustnow"
+
diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs
index 62384cafa0..1ec9bde47a 100644
--- a/crates/euclid/src/frontend/dir/enums.rs
+++ b/crates/euclid/src/frontend/dir/enums.rs
@@ -58,6 +58,7 @@ pub enum PayLaterType {
Flexiti,
Atome,
Breadpay,
+ Payjustnow,
}
#[derive(
diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs
index 2e008d9424..717f9a0e5b 100644
--- a/crates/euclid/src/frontend/dir/lowering.rs
+++ b/crates/euclid/src/frontend/dir/lowering.rs
@@ -34,6 +34,7 @@ impl From<enums::PayLaterType> for global_enums::PaymentMethodType {
enums::PayLaterType::Walley => Self::Walley,
enums::PayLaterType::Atome => Self::Atome,
enums::PayLaterType::Breadpay => Self::Breadpay,
+ enums::PayLaterType::Payjustnow => Self::Payjustnow,
}
}
}
diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs
index 3a038feaff..0ad54cd1a9 100644
--- a/crates/euclid/src/frontend/dir/transformers.rs
+++ b/crates/euclid/src/frontend/dir/transformers.rs
@@ -18,6 +18,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
global_enums::PaymentMethodType::Fps => Ok(dirval!(RealTimePaymentType = Fps)),
global_enums::PaymentMethodType::Klarna => Ok(dirval!(PayLaterType = Klarna)),
global_enums::PaymentMethodType::Affirm => Ok(dirval!(PayLaterType = Affirm)),
+ global_enums::PaymentMethodType::Payjustnow => Ok(dirval!(PayLaterType = Payjustnow)),
global_enums::PaymentMethodType::AfterpayClearpay => {
Ok(dirval!(PayLaterType = AfterpayClearpay))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs
index ce2c6768da..0cd61b9e0b 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs
@@ -235,7 +235,8 @@ impl ConnectorValidation for Adyen {
| PaymentMethodType::Givex
| PaymentMethodType::Klarna
| PaymentMethodType::Twint
- | PaymentMethodType::Walley => match capture_method {
+ | PaymentMethodType::Walley
+ | PaymentMethodType::Payjustnow => match capture_method {
enums::CaptureMethod::Automatic
| enums::CaptureMethod::Manual
| enums::CaptureMethod::SequentialAutomatic => Ok(()),
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index cb301e9fe2..cc636f8ad2 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -2545,7 +2545,8 @@ impl
}
PayLaterData::KlarnaSdk { .. }
| PayLaterData::BreadpayRedirect {}
- | PayLaterData::FlexitiRedirect {} => Err(errors::ConnectorError::NotImplemented(
+ | PayLaterData::FlexitiRedirect {}
+ | PayLaterData::PayjustnowRedirect {} => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into()),
diff --git a/crates/hyperswitch_connectors/src/connectors/breadpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/breadpay/transformers.rs
index 9230c6f5f5..e888191eca 100644
--- a/crates/hyperswitch_connectors/src/connectors/breadpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/breadpay/transformers.rs
@@ -95,7 +95,8 @@ impl TryFrom<&BreadpayRouterData<&PaymentsAuthorizeRouterData>> for BreadpayCart
hyperswitch_domain_models::payment_method_data::PayLaterData::AfterpayClearpayRedirect { } |
hyperswitch_domain_models::payment_method_data::PayLaterData::PayBrightRedirect { } |
hyperswitch_domain_models::payment_method_data::PayLaterData::AlmaRedirect { } |
- hyperswitch_domain_models::payment_method_data::PayLaterData::AtomeRedirect { } => {
+ hyperswitch_domain_models::payment_method_data::PayLaterData::AtomeRedirect { } |
+ hyperswitch_domain_models::payment_method_data::PayLaterData::PayjustnowRedirect { } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("breadpay"),
))
diff --git a/crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs b/crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
index 666c800cbf..1fac7ce398 100644
--- a/crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
@@ -122,7 +122,8 @@ impl TryFrom<&FlexitiRouterData<&PaymentsAuthorizeRouterData>> for FlexitiPaymen
hyperswitch_domain_models::payment_method_data::PayLaterData::PayBrightRedirect { } |
hyperswitch_domain_models::payment_method_data::PayLaterData::WalleyRedirect { } |
hyperswitch_domain_models::payment_method_data::PayLaterData::AlmaRedirect { } |
- hyperswitch_domain_models::payment_method_data::PayLaterData::AtomeRedirect { } => {
+ hyperswitch_domain_models::payment_method_data::PayLaterData::AtomeRedirect { } |
+ hyperswitch_domain_models::payment_method_data::PayLaterData::PayjustnowRedirect { } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("flexiti"),
))
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs
index 148eceb12d..b709ae85d0 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs
@@ -653,7 +653,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::OpenBankingPIS
| common_enums::PaymentMethodType::RevolutPay
| common_enums::PaymentMethodType::IndonesianBankTransfer
- | common_enums::PaymentMethodType::Breadpay,
+ | common_enums::PaymentMethodType::Breadpay
+ | common_enums::PaymentMethodType::Payjustnow,
) => Err(error_stack::report!(errors::ConnectorError::NotSupported {
message: payment_method_type.to_string(),
connector: "klarna",
@@ -780,7 +781,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::Skrill
| common_enums::PaymentMethodType::IndonesianBankTransfer
| common_enums::PaymentMethodType::RevolutPay
- | common_enums::PaymentMethodType::Breadpay,
+ | common_enums::PaymentMethodType::Breadpay
+ | common_enums::PaymentMethodType::Payjustnow,
) => Err(error_stack::report!(errors::ConnectorError::NotSupported {
message: payment_method_type.to_string(),
connector: "klarna",
@@ -913,7 +915,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::OpenBankingPIS
| common_enums::PaymentMethodType::IndonesianBankTransfer
| common_enums::PaymentMethodType::RevolutPay
- | common_enums::PaymentMethodType::Breadpay,
+ | common_enums::PaymentMethodType::Breadpay
+ | common_enums::PaymentMethodType::Payjustnow,
) => Err(error_stack::report!(errors::ConnectorError::NotSupported {
message: payment_method_type.to_string(),
connector: "klarna",
@@ -1040,7 +1043,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
| common_enums::PaymentMethodType::RevolutPay
| common_enums::PaymentMethodType::Breadpay
| common_enums::PaymentMethodType::IndonesianBankTransfer
- | common_enums::PaymentMethodType::Skrill,
+ | common_enums::PaymentMethodType::Skrill
+ | common_enums::PaymentMethodType::Payjustnow,
) => Err(error_stack::report!(errors::ConnectorError::NotSupported {
message: payment_method_type.to_string(),
connector: "klarna",
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 5b88536c66..70910db465 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -817,7 +817,8 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
| PayLaterData::WalleyRedirect {}
| PayLaterData::AlmaRedirect {}
| PayLaterData::AtomeRedirect {}
- | PayLaterData::BreadpayRedirect {} => {
+ | PayLaterData::BreadpayRedirect {}
+ | PayLaterData::PayjustnowRedirect {} => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message(
"multisafepay",
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index ed76a2ef49..4d16f1686f 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1859,10 +1859,13 @@ where
| PayLaterData::WalleyRedirect {}
| PayLaterData::AlmaRedirect {}
| PayLaterData::AtomeRedirect {}
- | PayLaterData::BreadpayRedirect {} => Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("nuvei"),
- )
- .into()),
+ | PayLaterData::BreadpayRedirect {}
+ | PayLaterData::PayjustnowRedirect {} => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("nuvei"),
+ )
+ .into())
+ }
},
PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankTransfer(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/payjustnow.rs b/crates/hyperswitch_connectors/src/connectors/payjustnow.rs
index 02498defa1..7e05f87ef3 100644
--- a/crates/hyperswitch_connectors/src/connectors/payjustnow.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payjustnow.rs
@@ -2,14 +2,17 @@ pub mod transformers;
use std::sync::LazyLock;
+use api_models;
+use base64::Engine;
use common_enums::enums;
use common_utils::{
+ crypto::{self, SignMessage},
errors::CustomResult,
- ext_traits::BytesExt,
+ ext_traits::{ByteSliceExt, BytesExt, ValueExt},
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
-use error_stack::{report, ResultExt};
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
@@ -24,11 +27,12 @@ use hyperswitch_domain_models::{
RefundsData, SetupMandateRequestData,
},
router_response_types::{
- ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods,
+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
+ SupportedPaymentMethods,
},
types::{
- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
- RefundSyncRouterData, RefundsRouterData,
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
@@ -42,20 +46,24 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks,
};
-use masking::{ExposeInterface, Mask};
+use masking::{ExposeInterface, Mask, PeekInterface, Secret};
use transformers as payjustnow;
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{
+ constants::headers,
+ types::ResponseRouterData,
+ utils::{self},
+};
#[derive(Clone)]
pub struct Payjustnow {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
}
impl Payjustnow {
pub fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &MinorUnitForConnector,
}
}
}
@@ -86,15 +94,45 @@ where
fn build_headers(
&self,
req: &RouterData<Flow, Request, Response>,
- _connectors: &Connectors,
+ 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 request_body = Self::get_request_body(self, req, connectors)?;
+
+ let request_body_string =
+ String::from_utf8(request_body.get_inner_value().peek().as_bytes().to_vec())
+ .map_err(|_| errors::ConnectorError::RequestEncodingFailed)?;
+ let request_body_string_without_whitespace =
+ request_body_string.replace(char::is_whitespace, "");
+
+ let auth = payjustnow::PayjustnowAuthType::try_from(&req.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+
+ let signature = crypto::HmacSha256::sign_message(
+ &crypto::HmacSha256,
+ auth.signing_key.expose().as_bytes(),
+ request_body_string_without_whitespace.as_bytes(),
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ let signature_base64 = base64::engine::general_purpose::STANDARD.encode(signature);
+
+ let mut headers = vec![
+ (
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ ),
+ (
+ headers::USER_AGENT.to_string(),
+ hyperswitch_interfaces::consts::USER_AGENT
+ .to_string()
+ .into(),
+ ),
+ ];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
- header.append(&mut api_key);
- Ok(header)
+ headers.append(&mut api_key);
+ headers.push(("X-Signature".to_string(), signature_base64.into_masked()));
+
+ Ok(headers)
}
}
@@ -122,8 +160,8 @@ impl ConnectorCommon for Payjustnow {
let auth = payjustnow::PayjustnowAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
+ "X-Merchant-Account-ID".to_string(),
+ auth.merchant_account_id.expose().into_masked(),
)])
}
@@ -142,9 +180,9 @@ impl ConnectorCommon for Payjustnow {
Ok(ErrorResponse {
status_code: res.status_code,
- code: response.code,
+ code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(),
message: response.message,
- reason: response.reason,
+ reason: None,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
@@ -172,12 +210,21 @@ impl ConnectorValidation for Payjustnow {
fn validate_psync_reference_id(
&self,
- _data: &PaymentsSyncData,
+ data: &PaymentsSyncData,
_is_three_ds: bool,
_status: enums::AttemptStatus,
_connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
) -> CustomResult<(), errors::ConnectorError> {
- Ok(())
+ if data.encoded_data.is_some()
+ || data
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .is_ok()
+ {
+ return Ok(());
+ }
+
+ Err(errors::ConnectorError::MissingConnectorTransactionID.into())
}
}
@@ -208,9 +255,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/create", self.base_url(connectors)))
}
fn get_request_body(
@@ -227,6 +274,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
let connector_router_data = payjustnow::PayjustnowRouterData::from((amount, req));
let connector_req =
payjustnow::PayjustnowPaymentsRequest::try_from(&connector_router_data)?;
+
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -242,12 +290,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
self, req, connectors,
)?)
.attach_default_headers()
- .headers(types::PaymentsAuthorizeType::get_headers(
- self, req, connectors,
- )?)
- .set_body(types::PaymentsAuthorizeType::get_request_body(
- self, req, connectors,
- )?)
+ .headers(self.get_headers(req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
.build(),
))
}
@@ -296,9 +340,18 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
fn get_url(
&self,
_req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/getstatus", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = payjustnow::PayjustnowSyncRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
@@ -308,10 +361,11 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Get)
+ .method(Method::Post)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
- .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .headers(self.get_headers(req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
.build(),
))
}
@@ -322,7 +376,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Pay
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
- let response: payjustnow::PayjustnowPaymentsResponse = res
+ let response: payjustnow::PayjustnowSyncResponse = res
.response
.parse_struct("payjustnow PaymentsSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -421,7 +475,79 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
}
}
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Payjustnow {}
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Payjustnow {
+ fn get_headers(
+ &self,
+ req: &PaymentsCancelRouterData,
+ 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: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}/cancel", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsCancelRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = payjustnow::PayjustnowCancelRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(self.get_headers(req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCancelRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+ let response: payjustnow::PayjustnowSyncResponse = res
+ .response
+ .parse_struct("payjustnow PaymentsCancelResponse")
+ .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<Execute, RefundsData, RefundsResponseData> for Payjustnow {
fn get_headers(
@@ -439,9 +565,9 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjust
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/refund", self.base_url(connectors)))
}
fn get_request_body(
@@ -449,14 +575,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjust
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 = payjustnow::PayjustnowRouterData::from((refund_amount, req));
- let connector_req = payjustnow::PayjustnowRefundRequest::try_from(&connector_router_data)?;
+ let connector_req = payjustnow::PayjustnowRefundRequest::try_from(req)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -469,12 +588,8 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjust
.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,
- )?)
+ .headers(self.get_headers(req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
.build();
Ok(Some(request))
}
@@ -485,7 +600,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjust
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
- let response: payjustnow::RefundResponse = res
+ let response: payjustnow::PayjustnowRefundResponse = res
.response
.parse_struct("payjustnow RefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -523,9 +638,18 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Payjustno
fn get_url(
&self,
_req: &RefundSyncRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/getstatus", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = payjustnow::PayjustnowSyncRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
@@ -535,13 +659,11 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Payjustno
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Get)
+ .method(Method::Post)
.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,
- )?)
+ .headers(self.get_headers(req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
.build(),
))
}
@@ -552,7 +674,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Payjustno
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
- let response: payjustnow::RefundResponse = res
+ let response: payjustnow::PayjustnowRsyncResponse = res
.response
.parse_struct("payjustnow RefundSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -578,37 +700,145 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Payjustno
impl webhooks::IncomingWebhook for Payjustnow {
fn get_webhook_object_reference_id(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let details: payjustnow::PayjustnowWebhookDetails = request
+ .body
+ .parse_struct("PayjustnowWebhookDetails")
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::ConnectorTransactionId(details.checkout_token),
+ ))
}
fn get_webhook_event_type(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let details: payjustnow::PayjustnowWebhookDetails = request
+ .body
+ .parse_struct("PayjustnowWebhookDetails")
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+ let event_type = match details.checkout_payment_status {
+ payjustnow::PayjustnowWebhookStatus::PaidPendingCallback => {
+ api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess
+ }
+ };
+ Ok(event_type)
}
fn get_webhook_resource_object(
&self,
- _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let details: payjustnow::PayjustnowWebhookDetails = request
+ .body
+ .parse_struct("PayjustnowWebhookDetails")
+ .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
+ Ok(Box::new(details))
+ }
+
+ fn get_webhook_source_verification_algorithm(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
+ Ok(Box::new(crypto::HmacSha256))
+ }
+
+ fn get_webhook_source_verification_signature(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let signature = request
+ .headers
+ .get("x-signature")
+ .ok_or(errors::ConnectorError::WebhookSignatureNotFound)?
+ .to_str()
+ .map_err(|_| errors::ConnectorError::WebhookSignatureNotFound)?
+ .to_string();
+ let decoded_signature = base64::engine::general_purpose::STANDARD
+ .decode(signature)
+ .change_context(errors::ConnectorError::WebhookSignatureNotFound)?;
+ Ok(decoded_signature)
+ }
+
+ fn get_webhook_source_verification_message(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let message = request
+ .body
+ .iter()
+ .filter(|&b| !b.is_ascii_whitespace())
+ .copied()
+ .collect::<Vec<u8>>();
+
+ Ok(message)
+ }
+
+ async fn verify_webhook_source(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
+ connector_account_details: crypto::Encryptable<Secret<serde_json::Value>>,
+ _connector_name: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ let connector_auth_type: ConnectorAuthType = connector_account_details
+ .parse_value("ConnectorAuthType")
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let auth = payjustnow::PayjustnowAuthType::try_from(&connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let signing_key = auth.signing_key.expose().into_bytes();
+ let webhook_secret = api_models::webhooks::ConnectorWebhookSecrets {
+ secret: signing_key.clone(),
+ additional_secret: None,
+ };
+ let signature = self.get_webhook_source_verification_signature(request, &webhook_secret)?;
+ let message =
+ self.get_webhook_source_verification_message(request, merchant_id, &webhook_secret)?;
+ let algorithm = self.get_webhook_source_verification_algorithm(request)?;
+ algorithm
+ .verify_signature(&signing_key, &signature, &message)
+ .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
}
}
+use hyperswitch_domain_models::router_response_types::SupportedPaymentMethodsExt;
static PAYJUSTNOW_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
- LazyLock::new(SupportedPaymentMethods::new);
+ LazyLock::new(|| {
+ let supported_capture_methods = vec![
+ enums::CaptureMethod::Automatic,
+ enums::CaptureMethod::SequentialAutomatic,
+ ];
+
+ let mut payjustnow_supported_payment_methods = SupportedPaymentMethods::new();
+
+ payjustnow_supported_payment_methods.add(
+ enums::PaymentMethod::PayLater,
+ enums::PaymentMethodType::Payjustnow,
+ PaymentMethodDetails {
+ mandates: common_enums::FeatureStatus::NotSupported,
+ refunds: common_enums::FeatureStatus::Supported,
+ supported_capture_methods: supported_capture_methods.clone(),
+ specific_features: None,
+ },
+ );
+
+ payjustnow_supported_payment_methods
+ });
static PAYJUSTNOW_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Payjustnow",
- description: "Payjustnow connector",
+ description: "PayJustNow is a South African payment connector that enables customers to split online purchases into three interest-free monthly installments.",
connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
- integration_status: enums::ConnectorIntegrationStatus::Live,
+ integration_status: enums::ConnectorIntegrationStatus::Sandbox,
};
-static PAYJUSTNOW_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+static PAYJUSTNOW_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];
impl ConnectorSpecifications for Payjustnow {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
diff --git a/crates/hyperswitch_connectors/src/connectors/payjustnow/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payjustnow/transformers.rs
index 817ed9a4d9..11bb1d17f7 100644
--- a/crates/hyperswitch_connectors/src/connectors/payjustnow/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payjustnow/transformers.rs
@@ -1,27 +1,34 @@
use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_utils::{pii, request::Method, types::MinorUnit};
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},
+ router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsSyncRouterData,
+ RefundsRouterData,
+ },
};
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
-use crate::types::{RefundsResponseRouterData, ResponseRouterData};
+use crate::{
+ types::{self, RefundsResponseRouterData},
+ utils::{PaymentsAuthorizeRequestData, PaymentsSyncRequestData, RouterData as _},
+};
+
+const NO_REFUND_REASON: &str = "No reason provided";
//TODO: Fill the struct with respective fields
pub struct PayjustnowRouterData<T> {
- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
pub router_data: T,
}
-impl<T> From<(StringMinorUnit, T)> for PayjustnowRouterData<T> {
- fn from((amount, item): (StringMinorUnit, T)) -> Self {
+impl<T> From<(MinorUnit, T)> for PayjustnowRouterData<T> {
+ fn from((amount, item): (MinorUnit, T)) -> Self {
//Todo : use utils to convert the amount to the type of amount that a connector accepts
Self {
amount,
@@ -30,20 +37,53 @@ impl<T> From<(StringMinorUnit, T)> for PayjustnowRouterData<T> {
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, PartialEq)]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
pub struct PayjustnowPaymentsRequest {
- amount: StringMinorUnit,
- card: PayjustnowCard,
+ payjustnow: PayjustnowRequest,
+ checkout_total_cents: MinorUnit,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowRequest {
+ request_id: Option<String>,
+ merchant_order_reference: String,
+ order_amount_cents: MinorUnit,
+ order_items: Option<Vec<OrderItem>>,
+ customer: Option<Customer>,
+ billing_address: Option<Address>,
+ shipping_address: Option<Address>,
+ confirm_redirect_url: String,
+ cancel_redirect_url: String,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OrderItem {
+ name: String,
+ sku: String,
+ quantity: u32,
+ price_cents: MinorUnit,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Customer {
+ first_name: Option<Secret<String>>,
+ last_name: Option<Secret<String>>,
+ email: pii::Email,
+ phone_number: Option<Secret<String>>,
}
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct PayjustnowCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Address {
+ address_line1: Option<Secret<String>>,
+ address_line2: Option<Secret<String>>,
+ city: Option<String>,
+ province: Option<Secret<String>>,
+ postal_code: Option<Secret<String>>,
}
impl TryFrom<&PayjustnowRouterData<&PaymentsAuthorizeRouterData>> for PayjustnowPaymentsRequest {
@@ -51,77 +91,229 @@ impl TryFrom<&PayjustnowRouterData<&PaymentsAuthorizeRouterData>> for Payjustnow
fn try_from(
item: &PayjustnowRouterData<&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()),
- }
+ let router_data = item.router_data;
+ let order_items = router_data
+ .request
+ .order_details
+ .as_ref()
+ .map(|order_details| {
+ order_details
+ .iter()
+ .map(|order| {
+ Ok(OrderItem {
+ name: order.product_name.clone(),
+ sku: order.product_id.clone().unwrap_or_default(),
+ quantity: u32::from(order.quantity),
+ price_cents: order.amount,
+ })
+ })
+ .collect::<Result<Vec<OrderItem>, errors::ConnectorError>>()
+ })
+ .transpose()?;
+
+ let customer = router_data
+ .get_optional_billing_email()
+ .or_else(|| item.router_data.request.email.clone())
+ .map(|email| Customer {
+ first_name: router_data.get_optional_billing_first_name(),
+ last_name: router_data.get_optional_billing_last_name(),
+ email,
+ phone_number: router_data.get_optional_billing_phone_number(),
+ });
+
+ let billing_address = Some(Address {
+ address_line1: router_data.get_optional_billing_line1(),
+ address_line2: router_data.get_optional_billing_line2(),
+ city: router_data.get_optional_billing_city(),
+ province: router_data.get_optional_billing_state(),
+ postal_code: item.router_data.get_optional_billing_zip(),
+ });
+
+ let shipping_address = Some(Address {
+ address_line1: item.router_data.get_optional_shipping_line1(),
+ address_line2: item.router_data.get_optional_shipping_line2(),
+ city: item.router_data.get_optional_shipping_city(),
+ province: item.router_data.get_optional_shipping_state(),
+ postal_code: item.router_data.get_optional_shipping_zip(),
+ });
+
+ let router_return_url = item.router_data.request.get_router_return_url()?;
+
+ let payjustnow_request = PayjustnowRequest {
+ request_id: Some(item.router_data.payment_id.clone()),
+ merchant_order_reference: router_data.connector_request_reference_id.clone(),
+ order_amount_cents: item.amount,
+ order_items,
+ customer,
+ billing_address,
+ shipping_address,
+ confirm_redirect_url: router_return_url.clone(),
+ cancel_redirect_url: router_return_url,
+ };
+
+ Ok(Self {
+ payjustnow: payjustnow_request,
+ checkout_total_cents: item.amount,
+ })
}
}
//TODO: Fill the struct with respective fields
// Auth Struct
pub struct PayjustnowAuthType {
- pub(super) api_key: Secret<String>,
+ pub(super) merchant_account_id: Secret<String>,
+ pub(super) signing_key: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for PayjustnowAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_owned(),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+ signing_key: api_key.to_owned(),
+ merchant_account_id: key1.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 PayjustnowPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowPaymentsResponse {
+ payment_url: String,
+ checkout_token: String,
}
-impl From<PayjustnowPaymentStatus> for common_enums::AttemptStatus {
- fn from(item: PayjustnowPaymentStatus) -> Self {
+impl<F, T>
+ TryFrom<types::ResponseRouterData<F, PayjustnowPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<F, PayjustnowPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let redirection_data = url::Url::parse(&item.response.payment_url.clone())
+ .ok()
+ .map(|url| RedirectForm::from((url, Method::Get)));
+ Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.checkout_token),
+ redirection_data: Box::new(redirection_data),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowSyncRequest {
+ checkout_token: String,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowCancelRequest {
+ checkout_token: String,
+}
+
+impl TryFrom<&PaymentsCancelRouterData> for PayjustnowCancelRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &PaymentsCancelRouterData) -> Result<Self, Self::Error> {
+ Ok(Self {
+ checkout_token: item.request.connector_transaction_id.clone(),
+ })
+ }
+}
+
+impl TryFrom<&PaymentsSyncRouterData> for PayjustnowSyncRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &PaymentsSyncRouterData) -> Result<Self, Self::Error> {
+ let checkout_token = item.request.get_connector_transaction_id()?;
+ Ok(Self { checkout_token })
+ }
+}
+
+impl TryFrom<&RefundsRouterData<RSync>> for PayjustnowSyncRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &RefundsRouterData<RSync>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ checkout_token: item.request.connector_transaction_id.clone(),
+ })
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayjustnowCheckoutStatus {
+ PendingOrder,
+ PendingPayment,
+ PaidPendingCallback,
+ Paid,
+ CancelledByMerchant,
+ CancelledByConsumer,
+ Expired,
+}
+
+impl From<PayjustnowCheckoutStatus> for enums::AttemptStatus {
+ fn from(item: PayjustnowCheckoutStatus) -> Self {
match item {
- PayjustnowPaymentStatus::Succeeded => Self::Charged,
- PayjustnowPaymentStatus::Failed => Self::Failure,
- PayjustnowPaymentStatus::Processing => Self::Authorizing,
+ PayjustnowCheckoutStatus::Paid | PayjustnowCheckoutStatus::PaidPendingCallback => {
+ Self::Charged
+ }
+ PayjustnowCheckoutStatus::PendingOrder | PayjustnowCheckoutStatus::PendingPayment => {
+ Self::AuthenticationPending
+ }
+ PayjustnowCheckoutStatus::CancelledByMerchant
+ | PayjustnowCheckoutStatus::CancelledByConsumer => Self::Voided,
+ PayjustnowCheckoutStatus::Expired => Self::Failure,
}
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct PayjustnowPaymentsResponse {
- status: PayjustnowPaymentStatus,
- id: String,
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowSyncResponse {
+ checkout_token: String,
+ payment_url: Option<String>,
+ checkout_payment_status: PayjustnowCheckoutStatus,
+ payment_reference: Option<i64>,
}
-impl<F, T> TryFrom<ResponseRouterData<F, PayjustnowPaymentsResponse, T, PaymentsResponseData>>
+impl<F, T> TryFrom<types::ResponseRouterData<F, PayjustnowSyncResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: ResponseRouterData<F, PayjustnowPaymentsResponse, T, PaymentsResponseData>,
+ item: types::ResponseRouterData<F, PayjustnowSyncResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
+ let status = enums::AttemptStatus::from(item.response.checkout_payment_status);
+ let redirection_data = item.response.payment_url.and_then(|url_string| {
+ url::Url::parse(&url_string)
+ .ok()
+ .map(|url| RedirectForm::from((url, Method::Get)))
+ });
+
Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
+ status,
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
- redirection_data: Box::new(None),
+ resource_id: ResponseId::ConnectorTransactionId(item.response.checkout_token),
+ redirection_data: Box::new(redirection_data),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: item
+ .response
+ .payment_reference
+ .map(|id| id.to_string()),
incremental_authorization_allowed: None,
charges: None,
}),
@@ -133,73 +325,135 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayjustnowPaymentsResponse, T, Payments
//TODO: Fill the struct with respective fields
// REFUND :
// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
pub struct PayjustnowRefundRequest {
- pub amount: StringMinorUnit,
+ request_id: Option<String>,
+ checkout_token: String,
+ merchant_refund_reference: String,
+ refund_amount_cents: MinorUnit,
+ refund_description: String,
}
-impl<F> TryFrom<&PayjustnowRouterData<&RefundsRouterData<F>>> for PayjustnowRefundRequest {
+impl<F> TryFrom<&RefundsRouterData<F>> for PayjustnowRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &PayjustnowRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ fn try_from(item: &RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
- amount: item.amount.to_owned(),
+ request_id: Some(item.request.refund_id.clone()),
+ checkout_token: item.request.connector_transaction_id.clone(),
+ merchant_refund_reference: item.request.refund_id.clone(),
+ refund_amount_cents: item.request.minor_refund_amount,
+ refund_description: item
+ .request
+ .reason
+ .clone()
+ .unwrap_or(NO_REFUND_REASON.to_string()),
})
}
}
// Type definition for Refund Response
-#[allow(dead_code)]
-#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum RefundStatus {
- Succeeded,
+ Success,
Failed,
- #[default]
- Processing,
}
impl From<RefundStatus> for enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
- RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Success => 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,
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowRefundResponse {
+ request_id: String,
+ refunded_amount_cents: MinorUnit,
+ refund_status: RefundStatus,
+ refund_status_at: String,
+ refund_status_description: String,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, PayjustnowRefundResponse>>
+ for RefundsRouterData<Execute>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, PayjustnowRefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.request_id,
+ refund_status: enums::RefundStatus::from(item.response.refund_status),
+ }),
+ ..item.data
+ })
+ }
}
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+impl TryFrom<RefundsResponseRouterData<RSync, PayjustnowRefundResponse>>
+ for RefundsRouterData<RSync>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<Execute, RefundResponse>,
+ item: RefundsResponseRouterData<RSync, PayjustnowRefundResponse>,
) -> 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),
+ connector_refund_id: item.response.request_id,
+ refund_status: enums::RefundStatus::from(item.response.refund_status),
}),
..item.data
})
}
}
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayjustnowRsyncStatus {
+ FullyRefunded,
+ PartiallyRefunded,
+ PaidPendingCallback,
+ Paid,
+}
+
+impl From<PayjustnowRsyncStatus> for enums::RefundStatus {
+ fn from(item: PayjustnowRsyncStatus) -> Self {
+ match item {
+ PayjustnowRsyncStatus::FullyRefunded | PayjustnowRsyncStatus::PartiallyRefunded => {
+ Self::Success
+ }
+ PayjustnowRsyncStatus::Paid | PayjustnowRsyncStatus::PaidPendingCallback => {
+ Self::Failure
+ }
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowRsyncResponse {
+ request_id: String,
+ checkout_payment_status: PayjustnowRsyncStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, PayjustnowRsyncResponse>>
+ for RefundsRouterData<RSync>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<RSync, RefundResponse>,
+ item: RefundsResponseRouterData<RSync, PayjustnowRsyncResponse>,
) -> 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),
+ connector_refund_id: item.response.request_id.clone(),
+ refund_status: enums::RefundStatus::from(item.response.checkout_payment_status),
}),
..item.data
})
@@ -209,11 +463,20 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouter
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct PayjustnowErrorResponse {
- 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>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum PayjustnowWebhookStatus {
+ PaidPendingCallback,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PayjustnowWebhookDetails {
+ pub checkout_token: String,
+ pub checkout_payment_status: PayjustnowWebhookStatus,
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
index 5e9ec6bbed..fad101fff5 100644
--- a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
@@ -1295,7 +1295,8 @@ impl TryFrom<&PaypalRouterData<&PaymentsAuthorizeRouterData>> for PaypalPayments
| enums::PaymentMethodType::Flexiti
| enums::PaymentMethodType::RevolutPay
| enums::PaymentMethodType::Breadpay
- | enums::PaymentMethodType::UpiQr => {
+ | enums::PaymentMethodType::UpiQr
+ | enums::PaymentMethodType::Payjustnow => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("paypal"),
))
@@ -1354,7 +1355,8 @@ impl TryFrom<&PayLaterData> for PaypalPaymentsRequest {
| PayLaterData::FlexitiRedirect {}
| PayLaterData::AlmaRedirect {}
| PayLaterData::AtomeRedirect {}
- | PayLaterData::BreadpayRedirect {} => Err(errors::ConnectorError::NotImplemented(
+ | PayLaterData::BreadpayRedirect {}
+ | PayLaterData::PayjustnowRedirect {} => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into()),
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index 98793e691f..31858fe522 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -313,10 +313,13 @@ impl TryFrom<&PayLaterData> for PaymentMethodType {
| PayLaterData::AtomeRedirect { .. }
| PayLaterData::FlexitiRedirect { .. }
| PayLaterData::KlarnaSdk { .. }
- | PayLaterData::BreadpayRedirect { .. } => Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("Shift4"),
- )
- .into()),
+ | PayLaterData::BreadpayRedirect { .. }
+ | PayLaterData::PayjustnowRedirect { .. } => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Shift4"),
+ )
+ .into())
+ }
}
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
index ce64daa8a7..b509bcd31c 100644
--- a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
@@ -94,7 +94,8 @@ impl TryFrom<(&types::TokenizationRouterData, PayLaterData)> for SquareTokenRequ
| PayLaterData::AlmaRedirect { .. }
| PayLaterData::FlexitiRedirect { .. }
| PayLaterData::AtomeRedirect { .. }
- | PayLaterData::BreadpayRedirect { .. } => {
+ | PayLaterData::BreadpayRedirect { .. }
+ | PayLaterData::PayjustnowRedirect { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Square"),
))?
diff --git a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
index a6588d368e..804d80b07b 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
@@ -821,7 +821,8 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
| enums::PaymentMethodType::Cashapp
| enums::PaymentMethodType::Bluecode
| enums::PaymentMethodType::SepaGuarenteedDebit
- | enums::PaymentMethodType::Oxxo => Err(ConnectorError::NotImplemented(
+ | enums::PaymentMethodType::Oxxo
+ | enums::PaymentMethodType::Payjustnow => Err(ConnectorError::NotImplemented(
get_unimplemented_payment_method_error_message("stripe"),
)
.into()),
@@ -1134,7 +1135,8 @@ impl TryFrom<&PayLaterData> for StripePaymentMethodType {
| PayLaterData::AlmaRedirect {}
| PayLaterData::FlexitiRedirect { .. }
| PayLaterData::AtomeRedirect {}
- | PayLaterData::BreadpayRedirect {} => Err(ConnectorError::NotImplemented(
+ | PayLaterData::BreadpayRedirect {}
+ | PayLaterData::PayjustnowRedirect {} => Err(ConnectorError::NotImplemented(
get_unimplemented_payment_method_error_message("stripe"),
)),
}
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 28350d35b1..a7475255c1 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -769,7 +769,8 @@ impl TryFrom<&PayLaterData> for ZenPaymentsRequest {
| PayLaterData::AlmaRedirect {}
| PayLaterData::FlexitiRedirect {}
| PayLaterData::AtomeRedirect {}
- | PayLaterData::BreadpayRedirect {} => Err(errors::ConnectorError::NotImplemented(
+ | PayLaterData::BreadpayRedirect {}
+ | PayLaterData::PayjustnowRedirect {} => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Zen"),
)
.into()),
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index a7691cd630..ad814b3a3b 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -6153,6 +6153,7 @@ pub enum PaymentMethodDataType {
AtomeRedirect,
Breadpay,
FlexitiRedirect,
+ PayjustnowRedirect,
BancontactCard,
Bizum,
Blik,
@@ -6295,6 +6296,9 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
payment_method_data::PayLaterData::AlmaRedirect {} => Self::AlmaRedirect,
payment_method_data::PayLaterData::AtomeRedirect {} => Self::AtomeRedirect,
payment_method_data::PayLaterData::BreadpayRedirect {} => Self::Breadpay,
+ payment_method_data::PayLaterData::PayjustnowRedirect {} => {
+ Self::PayjustnowRedirect
+ }
},
PaymentMethodData::BankRedirect(bank_redirect_data) => match bank_redirect_data {
payment_method_data::BankRedirectData::BancontactCard { .. } => {
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index f1963d3cb6..b8d89640d9 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -273,6 +273,7 @@ pub enum PayLaterData {
AlmaRedirect {},
AtomeRedirect {},
BreadpayRedirect {},
+ PayjustnowRedirect {},
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
@@ -1400,6 +1401,9 @@ impl From<api_models::payments::PayLaterData> for PayLaterData {
api_models::payments::PayLaterData::AlmaRedirect {} => Self::AlmaRedirect {},
api_models::payments::PayLaterData::AtomeRedirect {} => Self::AtomeRedirect {},
api_models::payments::PayLaterData::BreadpayRedirect {} => Self::BreadpayRedirect {},
+ api_models::payments::PayLaterData::PayjustnowRedirect {} => {
+ Self::PayjustnowRedirect {}
+ }
}
}
}
@@ -2144,6 +2148,7 @@ impl GetPaymentMethodType for PayLaterData {
Self::AlmaRedirect {} => api_enums::PaymentMethodType::Alma,
Self::AtomeRedirect {} => api_enums::PaymentMethodType::Atome,
Self::BreadpayRedirect {} => api_enums::PaymentMethodType::Breadpay,
+ Self::PayjustnowRedirect {} => api_enums::PaymentMethodType::Payjustnow,
}
}
}
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index 9c755f9134..d011086f96 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -36,6 +36,7 @@ fn get_dir_value_payment_method(
api_enums::PaymentMethodType::Klarna => Ok(dirval!(PayLaterType = Klarna)),
api_enums::PaymentMethodType::Flexiti => Ok(dirval!(PayLaterType = Flexiti)),
api_enums::PaymentMethodType::Affirm => Ok(dirval!(PayLaterType = Affirm)),
+ api_enums::PaymentMethodType::Payjustnow => Ok(dirval!(PayLaterType = Payjustnow)),
api_enums::PaymentMethodType::AfterpayClearpay => {
Ok(dirval!(PayLaterType = AfterpayClearpay))
}
diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs
index 41b48c9042..ac0ba56c57 100644
--- a/crates/kgraph_utils/src/transformers.rs
+++ b/crates/kgraph_utils/src/transformers.rs
@@ -144,6 +144,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
api_enums::PaymentMethodType::Eps => Ok(dirval!(BankRedirectType = Eps)),
api_enums::PaymentMethodType::Klarna => Ok(dirval!(PayLaterType = Klarna)),
api_enums::PaymentMethodType::Affirm => Ok(dirval!(PayLaterType = Affirm)),
+ api_enums::PaymentMethodType::Payjustnow => Ok(dirval!(PayLaterType = Payjustnow)),
api_enums::PaymentMethodType::AfterpayClearpay => {
Ok(dirval!(PayLaterType = AfterpayClearpay))
}
diff --git a/crates/payment_methods/src/helpers.rs b/crates/payment_methods/src/helpers.rs
index 5968f82757..ec431bc86c 100644
--- a/crates/payment_methods/src/helpers.rs
+++ b/crates/payment_methods/src/helpers.rs
@@ -100,6 +100,7 @@ pub fn validate_payment_method_type_against_payment_method(
| api_enums::PaymentMethodType::Walley
| api_enums::PaymentMethodType::Breadpay
| api_enums::PaymentMethodType::Flexiti
+ | api_enums::PaymentMethodType::Payjustnow
),
api_enums::PaymentMethod::Wallet => matches!(
payment_method_type,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index ba6295278b..fe0a378a17 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2574,6 +2574,7 @@ pub enum PaymentMethodDataType {
AtomeRedirect,
BreadpayRedirect,
FlexitiRedirect,
+ PayjustnowRedirect,
BancontactCard,
Bizum,
Blik,
@@ -2715,6 +2716,7 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
domain::payments::PayLaterData::FlexitiRedirect {} => Self::FlexitiRedirect,
domain::payments::PayLaterData::AtomeRedirect {} => Self::AtomeRedirect,
domain::payments::PayLaterData::BreadpayRedirect {} => Self::BreadpayRedirect,
+ domain::payments::PayLaterData::PayjustnowRedirect {} => Self::PayjustnowRedirect,
},
domain::payments::PaymentMethodData::BankRedirect(bank_redirect_data) => {
match bank_redirect_data {
diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs
index a38e55e420..df6cedcef8 100644
--- a/crates/router/src/core/connector_validation.rs
+++ b/crates/router/src/core/connector_validation.rs
@@ -401,6 +401,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
payload::transformers::PayloadAuthType::try_from(self.auth_type)?;
Ok(())
}
+ api_enums::Connector::Payjustnow => {
+ payjustnow::transformers::PayjustnowAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Payme => {
payme::transformers::PaymeAuthType::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 f0c4190d87..143086afcc 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -352,6 +352,9 @@ impl ConnectorData {
enums::Connector::Payload => {
Ok(ConnectorEnum::Old(Box::new(connector::Payload::new())))
}
+ enums::Connector::Payjustnow => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Payjustnow::new())))
+ }
enums::Connector::Payme => {
Ok(ConnectorEnum::Old(Box::new(connector::Payme::new())))
}
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index 52c8501ac7..6b9e6b0242 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -273,6 +273,9 @@ impl FeatureMatrixConnectorData {
enums::Connector::Payload => {
Ok(ConnectorEnum::Old(Box::new(connector::Payload::new())))
}
+ enums::Connector::Payjustnow => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Payjustnow::new())))
+ }
enums::Connector::Payme => {
Ok(ConnectorEnum::Old(Box::new(connector::Payme::new())))
}
diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs
index 9b22fc9719..d6709efc8d 100644
--- a/crates/router/src/types/connector_transformers.rs
+++ b/crates/router/src/types/connector_transformers.rs
@@ -114,6 +114,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Nuvei => Self::Nuvei,
api_enums::Connector::Opennode => Self::Opennode,
api_enums::Connector::Paybox => Self::Paybox,
+ api_enums::Connector::Payjustnow => Self::Payjustnow,
api_enums::Connector::Payload => Self::Payload,
api_enums::Connector::Payme => Self::Payme,
api_enums::Connector::Payone => Self::Payone,
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 720b6f5d57..83cc245ea5 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -305,7 +305,8 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::PayBright
| api_enums::PaymentMethodType::Atome
| api_enums::PaymentMethodType::Walley
- | api_enums::PaymentMethodType::Breadpay => Self::PayLater,
+ | api_enums::PaymentMethodType::Breadpay
+ | api_enums::PaymentMethodType::Payjustnow => Self::PayLater,
api_enums::PaymentMethodType::Giropay
| api_enums::PaymentMethodType::Ideal
| api_enums::PaymentMethodType::Sofort
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index b77bcc575e..e8bfbdda15 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -704,6 +704,9 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD
google_pay = { country = "AD, AE, AG, AI, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BZ, CA, CC, CG, CH, CI, CK, CL, CM, CN, CO, CR, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KR, KW, KY, KZ, LA, LC, LI, LK, LR, LS, LT, LU, LV, MA, MC, MD, ME, MF, MG, MH, MK, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PT, PW, PY, QA, RE, RO, RS, RW, SA, SB, SC, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SR, ST, SV, SX, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TT, TV, TZ, UG, UM, UY, UZ, VA, VC, VG, VI, VN, VU, WF, WS, YT, ZA, ZM, US", currency = "USD, CAD" }
apple_pay = { currency = "USD, CAD" }
+[pm_filters.payjustnow]
+payjustnow = { country = "ZA", currency = "ZAR" }
+
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }