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
refactor(connector): [Noon] Implement Paypal Payment Method (#7610)
Swangi Kumari5153e361a3a4
diff --git a/config/config.example.toml b/config/config.example.tomlindex 578ffdf96a..e6a7f4065c 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -553,6 +553,9 @@ debit = { country = "US,CA", currency = "USD" }[pm_filters.volt]open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = { country = "IN", currency = "INR" }diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.tomlindex 1e73290285..036ac59ae6 100644--- a/config/deployments/integration_test.toml+++ b/config/deployments/integration_test.toml@@ -418,6 +418,9 @@ paypal = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,B[pm_filters.volt]open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"}+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = {country = "IN", currency = "INR"}diff --git a/config/deployments/production.toml b/config/deployments/production.tomlindex cc4fcf68bd..7c9e81a148 100644--- a/config/deployments/production.toml+++ b/config/deployments/production.toml@@ -432,6 +432,9 @@ sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }[pm_filters.volt]open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"}+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = {country = "IN", currency = "INR"}diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.tomlindex d6e28571a0..a5fdea6956 100644--- a/config/deployments/sandbox.toml+++ b/config/deployments/sandbox.toml@@ -434,6 +434,9 @@ sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }[pm_filters.volt]open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = {country = "IN", currency = "INR"}diff --git a/config/development.toml b/config/development.tomlindex 302f5a5151..b5942148cd 100644--- a/config/development.toml+++ b/config/development.toml@@ -459,6 +459,9 @@ cashapp = { country = "US", currency = "USD" }[pm_filters.volt]open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = { country = "IN", currency = "INR" }diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex 71be47d2a1..c3c1c67cc0 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -470,6 +470,9 @@ debit = { country = "US,CA", currency = "USD" }[pm_filters.volt]open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = { country = "IN", currency = "INR" }diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.tomlindex 1edddb3478..056b14fc82 100644--- a/crates/connector_configs/toml/production.toml+++ b/crates/connector_configs/toml/production.toml@@ -1932,6 +1932,133 @@ key1="Public Key"[nmi.connector_webhook_details]merchant_secret="Source verification key"+[noon]+[[noon.credit]]+ payment_method_type = "Mastercard"+[[noon.credit]]+ payment_method_type = "Visa"+[[noon.credit]]+ payment_method_type = "Interac"+[[noon.credit]]+ payment_method_type = "AmericanExpress"+[[noon.credit]]+ payment_method_type = "JCB"+[[noon.credit]]+ payment_method_type = "DinersClub"+[[noon.credit]]+ payment_method_type = "Discover"+[[noon.credit]]+ payment_method_type = "CartesBancaires"+[[noon.credit]]+ payment_method_type = "UnionPay"+[[noon.debit]]+ payment_method_type = "Mastercard"+[[noon.debit]]+ payment_method_type = "Visa"+[[noon.debit]]+ payment_method_type = "Interac"+[[noon.debit]]+ payment_method_type = "AmericanExpress"+[[noon.debit]]+ payment_method_type = "JCB"+[[noon.debit]]+ payment_method_type = "DinersClub"+[[noon.debit]]+ payment_method_type = "Discover"+[[noon.debit]]+ payment_method_type = "CartesBancaires"+[[noon.debit]]+ payment_method_type = "UnionPay"+[[noon.wallet]]+ payment_method_type = "apple_pay"+[[noon.wallet]]+ payment_method_type = "google_pay"+[[noon.wallet]]+ payment_method_type = "paypal"+[noon.connector_auth.SignatureKey]+api_key="API Key"+key1="Business Identifier"+api_secret="Application Identifier"+[noon.connector_webhook_details]+merchant_secret="Source verification key"++[[noon.metadata.apple_pay]]+name="certificate"+label="Merchant Certificate (Base64 Encoded)"+placeholder="Enter Merchant Certificate (Base64 Encoded)"+required=true+type="Text"+[[noon.metadata.apple_pay]]+name="certificate_keys"+label="Merchant PrivateKey (Base64 Encoded)"+placeholder="Enter Merchant PrivateKey (Base64 Encoded)"+required=true+type="Text"+[[noon.metadata.apple_pay]]+name="merchant_identifier"+label="Apple Merchant Identifier"+placeholder="Enter Apple Merchant Identifier"+required=true+type="Text"+[[noon.metadata.apple_pay]]+name="display_name"+label="Display Name"+placeholder="Enter Display Name"+required=true+type="Text"+[[noon.metadata.apple_pay]]+name="initiative"+label="Domain"+placeholder="Enter Domain"+required=true+type="Text"+[[noon.metadata.apple_pay]]+name="initiative_context"+label="Domain Name"+placeholder="Enter Domain Name"+required=true+type="Text"+[[noon.metadata.apple_pay]]+name="merchant_business_country"+label="Merchant Business Country"+placeholder="Enter Merchant Business Country"+required=true+type="Select"+options=[]+[[noon.metadata.apple_pay]]+name="payment_processing_details_at"+label="Payment Processing Details At"+placeholder="Enter Payment Processing Details At"+required=true+type="Radio"+options=["Connector"]++[[noon.metadata.google_pay]]+name="merchant_name"+label="Google Pay Merchant Name"+placeholder="Enter Google Pay Merchant Name"+required=true+type="Text"+[[noon.metadata.google_pay]]+name="merchant_id"+label="Google Pay Merchant Id"+placeholder="Enter Google Pay Merchant Id"+required=true+type="Text"+[[noon.metadata.google_pay]]+name="gateway_merchant_id"+label="Google Pay Merchant Key"+placeholder="Enter Google Pay Merchant Key"+required=true+type="Text"+[[noon.metadata.google_pay]]+name="allowed_auth_methods"+label="Allowed Auth Methods"+placeholder="Enter Allowed Auth Methods"+required=true+type="MultiSelect"+options=["PAN_ONLY", "CRYPTOGRAM_3DS"]+[novalnet][[novalnet.credit]]payment_method_type = "Mastercard"diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rsindex 3f3de60006..2b1a5bd45f 100644--- a/crates/hyperswitch_connectors/src/connectors/noon.rs+++ b/crates/hyperswitch_connectors/src/connectors/noon.rs@@ -19,16 +19,19 @@ use hyperswitch_domain_models::{mandate_revoke::MandateRevoke,payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},refunds::{Execute, RSync},+ CompleteAuthorize,},router_request_types::{- AccessTokenRequestData, MandateRevokeRequestData, PaymentMethodTokenizationData,- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,- PaymentsSyncData, RefundsData, SetupMandateRequestData,+ AccessTokenRequestData, CompleteAuthorizeData, MandateRevokeRequestData,+ PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData,+ PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData,+ SetupMandateRequestData,},router_response_types::{MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData},types::{MandateRevokeRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,- PaymentsCaptureRouterData, PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,+ PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData,+ RefundSyncRouterData, RefundsRouterData,},};use hyperswitch_interfaces::{@@ -40,8 +43,9 @@ use hyperswitch_interfaces::{errors,events::connector_api_logs::ConnectorEvent,types::{- MandateRevokeType, PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType,- PaymentsVoidType, RefundExecuteType, RefundSyncType, Response,+ MandateRevokeType, PaymentsAuthorizeType, PaymentsCaptureType,+ PaymentsCompleteAuthorizeType, PaymentsSyncType, PaymentsVoidType, RefundExecuteType,+ RefundSyncType, Response,},webhooks,};@@ -326,11 +330,125 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseDataevent_builder: Option<&mut ConnectorEvent>,res: Response,) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {- let response: noon::NoonPaymentsResponse = res+ let response: noon::NoonAuthPaymentResponse = res.response.parse_struct("Noon PaymentsAuthorizeResponse").change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+ match response {+ noon::NoonAuthPaymentResponse::NoonPaypalResponse(response) => {+ 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,+ })+ }+ noon::NoonAuthPaymentResponse::NoonPaymentsResponse(response) => {+ 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 api::PaymentsCompleteAuthorize for Noon {}++impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData> for Noon {+ fn get_headers(+ &self,+ req: &PaymentsCompleteAuthorizeRouterData,+ 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: &PaymentsCompleteAuthorizeRouterData,+ connectors: &Connectors,+ ) -> CustomResult<String, errors::ConnectorError> {+ Ok(format!("{}payment/v1/order", self.base_url(connectors)))+ }++ fn get_request_body(+ &self,+ req: &PaymentsCompleteAuthorizeRouterData,+ _connectors: &Connectors,+ ) -> CustomResult<RequestContent, errors::ConnectorError> {+ let amount = connector_utils::convert_amount(+ self.amount_converter,+ req.request.minor_amount,+ req.request.currency,+ )?;++ let mandate_details =+ connector_utils::get_mandate_details(req.request.setup_mandate_details.clone())?;+ let mandate_amount = mandate_details+ .map(|mandate| {+ connector_utils::convert_amount(+ self.amount_converter,+ mandate.amount,+ mandate.currency,+ )+ })+ .transpose()?;+ let connector_router_data = noon::NoonRouterData::from((amount, req, mandate_amount));+ let connector_req =+ noon::NoonPaymentsCompleteAuthorizeRequest::try_from(&connector_router_data)?;+ Ok(RequestContent::Json(Box::new(connector_req)))+ }++ fn build_request(+ &self,+ req: &PaymentsCompleteAuthorizeRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {+ Ok(Some(+ RequestBuilder::new()+ .method(Method::Post)+ .url(&PaymentsCompleteAuthorizeType::get_url(+ self, req, connectors,+ )?)+ .attach_default_headers()+ .headers(PaymentsCompleteAuthorizeType::get_headers(+ self, req, connectors,+ )?)+ .set_body(PaymentsCompleteAuthorizeType::get_request_body(+ self, req, connectors,+ )?)+ .build(),+ ))+ }++ fn handle_response(+ &self,+ data: &PaymentsCompleteAuthorizeRouterData,+ event_builder: Option<&mut ConnectorEvent>,+ res: Response,+ ) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {+ let response: noon::NoonPaypalResponse = res+ .response+ .parse_struct("Noon NoonPaypalResponse")+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;+event_builder.map(|i| i.set_response_body(&response));router_env::logger::info!(connector_response=?response);@@ -340,7 +458,6 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseDatahttp_code: res.status_code,})}-fn get_error_response(&self,res: Response,diff --git a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rsindex 81dc018635..8e7bd7df50 100644--- a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs@@ -12,11 +12,11 @@ use hyperswitch_domain_models::{},types::{MandateRevokeRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,- PaymentsCaptureRouterData, RefundsRouterData,+ PaymentsCaptureRouterData, PaymentsCompleteAuthorizeRouterData, RefundsRouterData,},};use hyperswitch_interfaces::errors;-use masking::{ExposeInterface, Secret};+use masking::{ExposeInterface, PeekInterface, Secret};use serde::{Deserialize, Serialize};use crate::{@@ -247,6 +247,7 @@ pub enum NoonApiOperations {Reverse,Refund,CancelSubscription,+ ProcessAuthentication,}#[derive(Debug, Serialize)]#[serde(rename_all = "camelCase")]@@ -315,7 +316,7 @@ impl TryFrom<&NoonRouterData<&PaymentsAuthorizeRouterData>> for NoonPaymentsRequ}))}WalletData::PaypalRedirect(_) => Ok(NoonPaymentData::PayPal(NoonPayPal {- return_url: item.request.get_router_return_url()?,+ return_url: item.request.get_complete_authorize_url()?,})),WalletData::AliPayQr(_)| WalletData::AliPayRedirect(_)@@ -445,6 +446,116 @@ impl TryFrom<&NoonRouterData<&PaymentsAuthorizeRouterData>> for NoonPaymentsRequ}}+#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonPaymentsCompleteAuthorizeRequest {+ api_operation: NoonApiOperations,+ order: NoonCompleteOrder,+ payment_data: NoonCompletePaymentData,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonCompleteOrder {+ id: u64,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonCompletePaymentData {+ #[serde(rename = "type")]+ payment_method_type: NoonPaymentMethodType,+ data: NoonData,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonData {+ method: Method,+ query_data: NoonQueryData,+}++#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonQueryData {+ status: String,+ #[serde(rename = "PayerID")]+ payer_id: Option<Secret<String>>,+ payment_id: Option<Secret<String>>,+ token: Option<Secret<String>>,+}++#[derive(Clone, Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct PaypalQueryData {+ status: String,+ #[serde(rename = "PayerID")]+ payer_id: Option<Secret<String>>,+ token: Option<Secret<String>>,+}++#[derive(Debug, Serialize)]+#[serde(rename_all = "UPPERCASE")]+pub enum NoonPaymentMethodType {+ Paypal,+}++impl TryFrom<&NoonRouterData<&PaymentsCompleteAuthorizeRouterData>>+ for NoonPaymentsCompleteAuthorizeRequest+{+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ item: &NoonRouterData<&PaymentsCompleteAuthorizeRouterData>,+ ) -> Result<Self, Self::Error> {+ let params = item+ .router_data+ .request+ .redirect_response+ .as_ref()+ .and_then(|redirect_response| redirect_response.params.as_ref())+ .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;++ let query_params: PaypalQueryData = serde_urlencoded::from_str(params.peek())+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)+ .attach_printable("Failed to parse connector response")?;++ let payer_id = query_params.payer_id;+ let token = query_params.token.clone();+ let payment_id = query_params.token;+ let status = query_params.status;+ let payment_method_type = NoonPaymentMethodType::Paypal;++ let order = NoonCompleteOrder {+ id: item+ .router_data+ .request+ .connector_transaction_id+ .clone()+ .ok_or(errors::ConnectorError::MissingRequiredField {+ field_name: "connector_transaction_id",+ })?+ .parse::<u64>()+ .change_context(errors::ConnectorError::RequestEncodingFailed)?,+ };+ Ok(Self {+ api_operation: NoonApiOperations::ProcessAuthentication,+ order,+ payment_data: NoonCompletePaymentData {+ payment_method_type,+ data: NoonData {+ method: Method::Get,+ query_data: NoonQueryData {+ status,+ payer_id,+ payment_id,+ token,+ },+ },+ },+ })+ }+}+// Auth Structpub struct NoonAuthType {pub(super) api_key: Secret<String>,@@ -511,15 +622,13 @@ fn get_payment_status(data: (NoonPaymentStatus, AttemptStatus)) -> AttemptStatusNoonPaymentStatus::Cancelled | NoonPaymentStatus::Expired => {AttemptStatus::AuthenticationFailed}- NoonPaymentStatus::ThreeDsEnrollInitiated | NoonPaymentStatus::ThreeDsEnrollChecked => {- AttemptStatus::AuthenticationPending- }+ NoonPaymentStatus::ThreeDsEnrollInitiated+ | NoonPaymentStatus::ThreeDsEnrollChecked+ | NoonPaymentStatus::PaymentInfoAdded => AttemptStatus::AuthenticationPending,NoonPaymentStatus::ThreeDsResultVerified => AttemptStatus::AuthenticationSuccessful,NoonPaymentStatus::Failed | NoonPaymentStatus::Rejected => AttemptStatus::Failure,NoonPaymentStatus::Pending | NoonPaymentStatus::MarkedForReview => AttemptStatus::Pending,- NoonPaymentStatus::Initiated- | NoonPaymentStatus::PaymentInfoAdded- | NoonPaymentStatus::Authenticated => AttemptStatus::Started,+ NoonPaymentStatus::Initiated | NoonPaymentStatus::Authenticated => AttemptStatus::Started,NoonPaymentStatus::Locked => current_status,}}@@ -553,11 +662,102 @@ pub struct NoonPaymentsResponseResult {subscription: Option<NoonSubscriptionObject>,}+#[derive(Debug, Serialize, Deserialize)]+#[serde(untagged)]+pub enum NoonAuthPaymentResponse {+ NoonPaypalResponse(NoonPaypalResponse),+ NoonPaymentsResponse(NoonPaymentsResponse),+}+#[derive(Debug, Serialize, Deserialize)]pub struct NoonPaymentsResponse {result: NoonPaymentsResponseResult,}+#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonPaypalResponse {+ result: NoonPaypalResponseResult,+}++#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonPaypalResponseResult {+ order: NoonPaymentsOrderResponse,+ payment_data: Option<NoonPaypalPaymentData>,+ subscription: Option<NoonSubscriptionObject>,+}++#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct NoonPaypalPaymentData {+ data: PaypalData,+}++#[derive(Debug, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct PaypalData {+ url: url::Url,+}++impl<F, T> TryFrom<ResponseRouterData<F, NoonPaypalResponse, T, PaymentsResponseData>>+ for RouterData<F, T, PaymentsResponseData>+{+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ item: ResponseRouterData<F, NoonPaypalResponse, T, PaymentsResponseData>,+ ) -> Result<Self, Self::Error> {+ let order = item.response.result.order;+ let status = get_payment_status((order.status, item.data.status));+ let url = item+ .response+ .result+ .payment_data+ .map(|redirection_data| redirection_data.data.url);+ let redirection_data = url.map(|url| RedirectForm::from((url, Method::Get)));+ let mandate_reference =+ item.response+ .result+ .subscription+ .map(|subscription_data| MandateReference {+ connector_mandate_id: Some(subscription_data.identifier.expose()),+ payment_method_id: None,+ mandate_metadata: None,+ connector_mandate_request_reference_id: None,+ });+ Ok(Self {+ status,+ response: match order.error_message {+ Some(error_message) => Err(ErrorResponse {+ code: order.error_code.to_string(),+ message: error_message.clone(),+ reason: Some(error_message),+ status_code: item.http_code,+ attempt_status: Some(status),+ connector_transaction_id: Some(order.id.to_string()),+ issuer_error_code: None,+ issuer_error_message: None,+ }),+ _ => {+ let connector_response_reference_id =+ order.reference.or(Some(order.id.to_string()));+ Ok(PaymentsResponseData::TransactionResponse {+ resource_id: ResponseId::ConnectorTransactionId(order.id.to_string()),+ redirection_data: Box::new(redirection_data),+ mandate_reference: Box::new(mandate_reference),+ connector_metadata: None,+ network_txn_id: None,+ connector_response_reference_id,+ incremental_authorization_allowed: None,+ charges: None,+ })+ }+ },+ ..item.data+ })+ }+}+impl<F, T> TryFrom<ResponseRouterData<F, NoonPaymentsResponse, T, PaymentsResponseData>>for RouterData<F, T, PaymentsResponseData>{diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rsindex 734780a3a6..461cbc4e2f 100644--- a/crates/hyperswitch_connectors/src/default_implementations.rs+++ b/crates/hyperswitch_connectors/src/default_implementations.rs@@ -556,7 +556,6 @@ default_imp_for_complete_authorize!(connectors::Moneris,connectors::Multisafepay,connectors::Nomupay,- connectors::Noon,connectors::Novalnet,connectors::Nexinets,connectors::Opayo,diff --git a/loadtest/config/development.toml b/loadtest/config/development.tomlindex 662b288de8..5bb5871dd4 100644--- a/loadtest/config/development.toml+++ b/loadtest/config/development.toml@@ -303,6 +303,9 @@ open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,Minstant_bank_transfer = { country = "CZ,SK,GB", currency = "CZK, EUR, GBP" }sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,GB", currency = "EUR" }+[pm_filters.noon]+paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD,AED,SAR"}+[pm_filters.razorpay]upi_collect = { country = "IN", currency = "INR" }