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

refactor(connectors): [ZSL] add Local bank Transfer (#4337)

AkshayaFoiger266a075ab653
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index b5138ab898..a24dfa1731 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -130,7 +130,7 @@ pub enum Connector {
Plaid,
Riskified,
Zen,
- // Zsl, Added as template code for future usage
+ Zsl,
}
impl Connector {
@@ -208,7 +208,7 @@ impl Connector {
| Self::Worldline
| Self::Worldpay
| Self::Zen
- // | Self::Zsl Added as template code for future usage
+ | Self::Zsl
| Self::Signifyd
| Self::Plaid
| Self::Riskified
@@ -266,7 +266,7 @@ impl Connector {
| Self::Worldline
| Self::Worldpay
| Self::Zen
- // | Self::Zsl, Added as template code for future usage
+ | Self::Zsl
| Self::Signifyd
| Self::Plaid
| Self::Riskified
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index ab27b52af3..ae8f49c759 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -167,7 +167,7 @@ pub enum RoutableConnectors {
Worldline,
Worldpay,
Zen,
- // Zsl, Added as template code for future usage
+ Zsl,
}
impl AttemptStatus {
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 6e2cce946a..63219edab7 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -278,7 +278,7 @@ impl ConnectorConfig {
Connector::Worldline => Ok(connector_data.worldline),
Connector::Worldpay => Ok(connector_data.worldpay),
Connector::Zen => Ok(connector_data.zen),
- // Connector::Zsl => Ok(connector_data.zsl), Added as template code for future usage
+ Connector::Zsl => Ok(connector_data.zsl),
#[cfg(feature = "dummy_connector")]
Connector::DummyConnector1 => Ok(connector_data.dummy_connector),
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index ab18af1be0..f9919d8b91 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -98,6 +98,8 @@ pub trait RouterData {
fn get_optional_billing_state(&self) -> Option<Secret<String>>;
fn get_optional_billing_first_name(&self) -> Option<Secret<String>>;
fn get_optional_billing_last_name(&self) -> Option<Secret<String>>;
+ fn get_optional_billing_phone_number(&self) -> Option<Secret<String>>;
+ fn get_optional_billing_email(&self) -> Option<Email>;
}
pub trait PaymentResponseRouterData {
@@ -300,6 +302,22 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
})
}
+ fn get_optional_billing_phone_number(&self) -> Option<Secret<String>> {
+ self.address
+ .get_payment_method_billing()
+ .and_then(|billing_address| {
+ billing_address
+ .clone()
+ .phone
+ .and_then(|phone_data| phone_data.number)
+ })
+ }
+
+ fn get_optional_billing_email(&self) -> Option<Email> {
+ self.address
+ .get_payment_method_billing()
+ .and_then(|billing_address| billing_address.clone().email)
+ }
fn to_connector_meta<T>(&self) -> Result<T, Error>
where
T: serde::de::DeserializeOwned,
diff --git a/crates/router/src/connector/zsl.rs b/crates/router/src/connector/zsl.rs
index 5453a22ecb..5d5a95b0a8 100644
--- a/crates/router/src/connector/zsl.rs
+++ b/crates/router/src/connector/zsl.rs
@@ -2,23 +2,27 @@ pub mod transformers;
use std::fmt::Debug;
-use error_stack::{report, ResultExt};
+use common_utils::ext_traits::ValueExt;
+use diesel_models::enums;
+use error_stack::ResultExt;
use masking::ExposeInterface;
use transformers as zsl;
use crate::{
configs::settings,
+ connector::utils as connector_utils,
core::errors::{self, CustomResult},
events::connector_api_logs::ConnectorEvent,
headers,
services::{
self,
- request::{self, Mask},
+ request::{self},
ConnectorIntegration, ConnectorValidation,
},
types::{
self,
api::{self, ConnectorCommon, ConnectorCommonExt},
+ transformers::ForeignFrom,
ErrorResponse, RequestContent, Response,
},
utils::BytesExt,
@@ -40,31 +44,19 @@ impl api::RefundExecute for Zsl {}
impl api::RefundSync for Zsl {}
impl api::PaymentToken for Zsl {}
-impl
- ConnectorIntegration<
- api::PaymentMethodToken,
- types::PaymentMethodTokenizationData,
- types::PaymentsResponseData,
- > for Zsl
-{
- // Not Implemented (R)
-}
-
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Zsl
where
Self: ConnectorIntegration<Flow, Request, Response>,
{
fn build_headers(
&self,
- req: &types::RouterData<Flow, Request, Response>,
+ _req: &types::RouterData<Flow, Request, Response>,
_connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let mut header = vec![(
+ let header = vec![(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string().into(),
)];
- let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
- header.append(&mut api_key);
Ok(header)
}
}
@@ -79,72 +71,57 @@ impl ConnectorCommon for Zsl {
}
fn common_get_content_type(&self) -> &'static str {
- "application/json"
+ "application/x-www-form-urlencoded"
}
fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
connectors.zsl.base_url.as_ref()
}
- fn get_auth_header(
- &self,
- auth_type: &types::ConnectorAuthType,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let auth = zsl::ZslAuthType::try_from(auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
-
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- format!("{}:{}", auth.api_key.expose(), auth.merchant_id.expose()).into_masked(),
- )])
- }
-
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: zsl::ZslErrorResponse = res
- .response
- .parse_struct("ZslErrorResponse")
+ let response = serde_urlencoded::from_bytes::<zsl::ZslErrorResponse>(&res.response)
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+ let error_reason = zsl::ZslResponseStatus::try_from(response.status.clone())?.to_string();
+
Ok(ErrorResponse {
status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
- attempt_status: None,
+ code: response.status,
+ message: error_reason.clone(),
+ reason: Some(error_reason),
+ attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: None,
})
}
}
impl ConnectorValidation for Zsl {
- //TODO: implement functions when support enabled
-}
-
-impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
- for Zsl
-{
- //TODO: implement sessions flow
-}
-
-impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
- for Zsl
-{
-}
+ fn validate_capture_method(
+ &self,
+ capture_method: Option<enums::CaptureMethod>,
+ _pmt: Option<enums::PaymentMethodType>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ let capture_method = capture_method.unwrap_or_default();
+ match capture_method {
+ enums::CaptureMethod::Automatic => Ok(()),
+ enums::CaptureMethod::Manual
+ | enums::CaptureMethod::ManualMultiple
+ | enums::CaptureMethod::Scheduled => Err(
+ connector_utils::construct_not_supported_error_report(capture_method, self.id()),
+ ),
+ }
+ }
-impl
- ConnectorIntegration<
- api::SetupMandate,
- types::SetupMandateRequestData,
- types::PaymentsResponseData,
- > for Zsl
-{
+ fn is_webhook_source_verification_mandatory(&self) -> bool {
+ true
+ }
}
impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
@@ -165,9 +142,9 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn get_url(
&self,
_req: &types::PaymentsAuthorizeRouterData,
- _connectors: &settings::Connectors,
+ connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}ecp", self.base_url(connectors)))
}
fn get_request_body(
@@ -182,7 +159,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
req,
))?;
let connector_req = zsl::ZslPaymentsRequest::try_from(&connector_router_data)?;
- Ok(RequestContent::Json(Box::new(connector_req)))
+ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
}
fn build_request(
@@ -213,12 +190,12 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: zsl::ZslPaymentsResponse = res
- .response
- .parse_struct("Zsl PaymentsAuthorizeResponse")
+ let response = serde_urlencoded::from_bytes::<zsl::ZslPaymentsResponse>(&res.response)
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- event_builder.map(|i| i.set_response_body(&response));
+
+ event_builder.map(|i: &mut ConnectorEvent| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -233,47 +210,259 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
+
+ fn get_5xx_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
}
impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
for Zsl
{
+ fn handle_response(
+ &self,
+ data: &types::PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: zsl::ZslWebhookResponse = res
+ .response
+ .parse_struct("ZslWebhookResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i: &mut ConnectorEvent| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+}
+
+impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
+ for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::PaymentsSessionRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Session flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
+
+impl
+ ConnectorIntegration<
+ api::PaymentMethodToken,
+ types::PaymentMethodTokenizationData,
+ types::PaymentsResponseData,
+ > for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::TokenizationRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "PaymentMethod Tokenization flow ".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
+
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::RefreshTokenRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "AccessTokenAuth flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
+
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Zsl
+{
+ fn build_request(
+ &self,
+ _req: &types::RouterData<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ >,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "SetupMandate flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
}
impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
for Zsl
{
+ fn build_request(
+ &self,
+ _req: &types::PaymentsCaptureRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Capture flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
}
impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
for Zsl
{
+ fn build_request(
+ &self,
+ _req: &types::PaymentsCancelRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Void flow ".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
}
-impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Zsl {}
+impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Zsl {
+ fn build_request(
+ &self,
+ _req: &types::RefundsRouterData<api::Execute>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Refund flow".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
-impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Zsl {}
+impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Zsl {
+ fn build_request(
+ &self,
+ _req: &types::RefundSyncRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotSupported {
+ message: "Rsync flow ".to_owned(),
+ connector: "Zsl",
+ }
+ .into())
+ }
+}
#[async_trait::async_trait]
impl api::IncomingWebhook for Zsl {
fn get_webhook_object_reference_id(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let notif = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ api_models::payments::PaymentIdType::PaymentAttemptId(notif.mer_ref),
+ ))
}
fn get_webhook_event_type(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let notif = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+
+ Ok(api_models::webhooks::IncomingWebhookEvent::foreign_from(
+ notif.status,
+ ))
}
fn get_webhook_resource_object(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ let response = get_webhook_object_from_body(request.body)
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+ Ok(Box::new(response))
}
+
+ async fn verify_webhook_source(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
+ _merchant_account: &types::domain::MerchantAccount,
+ merchant_connector_account: types::domain::MerchantConnectorAccount,
+ _connector_label: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ let connector_account_details = merchant_connector_account
+ .connector_account_details
+ .parse_value::<types::ConnectorAuthType>("ConnectorAuthType")
+ .change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed)?;
+ let auth_type = zsl::ZslAuthType::try_from(&connector_account_details)?;
+ let key = auth_type.api_key.expose();
+ let mer_id = auth_type.merchant_id.expose();
+ let webhook_response = get_webhook_object_from_body(request.body)?;
+ let signature = zsl::calculate_signature(
+ webhook_response.enctype,
+ zsl::ZslSignatureType::WebhookSignature {
+ status: webhook_response.status,
+ txn_id: webhook_response.txn_id,
+ txn_date: webhook_response.txn_date,
+ paid_ccy: webhook_response.paid_ccy.to_string(),
+ paid_amt: webhook_response.paid_amt,
+ mer_ref: webhook_response.mer_ref,
+ mer_id,
+ key,
+ },
+ )?;
+
+ Ok(signature.eq(&webhook_response.signature))
+ }
+
+ fn get_webhook_api_response(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<services::api::ApplicationResponse<serde_json::Value>, errors::ConnectorError>
+ {
+ Ok(services::api::ApplicationResponse::TextPlain(
+ "CALLBACK-OK".to_string(),
+ ))
+ }
+}
+
+fn get_webhook_object_from_body(
+ body: &[u8],
+) -> CustomResult<zsl::ZslWebhookResponse, errors::ConnectorError> {
+ let response: zsl::ZslWebhookResponse =
+ serde_urlencoded::from_bytes::<zsl::ZslWebhookResponse>(body)
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ Ok(response)
}
diff --git a/crates/router/src/connector/zsl/transformers.rs b/crates/router/src/connector/zsl/transformers.rs
index f14f0279cb..c869cc3e55 100644
--- a/crates/router/src/connector/zsl/transformers.rs
+++ b/crates/router/src/connector/zsl/transformers.rs
@@ -1,15 +1,29 @@
-use masking::Secret;
+use std::collections::HashMap;
+
+use base64::Engine;
+use common_utils::{crypto::GenerateDigest, date_time, pii::Email};
+use error_stack::ResultExt;
+use masking::{ExposeInterface, Secret};
+use ring::digest;
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::PaymentsAuthorizeRequestData,
+ connector::utils::{self as connector_utils, PaymentsAuthorizeRequestData, RouterData},
+ consts,
core::errors,
+ services,
types::{self, domain, storage::enums},
};
-//TODO: Fill the struct with respective fields
+mod auth_error {
+ pub const INVALID_SIGNATURE: &str = "INVALID_SIGNATURE";
+}
+mod zsl_version {
+ pub const VERSION_1: &str = "1";
+}
+
pub struct ZslRouterData<T> {
- pub amount: i64, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: String,
pub router_data: T,
}
@@ -23,14 +37,14 @@ impl<T>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- (_currency_unit, _currency, amount, item): (
+ (currency_unit, currency, txn_amount, item): (
&types::api::CurrencyUnit,
types::storage::enums::Currency,
i64,
T,
),
) -> Result<Self, Self::Error> {
- //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ let amount = connector_utils::get_amount_as_string(currency_unit, txn_amount, currency)?;
Ok(Self {
amount,
router_data: item,
@@ -38,48 +52,6 @@ impl<T>
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct ZslPaymentsRequest {
- amount: i64,
- card: ZslCard,
-}
-
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
-pub struct ZslCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
-}
-
-impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPaymentsRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(
- item: &ZslRouterData<&types::PaymentsAuthorizeRouterData>,
- ) -> Result<Self, Self::Error> {
- match item.router_data.request.payment_method_data.clone() {
- domain::PaymentMethodData::Card(req_card) => {
- let card = ZslCard {
- number: req_card.card_number,
- expiry_month: req_card.card_exp_month,
- expiry_year: req_card.card_exp_year,
- cvc: req_card.card_cvc,
- complete: item.router_data.request.is_auto_capture()?,
- };
- Ok(Self {
- amount: item.amount.to_owned(),
- card,
- })
- }
- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
- }
- }
-}
-
-//TODO: Fill the struct with respective fields
-// Auth Struct
pub struct ZslAuthType {
pub(super) api_key: Secret<String>,
pub(super) merchant_id: Secret<String>,
@@ -91,38 +63,241 @@ impl TryFrom<&types::ConnectorAuthType> for ZslAuthType {
match auth_type {
types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
api_key: api_key.to_owned(),
- merchant_id: key1.to_owned(),
+ merchant_id: key1.clone(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
-// PaymentsResponse
-//TODO: Append the remaining status flags
-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum ZslPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
-}
-
-impl From<ZslPaymentStatus> for enums::AttemptStatus {
- fn from(item: ZslPaymentStatus) -> Self {
- match item {
- ZslPaymentStatus::Succeeded => Self::Charged,
- ZslPaymentStatus::Failed => Self::Failure,
- ZslPaymentStatus::Processing => Self::Authorizing,
- }
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ZslPaymentsRequest {
+ process_type: ProcessType,
+ process_code: ProcessCode,
+ txn_amt: String,
+ ccy: api_models::enums::Currency,
+ mer_ref: String,
+ mer_txn_date: String,
+ mer_id: Secret<String>,
+ lang: String,
+ success_url: String,
+ failure_url: String,
+ success_s2s_url: String,
+ failure_s2s_url: String,
+ enctype: EncodingType,
+ signature: Secret<String>,
+ country: api_models::enums::CountryAlpha2,
+ verno: String,
+ service_code: ServiceCode,
+ cust_tag: String,
+ #[serde(flatten)]
+ payment_method: ZslPaymentMethods,
+ name: Option<Secret<String>>,
+ family_name: Option<Secret<String>>,
+ tel_phone: Option<Secret<String>>,
+ email: Option<Email>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ZslPaymentMethods {
+ LocalBankTransfer(LocalBankTransaferRequest),
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct LocalBankTransaferRequest {
+ bank_code: Option<String>,
+ pay_method: Option<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ProcessType {
+ #[serde(rename = "0200")]
+ PaymentRequest,
+ #[serde(rename = "0208")]
+ PaymentResponse,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum ProcessCode {
+ #[serde(rename = "200002")]
+ API,
+ #[serde(rename = "200003")]
+ CallBack,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum EncodingType {
+ #[serde(rename = "1")]
+ MD5,
+ #[serde(rename = "2")]
+ Sha1,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum ServiceCode {
+ MPG,
+}
+
+impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &ZslRouterData<&types::PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ let payment_method = match item.router_data.request.payment_method_data.clone() {
+ domain::PaymentMethodData::BankTransfer(bank_transfer_data) => {
+ match *bank_transfer_data {
+ api_models::payments::BankTransferData::LocalBankTransfer { bank_code } => Ok(
+ ZslPaymentMethods::LocalBankTransfer(LocalBankTransaferRequest {
+ bank_code,
+ pay_method: None,
+ }),
+ ),
+ api_models::payments::BankTransferData::AchBankTransfer { .. }
+ | api_models::payments::BankTransferData::SepaBankTransfer { .. }
+ | api_models::payments::BankTransferData::BacsBankTransfer { .. }
+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. }
+ | api_models::payments::BankTransferData::PermataBankTransfer { .. }
+ | api_models::payments::BankTransferData::BcaBankTransfer { .. }
+ | api_models::payments::BankTransferData::BniVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::BriVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::CimbVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::DanamonVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::MandiriVaBankTransfer { .. }
+ | api_models::payments::BankTransferData::Pix {}
+ | api_models::payments::BankTransferData::Pse {} => {
+ Err(errors::ConnectorError::NotImplemented(
+ connector_utils::get_unimplemented_payment_method_error_message(
+ item.router_data.connector.as_str(),
+ ),
+ ))
+ }
+ }
+ }
+ domain::PaymentMethodData::Card(_)
+ | domain::PaymentMethodData::CardRedirect(_)
+ | domain::PaymentMethodData::Wallet(_)
+ | domain::PaymentMethodData::PayLater(_)
+ | domain::PaymentMethodData::BankRedirect(_)
+ | domain::PaymentMethodData::BankDebit(_)
+ | domain::PaymentMethodData::Crypto(_)
+ | domain::PaymentMethodData::MandatePayment
+ | domain::PaymentMethodData::Reward
+ | domain::PaymentMethodData::Upi(_)
+ | domain::PaymentMethodData::Voucher(_)
+ | domain::PaymentMethodData::GiftCard(_)
+ | domain::PaymentMethodData::CardToken(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ connector_utils::get_unimplemented_payment_method_error_message(
+ item.router_data.connector.as_str(),
+ ),
+ ))
+ }
+ }?;
+ let auth_type = ZslAuthType::try_from(&item.router_data.connector_auth_type)?;
+ let key: Secret<String> = auth_type.api_key;
+ let mer_id = auth_type.merchant_id;
+ let mer_txn_date =
+ date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ let txn_amt = item.amount.clone();
+ let ccy = item.router_data.request.currency;
+ let mer_ref = item.router_data.connector_request_reference_id.clone();
+ let signature = calculate_signature(
+ EncodingType::MD5,
+ ZslSignatureType::RequestSignature {
+ txn_amt: txn_amt.clone(),
+ ccy: ccy.to_string(),
+ mer_ref: mer_ref.clone(),
+ mer_id: mer_id.clone().expose(),
+ mer_txn_date: mer_txn_date.clone(),
+ key: key.expose(),
+ },
+ )?;
+ let tel_phone = item.router_data.get_optional_billing_phone_number();
+ let email = item.router_data.get_optional_billing_email();
+ let name = item.router_data.get_optional_billing_first_name();
+ let family_name = item.router_data.get_optional_billing_last_name();
+ let router_url = item.router_data.request.get_router_return_url()?;
+ let webhook_url = item.router_data.request.get_webhook_url()?;
+ let billing_country = item.router_data.get_optional_billing_country().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "billing.address.country",
+ },
+ )?;
+
+ let lang = item
+ .router_data
+ .request
+ .browser_info
+ .as_ref()
+ .and_then(|browser_data| {
+ browser_data.language.as_ref().map(|language| {
+ language
+ .split_once('-')
+ .map_or(language.to_uppercase(), |(lang, _)| lang.to_uppercase())
+ })
+ })
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "browser_info.language",
+ })?;
+
+ let cust_tag = item
+ .router_data
+ .customer_id
+ .clone()
+ .and_then(|customer_id| {
+ let cust_id = customer_id.replace(['_', '-'], "");
+ let id_len = cust_id.len();
+ if id_len > 10 {
+ cust_id.get(id_len - 10..id_len).map(|id| id.to_string())
+ } else {
+ Some(cust_id)
+ }
+ })
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "customer_id",
+ })?;
+
+ Ok(Self {
+ process_type: ProcessType::PaymentRequest,
+ process_code: ProcessCode::API,
+ txn_amt,
+ ccy,
+ mer_ref,
+ mer_txn_date,
+ mer_id,
+ lang,
+ success_url: router_url.clone(),
+ failure_url: router_url.clone(),
+ success_s2s_url: webhook_url.clone(),
+ failure_s2s_url: webhook_url.clone(),
+ enctype: EncodingType::MD5,
+ signature,
+ verno: zsl_version::VERSION_1.to_owned(),
+ service_code: ServiceCode::MPG,
+ country: billing_country,
+ payment_method,
+ name,
+ family_name,
+ tel_phone,
+ email,
+ cust_tag,
+ })
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ZslPaymentsResponse {
- status: ZslPaymentStatus,
- id: String,
+ process_type: ProcessType,
+ process_code: ProcessCode,
+ status: String,
+ mer_ref: String,
+ mer_id: String,
+ enctype: EncodingType,
+ txn_url: String,
+ signature: Secret<String>,
}
impl<F, T>
@@ -133,27 +308,630 @@ impl<F, T>
fn try_from(
item: types::ResponseRouterData<F, ZslPaymentsResponse, T, types::PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: enums::AttemptStatus::from(item.response.status),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- }),
- ..item.data
- })
+ if item.response.status.eq("0") && !item.response.txn_url.is_empty() {
+ let auth_type = ZslAuthType::try_from(&item.data.connector_auth_type)?;
+ let key: Secret<String> = auth_type.api_key;
+ let mer_id = auth_type.merchant_id;
+ let calculated_signature = calculate_signature(
+ item.response.enctype,
+ ZslSignatureType::ResponseSignature {
+ status: item.response.status.clone(),
+ txn_url: item.response.txn_url.clone(),
+ mer_ref: item.response.mer_ref.clone(),
+ mer_id: mer_id.clone().expose(),
+ key: key.expose(),
+ },
+ )?;
+
+ if calculated_signature.clone().eq(&item.response.signature) {
+ let decoded_redirect_url_bytes: Vec<u8> = base64::engine::general_purpose::STANDARD
+ .decode(item.response.txn_url.clone())
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ let redirect_url = String::from_utf8(decoded_redirect_url_bytes)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
+ Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending, // Redirect is always expected after success response
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.mer_ref.clone(),
+ ),
+ redirection_data: Some(services::RedirectForm::Form {
+ endpoint: redirect_url,
+ method: services::Method::Get,
+ form_fields: HashMap::new(),
+ }),
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.mer_ref.clone()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ } else {
+ // When the signature check fails
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(types::ErrorResponse {
+ code: consts::NO_ERROR_CODE.to_string(),
+ message: auth_error::INVALID_SIGNATURE.to_string(),
+ reason: Some(auth_error::INVALID_SIGNATURE.to_string()),
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(item.response.mer_ref.clone()),
+ }),
+ ..item.data
+ })
+ }
+ } else {
+ let error_reason =
+ ZslResponseStatus::try_from(item.response.status.clone())?.to_string();
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(types::ErrorResponse {
+ code: item.response.status.clone(),
+ message: error_reason.clone(),
+ reason: Some(error_reason.clone()),
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(item.response.mer_ref.clone()),
+ }),
+ ..item.data
+ })
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ZslWebhookResponse {
+ pub process_type: ProcessType,
+ pub process_code: ProcessCode,
+ pub status: String,
+ pub txn_id: String,
+ pub txn_date: String,
+ pub paid_ccy: api_models::enums::Currency,
+ pub paid_amt: String,
+ pub consr_paid_ccy: api_models::enums::Currency,
+ pub consr_paid_amt: String,
+ pub service_fee_ccy: api_models::enums::Currency,
+ pub service_fee: String,
+ pub txn_amt: String,
+ pub ccy: String,
+ pub mer_ref: String,
+ pub mer_txn_date: String,
+ pub mer_id: String,
+ pub enctype: EncodingType,
+ pub signature: Secret<String>,
+}
+
+impl types::transformers::ForeignFrom<String> for api_models::webhooks::IncomingWebhookEvent {
+ fn foreign_from(status: String) -> Self {
+ match status.as_str() {
+ //any response with status != 0 are a failed deposit transaction
+ "0" => Self::PaymentIntentSuccess,
+ _ => Self::PaymentIntentFailure,
+ }
+ }
+}
+
+impl<F, T> TryFrom<types::ResponseRouterData<F, ZslWebhookResponse, T, types::PaymentsResponseData>>
+ for types::RouterData<F, T, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<F, ZslWebhookResponse, T, types::PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ if item.response.status == "0" {
+ Ok(Self {
+ status: enums::AttemptStatus::Charged,
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.mer_ref.clone(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.mer_ref.clone()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ } else {
+ let error_reason =
+ ZslResponseStatus::try_from(item.response.status.clone())?.to_string();
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(types::ErrorResponse {
+ code: item.response.status.clone(),
+ message: error_reason.clone(),
+ reason: Some(error_reason.clone()),
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(item.response.mer_ref.clone()),
+ }),
+ ..item.data
+ })
+ }
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+impl TryFrom<String> for ZslResponseStatus {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(status: String) -> Result<Self, Self::Error> {
+ match status.as_str() {
+ "0" => Ok(Self::Normal),
+ "1000" => Ok(Self::InternalError),
+ "1001" => Ok(Self::BreakDownMessageError),
+ "1002" => Ok(Self::FormatError),
+ "1004" => Ok(Self::InvalidTransaction),
+ "1005" => Ok(Self::TransactionCountryNotFound),
+ "1006" => Ok(Self::MerchantIdNotFound),
+ "1007" => Ok(Self::AccountDisabled),
+ "1008" => Ok(Self::DuplicateMerchantReference),
+ "1009" => Ok(Self::InvalidPayAmount),
+ "1010" => Ok(Self::PayAmountNotFound),
+ "1011" => Ok(Self::InvalidCurrencyCode),
+ "1012" => Ok(Self::CurrencyCodeNotFound),
+ "1013" => Ok(Self::ReferenceNotFound),
+ "1014" => Ok(Self::TransmissionTimeNotFound),
+ "1015" => Ok(Self::PayMethodNotFound),
+ "1016" => Ok(Self::BankCodeNotFound),
+ "1017" => Ok(Self::InvalidShowPayPage),
+ "1018" => Ok(Self::ShowPayPageNotFound),
+ "1019" => Ok(Self::SuccessUrlNotFound),
+ "1020" => Ok(Self::SuccessCallbackUrlNotFound),
+ "1021" => Ok(Self::FailUrlNotFound),
+ "1022" => Ok(Self::FailCallbackUrlNotFound),
+ "1023" => Ok(Self::MacNotFound),
+ "1025" => Ok(Self::OriginalTransactionNotFound),
+ "1026" => Ok(Self::DeblockDataError),
+ "1028" => Ok(Self::PspAckNotYetReturn),
+ "1029" => Ok(Self::BankBranchNameNotFound),
+ "1030" => Ok(Self::BankAccountIDNotFound),
+ "1031" => Ok(Self::BankAccountNameNotFound),
+ "1032" => Ok(Self::IdentityIDNotFound),
+ "1033" => Ok(Self::ErrorConnectingToPsp),
+ "1034" => Ok(Self::CountryPspNotAvailable),
+ "1035" => Ok(Self::UnsupportedPayAmount),
+ "1036" => Ok(Self::RecordMismatch),
+ "1037" => Ok(Self::NoRecord),
+ "1038" => Ok(Self::PspError),
+ "1039" => Ok(Self::UnsupportedEncryptionType),
+ "1040" => Ok(Self::ExceedTransactionLimitCount),
+ "1041" => Ok(Self::ExceedTransactionLimitAmount),
+ "1042" => Ok(Self::ExceedTransactionAccountLimitCount),
+ "1043" => Ok(Self::ExceedTransactionAccountLimitAmount),
+ "1044" => Ok(Self::ExchangeRateError),
+ "1045" => Ok(Self::InvalidEncoding),
+ "1046" => Ok(Self::CustomerNameNotFound),
+ "1047" => Ok(Self::CustomerFamilyNameNotFound),
+ "1048" => Ok(Self::CustomerTelPhoneNotFound),
+ "1049" => Ok(Self::InsufficientFund),
+ "1050" => Ok(Self::ServiceCodeIsMissing),
+ "1051" => Ok(Self::CurrencyIdNotMatch),
+ "1052" => Ok(Self::NoPendingRecord),
+ "1053" => Ok(Self::NoLoadBalancerRuleDefineForTransaction),
+ "1054" => Ok(Self::NoPaymentProviderAvailable),
+ "1055" => Ok(Self::UnsupportedPayMethod),
+ "1056" => Ok(Self::PendingTransaction),
+ "1057" => Ok(Self::OtherError1059),
+ "1058" => Ok(Self::OtherError1058),
+ "1059" => Ok(Self::OtherError1059),
+ "1084" => Ok(Self::InvalidRequestId),
+ "5043" => Ok(Self::BeneficiaryBankAccountIsNotAvailable),
+ "5053" => Ok(Self::BaidNotFound),
+ "5057" => Ok(Self::InvalidBaid),
+ "5059" => Ok(Self::InvalidBaidStatus),
+ "5107" => Ok(Self::AutoUploadBankDisabled),
+ "5108" => Ok(Self::InvalidNature),
+ "5109" => Ok(Self::SmsCreateDateNotFound),
+ "5110" => Ok(Self::InvalidSmsCreateDate),
+ "5111" => Ok(Self::RecordNotFound),
+ "5112" => Ok(Self::InsufficientBaidAvailableBalance),
+ "5113" => Ok(Self::ExceedTxnAmountLimit),
+ "5114" => Ok(Self::BaidBalanceNotFound),
+ "5115" => Ok(Self::AutoUploadIndicatorNotFound),
+ "5116" => Ok(Self::InvalidBankAcctStatus),
+ "5117" => Ok(Self::InvalidAutoUploadIndicator),
+ "5118" => Ok(Self::InvalidPidStatus),
+ "5119" => Ok(Self::InvalidProviderStatus),
+ "5120" => Ok(Self::InvalidBankAccountSystemSwitchEnabled),
+ "5121" => Ok(Self::AutoUploadProviderDisabled),
+ "5122" => Ok(Self::AutoUploadBankNotFound),
+ "5123" => Ok(Self::AutoUploadBankAcctNotFound),
+ "5124" => Ok(Self::AutoUploadProviderNotFound),
+ "5125" => Ok(Self::UnsupportedBankCode),
+ "5126" => Ok(Self::BalanceOverrideIndicatorNotFound),
+ "5127" => Ok(Self::InvalidBalanceOverrideIndicator),
+ "10000" => Ok(Self::VernoInvalid),
+ "10001" => Ok(Self::ServiceCodeInvalid),
+ "10002" => Ok(Self::PspResponseSignatureIsNotValid),
+ "10003" => Ok(Self::ProcessTypeNotFound),
+ "10004" => Ok(Self::ProcessCodeNotFound),
+ "10005" => Ok(Self::EnctypeNotFound),
+ "10006" => Ok(Self::VernoNotFound),
+ "10007" => Ok(Self::DepositBankNotFound),
+ "10008" => Ok(Self::DepositFlowNotFound),
+ "10009" => Ok(Self::CustDepositDateNotFound),
+ "10010" => Ok(Self::CustTagNotFound),
+ "10011" => Ok(Self::CountryValueInvalid),
+ "10012" => Ok(Self::CurrencyCodeValueInvalid),
+ "10013" => Ok(Self::MerTxnDateInvalid),
+ "10014" => Ok(Self::CustDepositDateInvalid),
+ "10015" => Ok(Self::TxnAmtInvalid),
+ "10016" => Ok(Self::SuccessCallbackUrlInvalid),
+ "10017" => Ok(Self::DepositFlowInvalid),
+ "10018" => Ok(Self::ProcessTypeInvalid),
+ "10019" => Ok(Self::ProcessCodeInvalid),
+ "10020" => Ok(Self::UnsupportedMerRefLength),
+ "10021" => Ok(Self::DepositBankLengthOverLimit),
+ "10022" => Ok(Self::CustTagLengthOverLimit),
+ "10023" => Ok(Self::SignatureLengthOverLimit),
+ "10024" => Ok(Self::RequestContainInvalidTag),
+ "10025" => Ok(Self::RequestSignatureNotMatch),
+ "10026" => Ok(Self::InvalidCustomer),
+ "10027" => Ok(Self::SchemeNotFound),
+ "10028" => Ok(Self::PspResponseFieldsMissing),
+ "10029" => Ok(Self::PspResponseMerRefNotMatchWithRequestMerRef),
+ "10030" => Ok(Self::PspResponseMerIdNotMatchWithRequestMerId),
+ "10031" => Ok(Self::UpdateDepositFailAfterResponse),
+ "10032" => Ok(Self::UpdateUsedLimitTransactionCountFailAfterSuccessResponse),
+ "10033" => Ok(Self::UpdateCustomerLastDepositRecordAfterSuccessResponse),
+ "10034" => Ok(Self::CreateDepositFail),
+ "10035" => Ok(Self::CreateDepositMsgFail),
+ "10036" => Ok(Self::UpdateStatusSubStatusFail),
+ "10037" => Ok(Self::AddDepositRecordToSchemeAccount),
+ "10038" => Ok(Self::EmptyResponse),
+ "10039" => Ok(Self::AubConfirmErrorFromPh),
+ "10040" => Ok(Self::ProviderEmailAddressNotFound),
+ "10041" => Ok(Self::AubConnectionTimeout),
+ "10042" => Ok(Self::AubConnectionIssue),
+ "10043" => Ok(Self::AubMsgTypeMissing),
+ "10044" => Ok(Self::AubMsgCodeMissing),
+ "10045" => Ok(Self::AubVersionMissing),
+ "10046" => Ok(Self::AubEncTypeMissing),
+ "10047" => Ok(Self::AubSignMissing),
+ "10048" => Ok(Self::AubInfoMissing),
+ "10049" => Ok(Self::AubErrorCodeMissing),
+ "10050" => Ok(Self::AubMsgTypeInvalid),
+ "10051" => Ok(Self::AubMsgCodeInvalid),
+ "10052" => Ok(Self::AubBaidMissing),
+ "10053" => Ok(Self::AubResponseSignNotMatch),
+ "10054" => Ok(Self::SmsConnectionTimeout),
+ "10055" => Ok(Self::SmsConnectionIssue),
+ "10056" => Ok(Self::SmsConfirmErrorFromPh),
+ "10057" => Ok(Self::SmsMsgTypeMissing),
+ "10058" => Ok(Self::SmsMsgCodeMissing),
+ "10059" => Ok(Self::SmsVersionMissing),
+ "10060" => Ok(Self::SmsEncTypeMissing),
+ "10061" => Ok(Self::SmsSignMissing),
+ "10062" => Ok(Self::SmsInfoMissing),
+ "10063" => Ok(Self::SmsErrorCodeMissing),
+ "10064" => Ok(Self::SmsMsgTypeInvalid),
+ "10065" => Ok(Self::SmsMsgCodeInvalid),
+ "10066" => Ok(Self::SmsResponseSignNotMatch),
+ "10067" => Ok(Self::SmsRequestReachMaximumLimit),
+ "10068" => Ok(Self::SyncConnectionTimeout),
+ "10069" => Ok(Self::SyncConnectionIssue),
+ "10070" => Ok(Self::SyncConfirmErrorFromPh),
+ "10071" => Ok(Self::SyncMsgTypeMissing),
+ "10072" => Ok(Self::SyncMsgCodeMissing),
+ "10073" => Ok(Self::SyncVersionMissing),
+ "10074" => Ok(Self::SyncEncTypeMissing),
+ "10075" => Ok(Self::SyncSignMissing),
+ "10076" => Ok(Self::SyncInfoMissing),
+ "10077" => Ok(Self::SyncErrorCodeMissing),
+ "10078" => Ok(Self::SyncMsgTypeInvalid),
+ "10079" => Ok(Self::SyncMsgCodeInvalid),
+ "10080" => Ok(Self::SyncResponseSignNotMatch),
+ "10081" => Ok(Self::AccountExpired),
+ "10082" => Ok(Self::ExceedMaxMinAmount),
+ "10083" => Ok(Self::WholeNumberAmountLessThanOne),
+ "10084" => Ok(Self::AddDepositRecordToSchemeChannel),
+ "10085" => Ok(Self::UpdateUtilizedAmountFailAfterSuccessResponse),
+ "10086" => Ok(Self::PidResponseInvalidFormat),
+ "10087" => Ok(Self::PspNameNotFound),
+ "10088" => Ok(Self::LangIsMissing),
+ "10089" => Ok(Self::FailureCallbackUrlInvalid),
+ "10090" => Ok(Self::SuccessRedirectUrlInvalid),
+ "10091" => Ok(Self::FailureRedirectUrlInvalid),
+ "10092" => Ok(Self::LangValueInvalid),
+ "10093" => Ok(Self::OnlineDepositSessionTimeout),
+ "10094" => Ok(Self::AccessPaymentPageRouteFieldMissing),
+ "10095" => Ok(Self::AmountNotMatch),
+ "10096" => Ok(Self::PidCallbackFieldsMissing),
+ "10097" => Ok(Self::TokenNotMatch),
+ "10098" => Ok(Self::OperationDuplicated),
+ "10099" => Ok(Self::PayPageDomainNotAvailable),
+ "10100" => Ok(Self::PayPageConfirmSignatureNotMatch),
+ "10101" => Ok(Self::PaymentPageConfirmationFieldMissing),
+ "10102" => Ok(Self::MultipleCallbackFromPsp),
+ "10103" => Ok(Self::PidNotAvailable),
+ "10104" => Ok(Self::PidDepositUrlNotValidOrEmp),
+ "10105" => Ok(Self::PspSelfRedirectTagNotValid),
+ "20000" => Ok(Self::InternalError20000),
+ "20001" => Ok(Self::DepositTimeout),
+ _ => Err(errors::ConnectorError::ResponseHandlingFailed.into()),
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, strum::Display)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum ZslResponseStatus {
+ Normal,
+ InternalError,
+ BreakDownMessageError,
+ FormatError,
+ InvalidTransaction,
+ TransactionCountryNotFound,
+ MerchantIdNotFound,
+ AccountDisabled,
+ DuplicateMerchantReference,
+ InvalidPayAmount,
+ PayAmountNotFound,
+ InvalidCurrencyCode,
+ CurrencyCodeNotFound,
+ ReferenceNotFound,
+ TransmissionTimeNotFound,
+ PayMethodNotFound,
+ BankCodeNotFound,
+ InvalidShowPayPage,
+ ShowPayPageNotFound,
+ SuccessUrlNotFound,
+ SuccessCallbackUrlNotFound,
+ FailUrlNotFound,
+ FailCallbackUrlNotFound,
+ MacNotFound,
+ OriginalTransactionNotFound,
+ DeblockDataError,
+ PspAckNotYetReturn,
+ BankBranchNameNotFound,
+ BankAccountIDNotFound,
+ BankAccountNameNotFound,
+ IdentityIDNotFound,
+ ErrorConnectingToPsp,
+ CountryPspNotAvailable,
+ UnsupportedPayAmount,
+ RecordMismatch,
+ NoRecord,
+ PspError,
+ UnsupportedEncryptionType,
+ ExceedTransactionLimitCount,
+ ExceedTransactionLimitAmount,
+ ExceedTransactionAccountLimitCount,
+ ExceedTransactionAccountLimitAmount,
+ ExchangeRateError,
+ InvalidEncoding,
+ CustomerNameNotFound,
+ CustomerFamilyNameNotFound,
+ CustomerTelPhoneNotFound,
+ InsufficientFund,
+ ServiceCodeIsMissing,
+ CurrencyIdNotMatch,
+ NoPendingRecord,
+ NoLoadBalancerRuleDefineForTransaction,
+ NoPaymentProviderAvailable,
+ UnsupportedPayMethod,
+ PendingTransaction,
+ OtherError1059,
+ OtherError1058,
+ InvalidRequestId,
+ BeneficiaryBankAccountIsNotAvailable,
+ BaidNotFound,
+ InvalidBaid,
+ InvalidBaidStatus,
+ AutoUploadBankDisabled,
+ InvalidNature,
+ SmsCreateDateNotFound,
+ InvalidSmsCreateDate,
+ RecordNotFound,
+ InsufficientBaidAvailableBalance,
+ ExceedTxnAmountLimit,
+ BaidBalanceNotFound,
+ AutoUploadIndicatorNotFound,
+ InvalidBankAcctStatus,
+ InvalidAutoUploadIndicator,
+ InvalidPidStatus,
+ InvalidProviderStatus,
+ InvalidBankAccountSystemSwitchEnabled,
+ AutoUploadProviderDisabled,
+ AutoUploadBankNotFound,
+ AutoUploadBankAcctNotFound,
+ AutoUploadProviderNotFound,
+ UnsupportedBankCode,
+ BalanceOverrideIndicatorNotFound,
+ InvalidBalanceOverrideIndicator,
+ VernoInvalid,
+ ServiceCodeInvalid,
+ PspResponseSignatureIsNotValid,
+ ProcessTypeNotFound,
+ ProcessCodeNotFound,
+ EnctypeNotFound,
+ VernoNotFound,
+ DepositBankNotFound,
+ DepositFlowNotFound,
+ CustDepositDateNotFound,
+ CustTagNotFound,
+ CountryValueInvalid,
+ CurrencyCodeValueInvalid,
+ MerTxnDateInvalid,
+ CustDepositDateInvalid,
+ TxnAmtInvalid,
+ SuccessCallbackUrlInvalid,
+ DepositFlowInvalid,
+ ProcessTypeInvalid,
+ ProcessCodeInvalid,
+ UnsupportedMerRefLength,
+ DepositBankLengthOverLimit,
+ CustTagLengthOverLimit,
+ SignatureLengthOverLimit,
+ RequestContainInvalidTag,
+ RequestSignatureNotMatch,
+ InvalidCustomer,
+ SchemeNotFound,
+ PspResponseFieldsMissing,
+ PspResponseMerRefNotMatchWithRequestMerRef,
+ PspResponseMerIdNotMatchWithRequestMerId,
+ UpdateDepositFailAfterResponse,
+ UpdateUsedLimitTransactionCountFailAfterSuccessResponse,
+ UpdateCustomerLastDepositRecordAfterSuccessResponse,
+ CreateDepositFail,
+ CreateDepositMsgFail,
+ UpdateStatusSubStatusFail,
+ AddDepositRecordToSchemeAccount,
+ EmptyResponse,
+ AubConfirmErrorFromPh,
+ ProviderEmailAddressNotFound,
+ AubConnectionTimeout,
+ AubConnectionIssue,
+ AubMsgTypeMissing,
+ AubMsgCodeMissing,
+ AubVersionMissing,
+ AubEncTypeMissing,
+ AubSignMissing,
+ AubInfoMissing,
+ AubErrorCodeMissing,
+ AubMsgTypeInvalid,
+ AubMsgCodeInvalid,
+ AubBaidMissing,
+ AubResponseSignNotMatch,
+ SmsConnectionTimeout,
+ SmsConnectionIssue,
+ SmsConfirmErrorFromPh,
+ SmsMsgTypeMissing,
+ SmsMsgCodeMissing,
+ SmsVersionMissing,
+ SmsEncTypeMissing,
+ SmsSignMissing,
+ SmsInfoMissing,
+ SmsErrorCodeMissing,
+ SmsMsgTypeInvalid,
+ SmsMsgCodeInvalid,
+ SmsResponseSignNotMatch,
+ SmsRequestReachMaximumLimit,
+ SyncConnectionTimeout,
+ SyncConnectionIssue,
+ SyncConfirmErrorFromPh,
+ SyncMsgTypeMissing,
+ SyncMsgCodeMissing,
+ SyncVersionMissing,
+ SyncEncTypeMissing,
+ SyncSignMissing,
+ SyncInfoMissing,
+ SyncErrorCodeMissing,
+ SyncMsgTypeInvalid,
+ SyncMsgCodeInvalid,
+ SyncResponseSignNotMatch,
+ AccountExpired,
+ ExceedMaxMinAmount,
+ WholeNumberAmountLessThanOne,
+ AddDepositRecordToSchemeChannel,
+ UpdateUtilizedAmountFailAfterSuccessResponse,
+ PidResponseInvalidFormat,
+ PspNameNotFound,
+ LangIsMissing,
+ FailureCallbackUrlInvalid,
+ SuccessRedirectUrlInvalid,
+ FailureRedirectUrlInvalid,
+ LangValueInvalid,
+ OnlineDepositSessionTimeout,
+ AccessPaymentPageRouteFieldMissing,
+ AmountNotMatch,
+ PidCallbackFieldsMissing,
+ TokenNotMatch,
+ OperationDuplicated,
+ PayPageDomainNotAvailable,
+ PayPageConfirmSignatureNotMatch,
+ PaymentPageConfirmationFieldMissing,
+ MultipleCallbackFromPsp,
+ PidNotAvailable,
+ PidDepositUrlNotValidOrEmp,
+ PspSelfRedirectTagNotValid,
+ InternalError20000,
+ DepositTimeout,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ZslErrorResponse {
- pub status_code: u16,
- pub code: String,
- pub message: String,
- pub reason: Option<String>,
+ pub status: String,
+}
+
+pub enum ZslSignatureType {
+ RequestSignature {
+ txn_amt: String,
+ ccy: String,
+ mer_ref: String,
+ mer_id: String,
+ mer_txn_date: String,
+ key: String,
+ },
+ ResponseSignature {
+ status: String,
+ txn_url: String,
+ mer_ref: String,
+ mer_id: String,
+ key: String,
+ },
+ WebhookSignature {
+ status: String,
+ txn_id: String,
+ txn_date: String,
+ paid_ccy: String,
+ paid_amt: String,
+ mer_ref: String,
+ mer_id: String,
+ key: String,
+ },
+}
+
+pub fn calculate_signature(
+ enctype: EncodingType,
+ signature_data: ZslSignatureType,
+) -> Result<Secret<String>, error_stack::Report<errors::ConnectorError>> {
+ let signature_data = match signature_data {
+ ZslSignatureType::RequestSignature {
+ txn_amt,
+ ccy,
+ mer_ref,
+ mer_id,
+ mer_txn_date,
+ key,
+ } => format!("{txn_amt}{ccy}{mer_ref}{mer_id}{mer_txn_date}{key}"),
+ ZslSignatureType::ResponseSignature {
+ status,
+ txn_url,
+ mer_ref,
+ mer_id,
+ key,
+ } => {
+ format!("{status}{txn_url}{mer_ref}{mer_id}{key}")
+ }
+ ZslSignatureType::WebhookSignature {
+ status,
+ txn_id,
+ txn_date,
+ paid_ccy,
+ paid_amt,
+ mer_ref,
+ mer_id,
+ key,
+ } => format!("{status}{txn_id}{txn_date}{paid_ccy}{paid_amt}{mer_ref}{mer_id}{key}"),
+ };
+ let message = signature_data.as_bytes();
+
+ let encoded_data = match enctype {
+ EncodingType::MD5 => hex::encode(
+ common_utils::crypto::Md5
+ .generate_digest(message)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?,
+ ),
+ EncodingType::Sha1 => {
+ hex::encode(digest::digest(&digest::SHA1_FOR_LEGACY_USE_ONLY, message))
+ }
+ };
+ Ok(Secret::new(encoded_data))
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index eaa63f1b2f..c7e1e4118b 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1916,10 +1916,10 @@ pub(crate) fn validate_auth_and_metadata_type(
zen::transformers::ZenAuthType::try_from(val)?;
Ok(())
}
- // api_enums::Connector::Zsl => {
- // zsl::transformers::ZslAuthType::try_from(val)?;
- // Ok(())
- // } Added as template code for future usage
+ api_enums::Connector::Zsl => {
+ zsl::transformers::ZslAuthType::try_from(val)?;
+ Ok(())
+ }
api_enums::Connector::Signifyd => {
signifyd::transformers::SignifydAuthType::try_from(val)?;
Ok(())
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index bc75f794c7..dd7a082195 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -385,7 +385,7 @@ impl ConnectorData {
enums::Connector::Tsys => Ok(Box::new(&connector::Tsys)),
enums::Connector::Volt => Ok(Box::new(&connector::Volt)),
enums::Connector::Zen => Ok(Box::new(&connector::Zen)),
- // enums::Connector::Zsl => Ok(Box::new(&connector::Zsl)), Added as template code for future usage
+ enums::Connector::Zsl => Ok(Box::new(&connector::Zsl)),
enums::Connector::Signifyd
| enums::Connector::Plaid
| enums::Connector::Riskified
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 34941d8998..ace6b725f7 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -247,7 +247,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Worldline => Self::Worldline,
api_enums::Connector::Worldpay => Self::Worldpay,
api_enums::Connector::Zen => Self::Zen,
- // api_enums::Connector::Zsl => Self::Zsl, Added as template code for future usage
+ api_enums::Connector::Zsl => Self::Zsl,
#[cfg(feature = "dummy_connector")]
api_enums::Connector::DummyConnector1 => Self::DummyConnector1,
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 6f260de51d..a1b1940fc8 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -207,8 +207,6 @@ api_key="API Key"
[ebanx]
api_key="API Key"
-
[zsl]
-api_key="API Key"
+api_key= "Key"
key1= "Merchant id"
-
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 99770c7ff9..2f67bae0d1 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -7182,7 +7182,8 @@
"signifyd",
"plaid",
"riskified",
- "zen"
+ "zen",
+ "zsl"
]
},
"ConnectorMetadata": {
@@ -16967,7 +16968,8 @@
"wise",
"worldline",
"worldpay",
- "zen"
+ "zen",
+ "zsl"
]
},
"RoutingAlgorithm": {
diff --git a/postman/collection-dir/zsl/.auth.json b/postman/collection-dir/zsl/.auth.json
new file mode 100644
index 0000000000..915a283579
--- /dev/null
+++ b/postman/collection-dir/zsl/.auth.json
@@ -0,0 +1,22 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ }
+}
diff --git a/postman/collection-dir/zsl/.event.meta.json b/postman/collection-dir/zsl/.event.meta.json
new file mode 100644
index 0000000000..2df9d47d93
--- /dev/null
+++ b/postman/collection-dir/zsl/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.prerequest.js",
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/.info.json b/postman/collection-dir/zsl/.info.json
new file mode 100644
index 0000000000..4104ea8926
--- /dev/null
+++ b/postman/collection-dir/zsl/.info.json
@@ -0,0 +1,9 @@
+{
+ "info": {
+ "_postman_id": "3a6c03f2-c084-4e35-a559-4dc0f2808fe9",
+ "name": "zsl",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "27028646"
+ }
+}
diff --git a/postman/collection-dir/zsl/.meta.json b/postman/collection-dir/zsl/.meta.json
new file mode 100644
index 0000000000..91b6a65c5b
--- /dev/null
+++ b/postman/collection-dir/zsl/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Health check",
+ "Flow Testcases"
+ ]
+}
diff --git a/postman/collection-dir/zsl/.variable.json b/postman/collection-dir/zsl/.variable.json
new file mode 100644
index 0000000000..7341fd0b82
--- /dev/null
+++ b/postman/collection-dir/zsl/.variable.json
@@ -0,0 +1,94 @@
+{
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/.meta.json b/postman/collection-dir/zsl/Flow Testcases/.meta.json
new file mode 100644
index 0000000000..bd972090b1
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "QuickStart",
+ "Happy Cases"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json
new file mode 100644
index 0000000000..baaff734b0
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "Scenario1-Create payment with confirm true"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json
new file mode 100644
index 0000000000..abc159198a
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json
new file mode 100644
index 0000000000..4ac527d834
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js
new file mode 100644
index 0000000000..30cad8de4e
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// Response body should have redirect_to_url as next action type
+if (jsonData?.next_action.type) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.next_action.type).to.eql("redirect_to_url");
+ },
+ );
+}
+
+// Response body should have status = requires_customer_action
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
new file mode 100644
index 0000000000..6609ff9bb9
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -0,0 +1,88 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "amount_to_capture": 6540,
+ "authentication_type": "three_ds",
+ "billing": {
+ "address": {
+ "city": "San Fransico",
+ "country": "CN",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "confirm": true,
+ "currency": "CNY",
+ "customer_id": "StripeCustomer",
+ "description": "Its my first payment request",
+ "email": "[email protected]",
+ "metadata": {
+ "login_date": "2019-09-10T10:11:12Z",
+ "new_customer": "true",
+ "udf1": "value1"
+ },
+ "name": "John Doe",
+ "payment_method": "bank_transfer",
+ "payment_method_type": "local_bank_transfer",
+ "payment_method_data": {
+ "bank_transfer": {
+ "local_bank_transfer": {}
+ }
+ },
+ "phone": "999999999",
+ "phone_country_code": "+1",
+ "return_url": "https://duck.com",
+ "shipping": {
+ "address": {
+ "city": "San Fransico",
+ "country": "US",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "browser_info": {
+ "language": "en-EN"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json
new file mode 100644
index 0000000000..7d3e10f6db
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Merchant Account - Create",
+ "API Key - Create",
+ "Payment Connector - Create",
+ "Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
new file mode 100644
index 0000000000..688c85746e
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js
new file mode 100644
index 0000000000..4e27c5a502
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js
@@ -0,0 +1,46 @@
+// Validate status 2xx
+pm.test("[POST]::/api_keys/:merchant_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/api_keys/:merchant_id - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id
+if (jsonData?.key_id) {
+ pm.collectionVariables.set("api_key_id", jsonData.key_id);
+ console.log(
+ "- use {{api_key_id}} as collection variable for value",
+ jsonData.key_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set api_key as variable for jsonData.api_key
+if (jsonData?.api_key) {
+ pm.collectionVariables.set("api_key", jsonData.api_key);
+ console.log(
+ "- use {{api_key}} as collection variable for value",
+ jsonData.api_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.",
+ );
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json
new file mode 100644
index 0000000000..4e4c662849
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json
@@ -0,0 +1,52 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw_json_formatted": {
+ "name": "API Key 1",
+ "description": null,
+ "expiration": "2069-09-23T01:02:03.000Z"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
new file mode 100644
index 0000000000..4ac527d834
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
new file mode 100644
index 0000000000..d3d62bd40e
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
@@ -0,0 +1,55 @@
+// Validate status 2xx
+pm.test("[POST]::/accounts - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/accounts - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id
+if (jsonData?.merchant_id) {
+ pm.collectionVariables.set("merchant_id", jsonData.merchant_id);
+ console.log(
+ "- use {{merchant_id}} as collection variable for value",
+ jsonData.merchant_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set api_key as variable for jsonData.api_key
+if (jsonData?.api_key) {
+ pm.collectionVariables.set("api_key", jsonData.api_key);
+ console.log(
+ "- use {{api_key}} as collection variable for value",
+ jsonData.api_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key
+if (jsonData?.publishable_key) {
+ pm.collectionVariables.set("publishable_key", jsonData.publishable_key);
+ console.log(
+ "- use {{publishable_key}} as collection variable for value",
+ jsonData.publishable_key,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.",
+ );
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json
new file mode 100644
index 0000000000..ffeea3410a
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json
@@ -0,0 +1,95 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "merchant_id": "postman_merchant_GHAction_{{$guid}}",
+ "locker_id": "m0010",
+ "merchant_name": "NewAge Retailer",
+ "primary_business_details": [
+ {
+ "country": "US",
+ "business": "default"
+ }
+ ],
+ "merchant_details": {
+ "primary_contact_person": "John Test",
+ "primary_email": "[email protected]",
+ "primary_phone": "sunt laborum",
+ "secondary_contact_person": "John Test2",
+ "secondary_email": "[email protected]",
+ "secondary_phone": "cillum do dolor id",
+ "website": "www.example.com",
+ "about_business": "Online Retail with a wide selection of organic products for North America",
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US"
+ }
+ },
+ "return_url": "https://duck.com",
+ "webhook_details": {
+ "webhook_version": "1.0.1",
+ "webhook_username": "ekart_retail",
+ "webhook_password": "password_ekart@123",
+ "payment_created_enabled": true,
+ "payment_succeeded_enabled": true,
+ "payment_failed_enabled": true
+ },
+ "sub_merchants_enabled": false,
+ "metadata": {
+ "city": "NY",
+ "unit": "245"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
new file mode 100644
index 0000000000..688c85746e
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
new file mode 100644
index 0000000000..88e92d8d84
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
@@ -0,0 +1,39 @@
+// Validate status 2xx
+pm.test(
+ "[POST]::/account/:account_id/connectors - Status code is 2xx",
+ function () {
+ pm.response.to.be.success;
+ },
+);
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/account/:account_id/connectors - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id
+if (jsonData?.merchant_connector_id) {
+ pm.collectionVariables.set(
+ "merchant_connector_id",
+ jsonData.merchant_connector_id,
+ );
+ console.log(
+ "- use {{merchant_connector_id}} as collection variable for value",
+ jsonData.merchant_connector_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json
new file mode 100644
index 0000000000..bda34190e7
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json
@@ -0,0 +1,95 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "connector_type": "fiz_operations",
+ "connector_name": "zsl",
+ "connector_account_details": {
+ "auth_type": "BodyKey",
+ "api_key": "{{connector_api_key}}",
+ "key1": "{{connector_key1}}"
+ },
+ "test_mode": false,
+ "disabled": false,
+ "business_country": "US",
+ "business_label": "default",
+ "payment_methods_enabled": [
+ {
+ "payment_method": "bank_transfer",
+ "payment_method_types": [
+ {
+ "payment_method_type": "local_bank_transfer",
+ "payment_experience": "redirect_to_url",
+ "card_networks": null,
+ "accepted_currencies": null,
+ "accepted_countries": null,
+ "minimum_amount": -1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "city": "NY",
+ "unit": "245"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
new file mode 100644
index 0000000000..4ac527d834
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js
new file mode 100644
index 0000000000..30cad8de4e
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// Response body should have redirect_to_url as next action type
+if (jsonData?.next_action.type) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.next_action.type).to.eql("redirect_to_url");
+ },
+ );
+}
+
+// Response body should have status = requires_customer_action
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Next Action Check",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json
new file mode 100644
index 0000000000..6609ff9bb9
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -0,0 +1,88 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "amount_to_capture": 6540,
+ "authentication_type": "three_ds",
+ "billing": {
+ "address": {
+ "city": "San Fransico",
+ "country": "CN",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "confirm": true,
+ "currency": "CNY",
+ "customer_id": "StripeCustomer",
+ "description": "Its my first payment request",
+ "email": "[email protected]",
+ "metadata": {
+ "login_date": "2019-09-10T10:11:12Z",
+ "new_customer": "true",
+ "udf1": "value1"
+ },
+ "name": "John Doe",
+ "payment_method": "bank_transfer",
+ "payment_method_type": "local_bank_transfer",
+ "payment_method_data": {
+ "bank_transfer": {
+ "local_bank_transfer": {}
+ }
+ },
+ "phone": "999999999",
+ "phone_country_code": "+1",
+ "return_url": "https://duck.com",
+ "shipping": {
+ "address": {
+ "city": "San Fransico",
+ "country": "US",
+ "first_name": "PiX",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "state": "California",
+ "zip": "94122"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "browser_info": {
+ "language": "en-EN"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/Health check/.meta.json b/postman/collection-dir/zsl/Health check/.meta.json
new file mode 100644
index 0000000000..66ee7e50ca
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "New Request"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Health check/New Request/.event.meta.json b/postman/collection-dir/zsl/Health check/New Request/.event.meta.json
new file mode 100644
index 0000000000..688c85746e
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/zsl/Health check/New Request/event.test.js b/postman/collection-dir/zsl/Health check/New Request/event.test.js
new file mode 100644
index 0000000000..b490b8be09
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/event.test.js
@@ -0,0 +1,4 @@
+// Validate status 2xx
+pm.test("[POST]::/accounts - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
diff --git a/postman/collection-dir/zsl/Health check/New Request/request.json b/postman/collection-dir/zsl/Health check/New Request/request.json
new file mode 100644
index 0000000000..4e1e0a0d9e
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/request.json
@@ -0,0 +1,13 @@
+{
+ "method": "GET",
+ "header": [],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+}
diff --git a/postman/collection-dir/zsl/Health check/New Request/response.json b/postman/collection-dir/zsl/Health check/New Request/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/zsl/Health check/New Request/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/zsl/event.prerequest.js b/postman/collection-dir/zsl/event.prerequest.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/postman/collection-dir/zsl/event.test.js b/postman/collection-dir/zsl/event.test.js
new file mode 100644
index 0000000000..fb52caec30
--- /dev/null
+++ b/postman/collection-dir/zsl/event.test.js
@@ -0,0 +1,13 @@
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log("[LOG]::payment_id - " + jsonData.payment_id);
+}
+
+console.log("[LOG]::x-request-id - " + pm.response.headers.get("x-request-id"));
diff --git a/postman/collection-json/zsl.postman_collection.json b/postman/collection-json/zsl.postman_collection.json
new file mode 100644
index 0000000000..ff69c558ec
--- /dev/null
+++ b/postman/collection-json/zsl.postman_collection.json
@@ -0,0 +1,796 @@
+{
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);",
+ "}",
+ "",
+ "console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get(\"x-request-id\"));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "item": [
+ {
+ "name": "Health check",
+ "item": [
+ {
+ "name": "New Request",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Flow Testcases",
+ "item": [
+ {
+ "name": "QuickStart",
+ "item": [
+ {
+ "name": "Merchant Account - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/accounts - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id",
+ "if (jsonData?.merchant_id) {",
+ " pm.collectionVariables.set(\"merchant_id\", jsonData.merchant_id);",
+ " console.log(",
+ " \"- use {{merchant_id}} as collection variable for value\",",
+ " jsonData.merchant_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key",
+ "if (jsonData?.publishable_key) {",
+ " pm.collectionVariables.set(\"publishable_key\", jsonData.publishable_key);",
+ " console.log(",
+ " \"- use {{publishable_key}} as collection variable for value\",",
+ " jsonData.publishable_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"merchant_id\":\"postman_merchant_GHAction_{{$guid}}\",\"locker_id\":\"m0010\",\"merchant_name\":\"NewAge Retailer\",\"primary_business_details\":[{\"country\":\"US\",\"business\":\"default\"}],\"merchant_details\":{\"primary_contact_person\":\"John Test\",\"primary_email\":\"[email protected]\",\"primary_phone\":\"sunt laborum\",\"secondary_contact_person\":\"John Test2\",\"secondary_email\":\"[email protected]\",\"secondary_phone\":\"cillum do dolor id\",\"website\":\"www.example.com\",\"about_business\":\"Online Retail with a wide selection of organic products for North America\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"return_url\":\"https://duck.com\",\"webhook_details\":{\"webhook_version\":\"1.0.1\",\"webhook_username\":\"ekart_retail\",\"webhook_password\":\"password_ekart@123\",\"payment_created_enabled\":true,\"payment_succeeded_enabled\":true,\"payment_failed_enabled\":true},\"sub_merchants_enabled\":false,\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/accounts",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts"
+ ]
+ },
+ "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments."
+ },
+ "response": []
+ },
+ {
+ "name": "API Key - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/api_keys/:merchant_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/api_keys/:merchant_id - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id",
+ "if (jsonData?.key_id) {",
+ " pm.collectionVariables.set(\"api_key_id\", jsonData.key_id);",
+ " console.log(",
+ " \"- use {{api_key_id}} as collection variable for value\",",
+ " jsonData.key_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set api_key as variable for jsonData.api_key",
+ "if (jsonData?.api_key) {",
+ " pm.collectionVariables.set(\"api_key\", jsonData.api_key);",
+ " console.log(",
+ " \"- use {{api_key}} as collection variable for value\",",
+ " jsonData.api_key,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/api_keys/:merchant_id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "api_keys",
+ ":merchant_id"
+ ],
+ "variable": [
+ {
+ "key": "merchant_id",
+ "value": "{{merchant_id}}"
+ }
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Payment Connector - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Status code is 2xx\",",
+ " function () {",
+ " pm.response.to.be.success;",
+ " },",
+ ");",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/account/:account_id/connectors - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id",
+ "if (jsonData?.merchant_connector_id) {",
+ " pm.collectionVariables.set(",
+ " \"merchant_connector_id\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ " console.log(",
+ " \"- use {{merchant_connector_id}} as collection variable for value\",",
+ " jsonData.merchant_connector_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.\",",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{admin_api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"zsl\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"bank_transfer\",\"payment_method_types\":[{\"payment_method_type\":\"local_bank_transfer\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":-1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}],\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/account/:account_id/connectors",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}",
+ "description": "(Required) The unique identifier for the merchant account"
+ }
+ ]
+ },
+ "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have redirect_to_url as next action type",
+ "if (jsonData?.next_action.type) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.next_action.type).to.eql(\"redirect_to_url\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have status = requires_customer_action",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"amount_to_capture\":6540,\"authentication_type\":\"three_ds\",\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"CN\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"confirm\":true,\"currency\":\"CNY\",\"customer_id\":\"StripeCustomer\",\"description\":\"Its my first payment request\",\"email\":\"[email protected]\",\"metadata\":{\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\",\"udf1\":\"value1\"},\"name\":\"John Doe\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"local_bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"local_bank_transfer\":{}}},\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"return_url\":\"https://duck.com\",\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"browser_info\":{\"language\":\"en-EN\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Happy Cases",
+ "item": [
+ {
+ "name": "Scenario1-Create payment with confirm true",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have redirect_to_url as next action type",
+ "if (jsonData?.next_action.type) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.next_action.type).to.eql(\"redirect_to_url\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have status = requires_customer_action",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Next Action Check\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"amount_to_capture\":6540,\"authentication_type\":\"three_ds\",\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"CN\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"confirm\":true,\"currency\":\"CNY\",\"customer_id\":\"StripeCustomer\",\"description\":\"Its my first payment request\",\"email\":\"[email protected]\",\"metadata\":{\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\",\"udf1\":\"value1\"},\"name\":\"John Doe\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"local_bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"local_bank_transfer\":{}}},\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"return_url\":\"https://duck.com\",\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"browser_info\":{\"language\":\"en-EN\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{api_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "info": {
+ "_postman_id": "3a6c03f2-c084-4e35-a559-4dc0f2808fe9",
+ "name": "zsl",
+ "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "27028646"
+ },
+ "variable": [
+ {
+ "key": "baseUrl",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "admin_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "merchant_id",
+ "value": ""
+ },
+ {
+ "key": "payment_id",
+ "value": ""
+ },
+ {
+ "key": "customer_id",
+ "value": ""
+ },
+ {
+ "key": "mandate_id",
+ "value": ""
+ },
+ {
+ "key": "payment_method_id",
+ "value": ""
+ },
+ {
+ "key": "refund_id",
+ "value": ""
+ },
+ {
+ "key": "merchant_connector_id",
+ "value": ""
+ },
+ {
+ "key": "client_secret",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "api_key_id",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "payment_token",
+ "value": ""
+ },
+ {
+ "key": "gateway_merchant_id",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string",
+ "disabled": true
+ },
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}