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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(connector): [PayJustNow In-Store] Implement PayJustNow Payment Method (#10745)
Anurag351de53cd8fa
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 243769c61f..8fd2cbdbcc 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -14676,6 +14676,7 @@"payu","peachpayments","payjustnow",+ "payjustnowinstore","phonepe","placetopay","powertranz",@@ -35206,6 +35207,7 @@"payu","peachpayments","payjustnow",+ "payjustnowinstore","phonepe","placetopay","powertranz",diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 9c20779516..34e633dcb1 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -9103,6 +9103,7 @@"payu","peachpayments","payjustnow",+ "payjustnowinstore","phonepe","placetopay","powertranz",@@ -25449,6 +25450,7 @@"payu","peachpayments","payjustnow",+ "payjustnowinstore","phonepe","placetopay","powertranz",diff --git a/config/config.example.toml b/config/config.example.tomlindex f042f60edb..6f5d07c46e 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -994,6 +994,9 @@ apple_pay = { currency = "USD, CAD" }[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.worldpayxml]debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,C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CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" }diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.tomlindex 5e4a0cfa42..826dfc93b7 100644--- a/config/deployments/integration_test.toml+++ b/config/deployments/integration_test.toml@@ -875,6 +875,9 @@ apple_pay = { country = "US,CA,IL,GB", currency = "ILS,USD,EUR" }[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+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.tomlindex 5f5882dac7..1a485aeb38 100644--- a/config/deployments/production.toml+++ b/config/deployments/production.toml@@ -117,7 +117,7 @@ paybox.base_url = "https://ppps.paybox.com/PPPS.php"paybox.secondary_base_url="https://tpeweb.paybox.com/"payeezy.base_url = "https://api.payeezy.com/"payjustnow.base_url = "https://checkout.payjustnow.io/v2"-payjustnowinstore.base_url = "https://sandbox.payjustnow.com/api"+payjustnowinstore.base_url = "https://api.payjustnow.com/api"payload.base_url = "https://api.payload.com"payme.base_url = "https://live.payme.io/"payone.base_url = "https://payment.payone.com/"@@ -864,6 +864,9 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+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.tomlindex 46514832d0..f38bd371e8 100644--- a/config/deployments/sandbox.toml+++ b/config/deployments/sandbox.toml@@ -877,6 +877,9 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+payjustnow = { country = "ZA", currency = "ZAR" }+[payout_method_filters.stripe]ach = { country = "US", currency = "USD" }diff --git a/config/development.toml b/config/development.tomlindex 666695f090..1e86633c9c 100644--- a/config/development.toml+++ b/config/development.toml@@ -1043,6 +1043,9 @@ apple_pay = {country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+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.tomlindex 782e38f156..4d95d18a96 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -1017,6 +1017,9 @@ apple_pay = { currency = "USD, CAD" }[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+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/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rsindex 9c69106ea9..6218c8001d 100644--- a/crates/common_enums/src/connector_enums.rs+++ b/crates/common_enums/src/connector_enums.rs@@ -153,7 +153,7 @@ pub enum Connector {Payu,Peachpayments,Payjustnow,- // Payjustnowinstore,+ Payjustnowinstore,Phonepe,Placetopay,Powertranz,@@ -406,7 +406,7 @@ impl Connector {| Self::Datatrans| Self::Paytm| Self::Payjustnow- // | Self::Payjustnowinstore+ | Self::Payjustnowinstore| Self::Phonepe => false,Self::Checkout |Self::Zift| Self::Nmi |Self::Braintree|Self::Cybersource | Self::Archipel | Self::Nuvei | Self::Adyen => true,diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rsindex 3fee2231dc..9d586d70fd 100644--- a/crates/connector_configs/src/connector.rs+++ b/crates/connector_configs/src/connector.rs@@ -628,7 +628,7 @@ impl ConnectorConfig {Connector::Zift => Ok(connector_data.zift),Connector::Phonepe => Ok(connector_data.phonepe),Connector::Payjustnow => Ok(connector_data.payjustnow),- // Connector::Payjustnowinstore => Ok(connector_data.Payjustnowinstore),+ Connector::Payjustnowinstore => Ok(connector_data.payjustnowinstore),}}}diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.tomlindex b2c097d1f1..401ab0b091 100644--- a/crates/connector_configs/toml/development.toml+++ b/crates/connector_configs/toml/development.toml@@ -7895,5 +7895,8 @@ api_key = "API Key"api_secret="Vault Id"[payjustnowinstore]-[payjustnowinstore.connector_auth.HeaderKey]-api_key = "Merchant Terminal Id"+[payjustnowinstore.connector_auth.BodyKey]+ api_key = "Merchant API Key"+ key1 = "Merchant Terminal Id"+[[payjustnowinstore.pay_later]]+ payment_method_type = "payjustnow"\ No newline at end of filediff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.tomlindex 0b4cf998b0..45730d80cc 100644--- a/crates/connector_configs/toml/production.toml+++ b/crates/connector_configs/toml/production.toml@@ -6776,5 +6776,8 @@ api_key = "API Key"api_secret="Vault Id"[payjustnowinstore]-[payjustnowinstore.connector_auth.HeaderKey]-api_key = "Merchant Terminal Id"+[payjustnowinstore.connector_auth.BodyKey]+ api_key = "Merchant API Key"+ key1 = "Merchant Terminal Id"+[[payjustnowinstore.pay_later]]+ payment_method_type = "payjustnow"diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.tomlindex 9389f02637..1d8fcafa9a 100644--- a/crates/connector_configs/toml/sandbox.toml+++ b/crates/connector_configs/toml/sandbox.toml@@ -7867,5 +7867,8 @@ api_key = "API Key"api_secret="Vault Id"[payjustnowinstore]-[payjustnowinstore.connector_auth.HeaderKey]-api_key = "Merchant Terminal Id"+[payjustnowinstore.connector_auth.BodyKey]+ api_key = "Merchant API Key"+ key1 = "Merchant Terminal Id"+[[payjustnowinstore.pay_later]]+ payment_method_type = "payjustnow"diff --git a/crates/euclid/src/enums.rs b/crates/euclid/src/enums.rsindex 347c9b9b68..2a49afd742 100644--- a/crates/euclid/src/enums.rs+++ b/crates/euclid/src/enums.rs@@ -308,7 +308,7 @@ pub enum RoutableConnectors {Payu,Peachpayments,Payjustnow,- // Payjustnowinstore,+ Payjustnowinstore,Phonepe,Placetopay,Powertranz,@@ -494,7 +494,7 @@ impl TryFrom<Connector> for RoutableConnectors {Connector::Paytm => Ok(Self::Paytm),Connector::Phonepe => Ok(Self::Phonepe),Connector::Payjustnow => Ok(Self::Payjustnow),- // Connector::Payjustnowinstore => Ok(Self::Payjustnowinstore),+ Connector::Payjustnowinstore => Ok(Self::Payjustnowinstore),Connector::CtpMastercard| Connector::Gpayments| Connector::HyperswitchVault@@ -647,7 +647,7 @@ impl From<RoutableConnectors> for Connector {RoutableConnectors::Paytm => Self::Paytm,RoutableConnectors::Phonepe => Self::Phonepe,RoutableConnectors::Payjustnow => Self::Payjustnow,- // RoutableConnectors::Payjustnowinstore => Self::Payjustnowinstore,+ RoutableConnectors::Payjustnowinstore => Self::Payjustnowinstore,RoutableConnectors::Juspaythreedsserver => Self::Juspaythreedsserver,RoutableConnectors::CtpMastercard => Self::CtpMastercard,RoutableConnectors::CtpVisa => Self::CtpVisa,diff --git a/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs b/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rsindex 13a9dd36a3..8790b3699d 100644--- a/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs+++ b/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs@@ -11,7 +11,6 @@ use common_utils::{};use error_stack::{report, ResultExt};use hyperswitch_domain_models::{- payment_method_data::PaymentMethodData,router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},router_flow_types::{access_token_auth::AccessTokenAuth,@@ -24,11 +23,12 @@ use hyperswitch_domain_models::{RefundsData, SetupMandateRequestData,},router_response_types::{- ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods,+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,+ SupportedPaymentMethods, SupportedPaymentMethodsExt,},types::{PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,- RefundSyncRouterData, RefundsRouterData,+ RefundsRouterData,},};use hyperswitch_interfaces::{@@ -37,16 +37,21 @@ use hyperswitch_interfaces::{ConnectorValidation,},configs::Connectors,+ consts::NO_ERROR_MESSAGE,errors,events::connector_api_logs::ConnectorEvent,types::{self, Response},webhooks,};-use masking::{ExposeInterface, Mask};+use masking::{ExposeInterface, Mask, PeekInterface};+use ring::hmac;use transformers as payjustnowinstore;use crate::{constants::headers, types::ResponseRouterData, utils};+const PAYJUSTNOWINSTORE_MERCHANT_TERMINAL_ID: &str = "X-PayJustNow-Merchant-Terminal-ID";+const SIGNATURE: &str = "X-Signature";+#[derive(Clone)]pub struct Payjustnowinstore {amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),@@ -76,7 +81,6 @@ impl api::PaymentToken for Payjustnowinstore {}impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>for Payjustnowinstore{- // Not Implemented (R)}impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Payjustnowinstore@@ -86,12 +90,33 @@ wherefn 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 = payjustnowinstore::PayjustnowinstoreAuthType::try_from(&req.connector_auth_type)+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;++ let key = hmac::Key::new(hmac::HMAC_SHA256, auth.merchant_api_key.expose().as_bytes());++ let signature = hmac::sign(&key, request_body_string_without_whitespace.as_bytes());++ let signature_hex = hex::encode(signature.as_ref());++ let mut header = vec![+ (+ headers::CONTENT_TYPE.to_string(),+ self.get_content_type().to_string().into(),+ ),+ (SIGNATURE.to_string(), signature_hex.into_masked()),+ ];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);Ok(header)@@ -122,8 +147,8 @@ impl ConnectorCommon for Payjustnowinstore {let auth = payjustnowinstore::PayjustnowinstoreAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;Ok(vec![(- headers::AUTHORIZATION.to_string(),- auth.api_key.expose().into_masked(),+ PAYJUSTNOWINSTORE_MERCHANT_TERMINAL_ID.to_string(),+ auth.merchant_terminal_id.expose().into_masked(),)])}@@ -140,11 +165,19 @@ impl ConnectorCommon for Payjustnowinstore {event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);+ let error_message = match res.status_code {+ 400 => "bad_request",+ 401 => "unauthorized",+ 403 => "forbidden",+ 404 => "not_found",+ _ => NO_ERROR_MESSAGE,+ };+Ok(ErrorResponse {status_code: res.status_code,- code: response.code,- message: response.message,- reason: response.reason,+ code: res.status_code.to_string(),+ message: response.error.clone().unwrap_or(error_message.to_string()),+ reason: response.error,attempt_status: None,connector_transaction_id: None,network_advice_code: None,@@ -155,36 +188,11 @@ impl ConnectorCommon for Payjustnowinstore {}}-impl ConnectorValidation for Payjustnowinstore {- fn validate_mandate_payment(- &self,- _pm_type: Option<enums::PaymentMethodType>,- pm_data: PaymentMethodData,- ) -> CustomResult<(), errors::ConnectorError> {- match pm_data {- PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(- "validate_mandate_payment does not support cards".to_string(),- )- .into()),- _ => Ok(()),- }- }-- fn validate_psync_reference_id(- &self,- _data: &PaymentsSyncData,- _is_three_ds: bool,- _status: enums::AttemptStatus,- _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,- ) -> CustomResult<(), errors::ConnectorError> {- Ok(())- }-}+impl ConnectorValidation for Payjustnowinstore {}impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData>for Payjustnowinstore{- //TODO: implement sessions flow}impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>@@ -215,9 +223,12 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseDatafn 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!(+ "{}/v1/merchant/pos/checkout",+ self.base_url(connectors)+ ))}fn get_request_body(@@ -303,10 +314,19 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Payfn get_url(&self,- _req: &PaymentsSyncRouterData,- _connectors: &Connectors,+ req: &PaymentsSyncRouterData,+ connectors: &Connectors,) -> CustomResult<String, errors::ConnectorError> {- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())+ let connector_transaction_id = req+ .request+ .connector_transaction_id+ .get_connector_transaction_id()+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;+ Ok(format!(+ "{}/v1/merchant/pos/checkout/{}",+ self.base_url(connectors),+ connector_transaction_id,+ ))}fn build_request(@@ -330,7 +350,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Payevent_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {- let response: payjustnowinstore::PayjustnowinstorePaymentsResponse = res+ let response: payjustnowinstore::PayjustnowinstoreSyncResponse = res.response.parse_struct("payjustnowinstore PaymentsSyncResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;@@ -355,79 +375,16 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Payimpl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData>for Payjustnowinstore{- fn get_headers(- &self,- req: &PaymentsCaptureRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &PaymentsCaptureRouterData,- _connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())- }-- fn get_request_body(+ fn build_request(&self,_req: &PaymentsCaptureRouterData,_connectors: &Connectors,- ) -> CustomResult<RequestContent, errors::ConnectorError> {- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())- }-- fn build_request(- &self,- req: &PaymentsCaptureRouterData,- connectors: &Connectors,) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Post)- .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)- .attach_default_headers()- .headers(types::PaymentsCaptureType::get_headers(- self, req, connectors,- )?)- .set_body(types::PaymentsCaptureType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &PaymentsCaptureRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {- let response: payjustnowinstore::PayjustnowinstorePaymentsResponse = res- .response- .parse_struct("Payjustnowinstore PaymentsCaptureResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)+ Err(errors::ConnectorError::NotSupported {+ message: "Capture".to_string(),+ connector: "Payjustnowinstore",+ }+ .into())}}@@ -449,9 +406,12 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjustfn 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!(+ "{}/v2/merchant/pos/checkout/refund",+ self.base_url(connectors)+ ))}fn get_request_body(@@ -497,7 +457,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjustevent_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {- let response: payjustnowinstore::RefundResponse = res+ let response: payjustnowinstore::PayjustnowinstoreRefundResponse = res.response.parse_struct("payjustnowinstore RefundResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;@@ -519,72 +479,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Payjust}}-impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Payjustnowinstore {- fn get_headers(- &self,- req: &RefundSyncRouterData,- connectors: &Connectors,- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {- self.build_headers(req, connectors)- }-- fn get_content_type(&self) -> &'static str {- self.common_get_content_type()- }-- fn get_url(- &self,- _req: &RefundSyncRouterData,- _connectors: &Connectors,- ) -> CustomResult<String, errors::ConnectorError> {- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())- }-- fn build_request(- &self,- req: &RefundSyncRouterData,- connectors: &Connectors,- ) -> CustomResult<Option<Request>, errors::ConnectorError> {- Ok(Some(- RequestBuilder::new()- .method(Method::Get)- .url(&types::RefundSyncType::get_url(self, req, connectors)?)- .attach_default_headers()- .headers(types::RefundSyncType::get_headers(self, req, connectors)?)- .set_body(types::RefundSyncType::get_request_body(- self, req, connectors,- )?)- .build(),- ))- }-- fn handle_response(- &self,- data: &RefundSyncRouterData,- event_builder: Option<&mut ConnectorEvent>,- res: Response,- ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {- let response: payjustnowinstore::RefundResponse = res- .response- .parse_struct("payjustnowinstore RefundSyncResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- event_builder.map(|i| i.set_response_body(&response));- router_env::logger::info!(connector_response=?response);- RouterData::try_from(ResponseRouterData {- response,- data: data.clone(),- http_code: res.status_code,- })- }-- fn get_error_response(- &self,- res: Response,- event_builder: Option<&mut ConnectorEvent>,- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res, event_builder)- }-}+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Payjustnowinstore {}#[async_trait::async_trait]impl webhooks::IncomingWebhook for Payjustnowinstore {@@ -611,13 +506,33 @@ impl webhooks::IncomingWebhook for Payjustnowinstore {}static PAYJUSTNOWINSTORE_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 PAYJUSTNOWINSTORE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {- display_name: "Payjustnowinstore",- description: "Payjustnowinstore connector",+ display_name: "PayJustNow In-Store",+ description: "PayJustNow provides a BNPL solution for online and in-store payments, enabling customers to pay in three interest-free installments while merchants get paid upfront.",connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,- integration_status: enums::ConnectorIntegrationStatus::Live,+ integration_status: enums::ConnectorIntegrationStatus::Alpha,};static PAYJUSTNOWINSTORE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];diff --git a/crates/hyperswitch_connectors/src/connectors/payjustnowinstore/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payjustnowinstore/transformers.rsindex bca23cac6d..3e68b0bc0f 100644--- a/crates/hyperswitch_connectors/src/connectors/payjustnowinstore/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/payjustnowinstore/transformers.rs@@ -1,28 +1,32 @@use common_enums::enums;-use common_utils::types::MinorUnit;+use common_utils::{ext_traits::ValueExt, request::Method, types::MinorUnit};+use error_stack::ResultExt;use hyperswitch_domain_models::{- payment_method_data::PaymentMethodData,- router_data::{ConnectorAuthType, RouterData},- router_flow_types::refunds::{Execute, RSync},+ router_data::{ConnectorAuthType, ErrorResponse, RouterData},+ router_flow_types::refunds::Execute,router_request_types::ResponseId,- router_response_types::{PaymentsResponseData, RefundsResponseData},+ router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},types::{PaymentsAuthorizeRouterData, RefundsRouterData},};-use hyperswitch_interfaces::errors;+use hyperswitch_interfaces::{+ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},+ errors,+};use masking::Secret;use serde::{Deserialize, Serialize};-use crate::types::{RefundsResponseRouterData, ResponseRouterData};+use crate::{+ types::{RefundsResponseRouterData, ResponseRouterData},+ utils,+};-//TODO: Fill the struct with respective fieldspub struct PayjustnowinstoreRouterData<T> {- pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.+ pub amount: MinorUnit,pub router_data: T,}impl<T> From<(MinorUnit, T)> for PayjustnowinstoreRouterData<T> {fn from((amount, item): (MinorUnit, T)) -> Self {- //Todo : use utils to convert the amount to the type of amount that a connector acceptsSelf {amount,router_data: item,@@ -30,20 +34,39 @@ impl<T> From<(MinorUnit, T)> for PayjustnowinstoreRouterData<T> {}}-//TODO: Fill the struct with respective fields-#[derive(Default, Debug, Serialize, PartialEq)]+pub struct PayjustnowinstoreAuthType {+ pub(super) merchant_api_key: Secret<String>,+ pub(super) merchant_terminal_id: Secret<String>,+}++impl TryFrom<&ConnectorAuthType> for PayjustnowinstoreAuthType {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {+ match auth_type {+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {+ merchant_api_key: api_key.to_owned(),+ merchant_terminal_id: key1.to_owned(),+ }),+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),+ }+ }+}++#[derive(Debug, Serialize, PartialEq)]pub struct PayjustnowinstorePaymentsRequest {amount: MinorUnit,- card: PayjustnowinstoreCard,+ currency: common_enums::Currency,+ merchant_reference: String,+ callback_url: String,+ items: Vec<OrderItem>,}-#[derive(Default, Debug, Serialize, Eq, PartialEq)]-pub struct PayjustnowinstoreCard {- number: cards::CardNumber,- expiry_month: Secret<String>,- expiry_year: Secret<String>,- cvc: Secret<String>,- complete: bool,+#[derive(Debug, Serialize, PartialEq)]+pub struct OrderItem {+ name: String,+ sku: Option<String>,+ quantity: u32,+ price: MinorUnit,}impl TryFrom<&PayjustnowinstoreRouterData<&PaymentsAuthorizeRouterData>>@@ -53,92 +76,195 @@ impl TryFrom<&PayjustnowinstoreRouterData<&PaymentsAuthorizeRouterData>>fn try_from(item: &PayjustnowinstoreRouterData<&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 items = item+ .router_data+ .request+ .order_details+ .as_ref()+ .map(|order_details| {+ order_details+ .iter()+ .map(|order| {+ let product_name = order.product_name.trim();+ if product_name.is_empty() {+ return Err(errors::ConnectorError::MissingRequiredField {+ field_name: "order_details[].product_name",+ });+ }+ let sku = order.product_id.as_ref().and_then(|id| {+ let trimmed = id.trim();+ if trimmed.is_empty() {+ None+ } else {+ Some(trimmed.to_string())+ }+ });++ Ok(OrderItem {+ name: product_name.to_string(),+ sku,+ quantity: u32::from(order.quantity),+ price: order.amount,+ })+ })+ .collect::<Result<Vec<OrderItem>, errors::ConnectorError>>()+ })+ .transpose()?+ .unwrap_or_default();++ Ok(Self {+ amount: item.amount,+ currency: item.router_data.request.currency,+ merchant_reference: item+ .router_data+ .request+ .merchant_order_reference_id+ .clone()+ .unwrap_or(item.router_data.payment_id.clone()),+ // Webhooks are not implemented yet for PJN In-Store, and `callback_url` is a mandatory field.+ // Since PJN Instore does not accept null or empty values, a placeholder is used here.+ callback_url: "callback_url".to_string(),+ items,+ })}}-//TODO: Fill the struct with respective fields-// Auth Struct-pub struct PayjustnowinstoreAuthType {- pub(super) api_key: Secret<String>,+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]+pub struct PayjustnowinstorePaymentsResponse {+ token: String,+ amount: MinorUnit,+ scan_url: url::Url,}-impl TryFrom<&ConnectorAuthType> for PayjustnowinstoreAuthType {+impl<F, T>+ TryFrom<ResponseRouterData<F, PayjustnowinstorePaymentsResponse, T, PaymentsResponseData>>+ for RouterData<F, T, PaymentsResponseData>+{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(),+ fn try_from(+ item: ResponseRouterData<F, PayjustnowinstorePaymentsResponse, T, PaymentsResponseData>,+ ) -> Result<Self, Self::Error> {+ let redirection_data = Some(RedirectForm::from((item.response.scan_url, Method::Get)));++ Ok(Self {+ status: common_enums::AttemptStatus::AuthenticationPending,+ response: Ok(PaymentsResponseData::TransactionResponse {+ resource_id: ResponseId::ConnectorTransactionId(item.response.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,}),- _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),- }+ ..item.data+ })}}-// PaymentsResponse-//TODO: Append the remaining status flags+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]-#[serde(rename_all = "lowercase")]+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub enum PayjustnowinstorePaymentStatus {- Succeeded,- Failed,#[default]- Processing,+ Pending,+ Paid,+ PaymentFailed,+ OrderCancelled,+ OrderRefunded,}impl From<PayjustnowinstorePaymentStatus> for common_enums::AttemptStatus {fn from(item: PayjustnowinstorePaymentStatus) -> Self {match item {- PayjustnowinstorePaymentStatus::Succeeded => Self::Charged,- PayjustnowinstorePaymentStatus::Failed => Self::Failure,- PayjustnowinstorePaymentStatus::Processing => Self::Authorizing,+ PayjustnowinstorePaymentStatus::Pending => Self::AuthenticationPending,+ PayjustnowinstorePaymentStatus::Paid => Self::Charged,+ PayjustnowinstorePaymentStatus::PaymentFailed => Self::Failure,+ PayjustnowinstorePaymentStatus::OrderCancelled => Self::Voided,+ PayjustnowinstorePaymentStatus::OrderRefunded => Self::AutoRefunded,}}}-//TODO: Fill the struct with respective fields-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]-pub struct PayjustnowinstorePaymentsResponse {- status: PayjustnowinstorePaymentStatus,- id: String,+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct PayjustnowinstoreSyncResponse {+ merchant_reference: String,+ token: String,+ scan_url: Option<url::Url>,+ payment_status: PayjustnowinstorePaymentStatus,+ amount: Option<MinorUnit>,+ reason: Option<String>,+ paid_at: Option<String>,+ cancelled_at: Option<String>,}-impl<F, T>- TryFrom<ResponseRouterData<F, PayjustnowinstorePaymentsResponse, T, PaymentsResponseData>>+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct PayjustnowinstorePaymentsResponseMetadata {+ merchant_reference: String,+}++impl<F, T> TryFrom<ResponseRouterData<F, PayjustnowinstoreSyncResponse, T, PaymentsResponseData>>for RouterData<F, T, PaymentsResponseData>{type Error = error_stack::Report<errors::ConnectorError>;fn try_from(- item: ResponseRouterData<F, PayjustnowinstorePaymentsResponse, T, PaymentsResponseData>,+ item: ResponseRouterData<F, PayjustnowinstoreSyncResponse, T, PaymentsResponseData>,) -> Result<Self, Self::Error> {- Ok(Self {- status: common_enums::AttemptStatus::from(item.response.status),- response: Ok(PaymentsResponseData::TransactionResponse {- resource_id: ResponseId::ConnectorTransactionId(item.response.id),- redirection_data: Box::new(None),- mandate_reference: Box::new(None),+ let status = enums::AttemptStatus::from(item.response.payment_status);+ let redirection_data = item+ .response+ .scan_url+ .map(|url| RedirectForm::from((url, Method::Get)));++ let response = if utils::is_payment_failure(status) {+ Err(ErrorResponse {+ code: NO_ERROR_CODE.to_string(),+ message: item+ .response+ .reason+ .clone()+ .unwrap_or(NO_ERROR_MESSAGE.to_string()),+ reason: item.response.reason.clone(),+ status_code: item.http_code,+ attempt_status: Some(status),+ connector_transaction_id: Some(item.response.token.clone()),+ network_decline_code: None,+ network_advice_code: None,+ network_error_message: None,connector_metadata: None,+ })+ } else {+ let connector_metadata = Some(serde_json::json!(+ PayjustnowinstorePaymentsResponseMetadata {+ merchant_reference: item.response.merchant_reference,+ }+ ));+ Ok(PaymentsResponseData::TransactionResponse {+ resource_id: ResponseId::ConnectorTransactionId(item.response.token),+ redirection_data: Box::new(redirection_data),+ mandate_reference: Box::new(None),+ connector_metadata,network_txn_id: None,connector_response_reference_id: None,incremental_authorization_allowed: None,charges: None,- }),+ })+ };++ Ok(Self {+ status,+ response,..item.data})}}-//TODO: Fill the struct with respective fields-// REFUND :-// Type definition for RefundRequest#[derive(Default, Debug, Serialize)]pub struct PayjustnowinstoreRefundRequest {- pub amount: MinorUnit,+ request_id: String,+ merchant_reference: String,+ token: String,+ amount: MinorUnit,}impl<F> TryFrom<&PayjustnowinstoreRouterData<&RefundsRouterData<F>>>@@ -148,79 +274,90 @@ impl<F> TryFrom<&PayjustnowinstoreRouterData<&RefundsRouterData<F>>>fn try_from(item: &PayjustnowinstoreRouterData<&RefundsRouterData<F>>,) -> Result<Self, Self::Error> {+ let metadata: PayjustnowinstorePaymentsResponseMetadata = item+ .router_data+ .request+ .connector_metadata+ .as_ref()+ .ok_or(errors::ConnectorError::NoConnectorMetaData)?+ .clone()+ .parse_value("PayjustnowinstorePaymentsResponseMetadata")+ .change_context(errors::ConnectorError::ParsingFailed)?;+Ok(Self {+ request_id: item.router_data.request.refund_id.clone(),+ merchant_reference: metadata.merchant_reference,+ token: item.router_data.request.connector_transaction_id.clone(),amount: item.amount.to_owned(),})}}-// Type definition for Refund Response--#[allow(dead_code)]-#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]-pub enum RefundStatus {- Succeeded,+#[derive(Debug, Clone, Serialize, Deserialize)]+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]+pub enum PayjustnowinstoreRefundStatus {+ Refunded,Failed,- #[default]- Processing,}-impl From<RefundStatus> for enums::RefundStatus {- fn from(item: RefundStatus) -> Self {+impl From<PayjustnowinstoreRefundStatus> for enums::RefundStatus {+ fn from(item: PayjustnowinstoreRefundStatus) -> Self {match item {- RefundStatus::Succeeded => Self::Success,- RefundStatus::Failed => Self::Failure,- RefundStatus::Processing => Self::Pending,- //TODO: Review mapping+ PayjustnowinstoreRefundStatus::Refunded => Self::Success,+ PayjustnowinstoreRefundStatus::Failed => Self::Failure,}}}-//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)]+pub struct PayjustnowinstoreRefundResponse {+ status: PayjustnowinstoreRefundStatus,+ reason: Option<String>,+ refunded_at: Option<String>,+ amount_refunded: MinorUnit,+ refund_request_id: String,}-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {+impl TryFrom<RefundsResponseRouterData<Execute, PayjustnowinstoreRefundResponse>>+ for RefundsRouterData<Execute>+{type Error = error_stack::Report<errors::ConnectorError>;fn try_from(- item: RefundsResponseRouterData<Execute, RefundResponse>,+ item: RefundsResponseRouterData<Execute, PayjustnowinstoreRefundResponse>,) -> Result<Self, Self::Error> {- Ok(Self {- response: Ok(RefundsResponseData {- connector_refund_id: item.response.id.to_string(),- refund_status: enums::RefundStatus::from(item.response.status),- }),- ..item.data- })- }-}+ let refund_status = enums::RefundStatus::from(item.response.status);+ let response = if utils::is_refund_failure(refund_status) {+ Err(ErrorResponse {+ code: NO_ERROR_CODE.to_string(),+ message: item+ .response+ .reason+ .clone()+ .unwrap_or(NO_ERROR_MESSAGE.to_string()),+ reason: item.response.reason,+ status_code: item.http_code,+ attempt_status: None,+ connector_transaction_id: None,+ network_advice_code: None,+ network_decline_code: None,+ network_error_message: None,+ connector_metadata: None,+ })+ } else {+ Ok(RefundsResponseData {+ connector_refund_id: item.response.refund_request_id.clone(),+ refund_status,+ })+ };-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {- type Error = error_stack::Report<errors::ConnectorError>;- fn try_from(- item: RefundsResponseRouterData<RSync, RefundResponse>,- ) -> Result<Self, Self::Error> {Ok(Self {- response: Ok(RefundsResponseData {- connector_refund_id: item.response.id.to_string(),- refund_status: enums::RefundStatus::from(item.response.status),- }),+ response,..item.data})}}-//TODO: Fill the struct with respective fields#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]pub struct PayjustnowinstoreErrorResponse {- 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>,+ pub error: Option<String>,}diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rsindex 092f3b702c..5f823cb57a 100644--- a/crates/router/src/core/connector_validation.rs+++ b/crates/router/src/core/connector_validation.rs@@ -412,10 +412,12 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {payjustnow::transformers::PayjustnowAuthType::try_from(self.auth_type)?;Ok(())}- // api_enums::Connector::Payjustnowinstore => {- // payjustnowinstore::transformers::PayjustnowinstoreAuthType::try_from(self.auth_type)?;- // Ok(())- // }+ api_enums::Connector::Payjustnowinstore => {+ payjustnowinstore::transformers::PayjustnowinstoreAuthType::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.rsindex 4c18e44754..8a748a7140 100644--- a/crates/router/src/types/api/connector_mapping.rs+++ b/crates/router/src/types/api/connector_mapping.rs@@ -356,9 +356,9 @@ impl ConnectorData {enums::Connector::Payjustnow => {Ok(ConnectorEnum::Old(Box::new(connector::Payjustnow::new())))}- // enums::Connector::Payjustnowinstore => {- // Ok(ConnectorEnum::Old(Box::new(connector::Payjustnowinstore::new())))- // }+ enums::Connector::Payjustnowinstore => Ok(ConnectorEnum::Old(Box::new(+ connector::Payjustnowinstore::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.rsindex 252635a457..2809e30b2a 100644--- a/crates/router/src/types/api/feature_matrix.rs+++ b/crates/router/src/types/api/feature_matrix.rs@@ -276,9 +276,9 @@ impl FeatureMatrixConnectorData {enums::Connector::Payjustnow => {Ok(ConnectorEnum::Old(Box::new(connector::Payjustnow::new())))}- // enums::Connector::Payjustnowinstore => {- // Ok(ConnectorEnum::Old(Box::new(connector::Payjustnowinstore::new())))- // }+ enums::Connector::Payjustnowinstore => Ok(ConnectorEnum::Old(Box::new(+ connector::Payjustnowinstore::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.rsindex 5396ef435d..a1973fde3f 100644--- a/crates/router/src/types/connector_transformers.rs+++ b/crates/router/src/types/connector_transformers.rs@@ -115,7 +115,7 @@ impl ForeignTryFrom<api_enums::Connector> for euclid::enums::RoutableConnectorsapi_enums::Connector::Opennode => Self::Opennode,api_enums::Connector::Paybox => Self::Paybox,api_enums::Connector::Payjustnow => Self::Payjustnow,- // api_enums::Connector::Payjustnowinstore => Self::Payjustnowinstore,+ api_enums::Connector::Payjustnowinstore => Self::Payjustnowinstore,api_enums::Connector::Payload => Self::Payload,api_enums::Connector::Payme => Self::Payme,api_enums::Connector::Payone => Self::Payone,diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.tomlindex ae3397d55a..711610e622 100644--- a/crates/router/tests/connectors/sample_auth.toml+++ b/crates/router/tests/connectors/sample_auth.toml@@ -385,4 +385,5 @@ key2 = "Merchant Identity Id"api_secret = "Password"[payjustnowinstore]-api_key="Merchant Terminal Id"\ No newline at end of file+api_key = "Merchant API Key"+key1 = "Merchant Terminal Id"\ No newline at end of filediff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rsindex 596a8f76bd..c59c6ec9d0 100644--- a/crates/test_utils/src/connector_auth.rs+++ b/crates/test_utils/src/connector_auth.rs@@ -96,7 +96,7 @@ pub struct ConnectorAuthentication {pub paybox: Option<HeaderKey>,pub payeezy: Option<SignatureKey>,pub payjustnow: Option<HeaderKey>,- pub payjustnowinstore: Option<HeaderKey>,+ pub payjustnowinstore: Option<BodyKey>,pub payload: Option<CurrencyAuthKey>,pub payme: Option<BodyKey>,pub payone: Option<HeaderKey>,diff --git a/crates/test_utils/tests/sample_auth.toml b/crates/test_utils/tests/sample_auth.tomlindex 46535688b1..26bb2a4a56 100644--- a/crates/test_utils/tests/sample_auth.toml+++ b/crates/test_utils/tests/sample_auth.toml@@ -175,4 +175,5 @@ api_key="API Key"key1="Tenant ID"[payjustnowinstore]-api_key="Merchant Terminal Id"\ No newline at end of file+api_key="Merchant API Key"+key1 = "Merchant Terminal Id"\ No newline at end of filediff --git a/loadtest/config/development.toml b/loadtest/config/development.tomlindex 82d82f7e10..017dc9eca2 100644--- a/loadtest/config/development.toml+++ b/loadtest/config/development.toml@@ -717,6 +717,9 @@ apple_pay = { currency = "USD, CAD" }[pm_filters.payjustnow]payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.payjustnowinstore]+payjustnow = { country = "ZA", currency = "ZAR" }+[pm_filters.worldpayxml]debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL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