hash
stringlengths 40
40
| date
stringdate 2022-11-17 13:04:47
2025-03-21 17:04:41
| author
stringclasses 141
values | commit_message
stringlengths 22
166
| is_merge
bool 1
class | git_diff
stringlengths 238
9.63M
| type
stringclasses 17
values | masked_commit_message
stringlengths 6
143
|
|---|---|---|---|---|---|---|---|
53e5307c3cc3ae2b9f1d93d6c1e4d8e7827def7c
|
2024-04-18 19:14:35
|
Apoorv Dixit
|
feat(payments): add amount and connector id filter in list (#4354)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 919f057d55b..b85734af8b8 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3394,6 +3394,8 @@ pub struct PaymentListFilterConstraints {
pub limit: u32,
/// The starting point within a list of objects
pub offset: Option<u32>,
+ /// The amount to filter payments list
+ pub amount_filter: Option<AmountFilter>,
/// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc).
#[serde(flatten)]
pub time_range: Option<TimeRange>,
@@ -3409,6 +3411,8 @@ pub struct PaymentListFilterConstraints {
pub payment_method_type: Option<Vec<enums::PaymentMethodType>>,
/// The list of authentication types to filter payments list
pub authentication_type: Option<Vec<enums::AuthenticationType>>,
+ /// The list of merchant connector ids to filter payments list for selected label
+ pub merchant_connector_id: Option<Vec<String>>,
}
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListFilters {
@@ -3440,6 +3444,12 @@ pub struct PaymentListFiltersV2 {
pub authentication_type: Vec<enums::AuthenticationType>,
}
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
+pub struct AmountFilter {
+ pub start_amount: Option<i64>,
+ pub end_amount: Option<i64>,
+}
+
#[derive(
Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
)]
diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs
index 74fdabecf17..0b988a195fa 100644
--- a/crates/common_utils/src/consts.rs
+++ b/crates/common_utils/src/consts.rs
@@ -22,7 +22,7 @@ pub static FRM_CONFIGS_EG: &str = r#"
/// Maximum limit for payments list get api
pub const PAYMENTS_LIST_MAX_LIMIT_V1: u32 = 100;
/// Maximum limit for payments list post api with filters
-pub const PAYMENTS_LIST_MAX_LIMIT_V2: u32 = 20;
+pub const PAYMENTS_LIST_MAX_LIMIT_V2: u32 = 50;
/// Default limit for payments list API
pub fn default_payments_list_limit() -> u32 {
10
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index 6c236729de4..ec0e0873168 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -99,6 +99,7 @@ pub trait PaymentAttemptInterface {
payment_method: Option<Vec<storage_enums::PaymentMethod>>,
payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
+ merchant_connector_id: Option<Vec<String>>,
storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<i64, errors::StorageError>;
}
diff --git a/crates/data_models/src/payments/payment_intent.rs b/crates/data_models/src/payments/payment_intent.rs
index 83b266c3470..0ab39bcbad2 100644
--- a/crates/data_models/src/payments/payment_intent.rs
+++ b/crates/data_models/src/payments/payment_intent.rs
@@ -430,12 +430,14 @@ pub struct PaymentIntentListParams {
pub offset: u32,
pub starting_at: Option<PrimitiveDateTime>,
pub ending_at: Option<PrimitiveDateTime>,
+ pub amount_filter: Option<api_models::payments::AmountFilter>,
pub connector: Option<Vec<api_models::enums::Connector>>,
pub currency: Option<Vec<storage_enums::Currency>>,
pub status: Option<Vec<storage_enums::IntentStatus>>,
pub payment_method: Option<Vec<storage_enums::PaymentMethod>>,
pub payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
pub authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
+ pub merchant_connector_id: Option<Vec<String>>,
pub profile_id: Option<String>,
pub customer_id: Option<String>,
pub starting_after_id: Option<String>,
@@ -449,12 +451,14 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCo
offset: 0,
starting_at: value.created_gte.or(value.created_gt).or(value.created),
ending_at: value.created_lte.or(value.created_lt).or(value.created),
+ amount_filter: None,
connector: None,
currency: None,
status: None,
payment_method: None,
payment_method_type: None,
authentication_type: None,
+ merchant_connector_id: None,
profile_id: None,
customer_id: value.customer_id,
starting_after_id: value.starting_after,
@@ -470,12 +474,14 @@ impl From<api_models::payments::TimeRange> for PaymentIntentFetchConstraints {
offset: 0,
starting_at: Some(value.start_time),
ending_at: value.end_time,
+ amount_filter: None,
connector: None,
currency: None,
status: None,
payment_method: None,
payment_method_type: None,
authentication_type: None,
+ merchant_connector_id: None,
profile_id: None,
customer_id: None,
starting_after_id: None,
@@ -494,12 +500,14 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
offset: value.offset.unwrap_or_default(),
starting_at: value.time_range.map(|t| t.start_time),
ending_at: value.time_range.and_then(|t| t.end_time),
+ amount_filter: value.amount_filter,
connector: value.connector,
currency: value.currency,
status: value.status,
payment_method: value.payment_method,
payment_method_type: value.payment_method_type,
authentication_type: value.authentication_type,
+ merchant_connector_id: value.merchant_connector_id,
profile_id: value.profile_id,
customer_id: value.customer_id,
starting_after_id: None,
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index 0133c52c5db..f23c2318899 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -309,6 +309,8 @@ impl PaymentAttempt {
filter_authentication_type,
))
}
+
+ #[allow(clippy::too_many_arguments)]
pub async fn get_total_count_of_attempts(
conn: &PgPooledConn,
merchant_id: &str,
@@ -317,6 +319,7 @@ impl PaymentAttempt {
payment_method: Option<Vec<enums::PaymentMethod>>,
payment_method_type: Option<Vec<enums::PaymentMethodType>>,
authentication_type: Option<Vec<enums::AuthenticationType>>,
+ merchant_connector_id: Option<Vec<String>>,
) -> StorageResult<i64> {
let mut filter = <Self as HasTable>::table()
.count()
@@ -324,19 +327,22 @@ impl PaymentAttempt {
.filter(dsl::attempt_id.eq_any(active_attempt_ids.to_owned()))
.into_boxed();
- if let Some(connector) = connector.clone() {
+ if let Some(connector) = connector {
filter = filter.filter(dsl::connector.eq_any(connector));
}
- if let Some(payment_method) = payment_method.clone() {
+ if let Some(payment_method) = payment_method {
filter = filter.filter(dsl::payment_method.eq_any(payment_method));
}
- if let Some(payment_method_type) = payment_method_type.clone() {
+ if let Some(payment_method_type) = payment_method_type {
filter = filter.filter(dsl::payment_method_type.eq_any(payment_method_type));
}
- if let Some(authentication_type) = authentication_type.clone() {
+ if let Some(authentication_type) = authentication_type {
filter = filter.filter(dsl::authentication_type.eq_any(authentication_type));
}
+ if let Some(merchant_connector_id) = merchant_connector_id {
+ filter = filter.filter(dsl::merchant_connector_id.eq_any(merchant_connector_id))
+ }
router_env::logger::debug!(query = %debug_query::<Pg, _>(&filter).to_string());
db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index d9e22d4026d..a3292e3cd69 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -2579,6 +2579,7 @@ pub async fn apply_filters_on_payments(
constraints.payment_method,
constraints.payment_method_type,
constraints.authentication_type,
+ constraints.merchant_connector_id,
merchant.storage_scheme,
)
.await
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 7da40e505e8..73b519e5449 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1258,6 +1258,7 @@ impl PaymentAttemptInterface for KafkaStore {
payment_method: Option<Vec<common_enums::PaymentMethod>>,
payment_method_type: Option<Vec<common_enums::PaymentMethodType>>,
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
+ merchant_connector_id: Option<Vec<String>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::DataStorageError> {
self.diesel_store
@@ -1268,6 +1269,7 @@ impl PaymentAttemptInterface for KafkaStore {
payment_method,
payment_method_type,
authentication_type,
+ merchant_connector_id,
storage_scheme,
)
.await
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index c3331817784..c1d67c4ce00 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -922,14 +922,10 @@ pub async fn payments_list_by_filter(
state,
&req,
payload,
- |state, auth, req, _| {
+ |state, auth: auth::AuthenticationData, req, _| {
payments::apply_filters_on_payments(state, auth.merchant_account, req)
},
- auth::auth_type(
- &auth::ApiKeyAuth,
- &auth::JWTAuth(Permission::PaymentRead),
- req.headers(),
- ),
+ &auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
)
.await
@@ -948,12 +944,10 @@ pub async fn get_filters_for_payments(
state,
&req,
payload,
- |state, auth, req, _| payments::get_filters_for_payments(state, auth.merchant_account, req),
- auth::auth_type(
- &auth::ApiKeyAuth,
- &auth::JWTAuth(Permission::PaymentRead),
- req.headers(),
- ),
+ |state, auth: auth::AuthenticationData, req, _| {
+ payments::get_filters_for_payments(state, auth.merchant_account, req)
+ },
+ &auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
)
.await
@@ -971,12 +965,10 @@ pub async fn get_payment_filters(
state,
&req,
(),
- |state, auth, _, _| payments::get_payment_filters(state, auth.merchant_account),
- auth::auth_type(
- &auth::ApiKeyAuth,
- &auth::JWTAuth(Permission::PaymentRead),
- req.headers(),
- ),
+ |state, auth: auth::AuthenticationData, _, _| {
+ payments::get_payment_filters(state, auth.merchant_account)
+ },
+ &auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
)
.await
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index acec82e1721..996c8e102b7 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -42,6 +42,7 @@ impl PaymentAttemptInterface for MockDb {
_payment_method: Option<Vec<PaymentMethod>>,
_payment_method_type: Option<Vec<PaymentMethodType>>,
_authentication_type: Option<Vec<AuthenticationType>>,
+ _merchanat_connector_id: Option<Vec<String>>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<i64, StorageError> {
Err(StorageError::MockDbError)?
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 138f3658aa0..6eda689c8da 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -292,6 +292,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
payment_method: Option<Vec<PaymentMethod>>,
payment_method_type: Option<Vec<PaymentMethodType>>,
authentication_type: Option<Vec<AuthenticationType>>,
+ merchant_connector_id: Option<Vec<String>>,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
let conn = self
@@ -314,6 +315,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
payment_method,
payment_method_type,
authentication_type,
+ merchant_connector_id,
)
.await
.map_err(|er| {
@@ -1021,6 +1023,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
payment_method: Option<Vec<PaymentMethod>>,
payment_method_type: Option<Vec<PaymentMethodType>>,
authentication_type: Option<Vec<AuthenticationType>>,
+ merchant_connector_id: Option<Vec<String>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
@@ -1031,6 +1034,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
payment_method,
payment_method_type,
authentication_type,
+ merchant_connector_id,
storage_scheme,
)
.await
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 8934b3ba2c6..6b4cf8b82e1 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -1,5 +1,9 @@
#[cfg(feature = "olap")]
+use api_models::payments::AmountFilter;
+#[cfg(feature = "olap")]
use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};
+#[cfg(feature = "olap")]
+use common_utils::errors::ReportSwitchExt;
use common_utils::{date_time, ext_traits::Encode};
#[cfg(feature = "olap")]
use data_models::payments::payment_intent::PaymentIntentFetchConstraints;
@@ -549,8 +553,6 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
constraints: &PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
- use common_utils::errors::ReportSwitchExt;
-
let conn = connection::pg_connection_read(self).await.switch()?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
@@ -615,9 +617,26 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
query = query.offset(params.offset.into());
- if let Some(currency) = ¶ms.currency {
- query = query.filter(pi_dsl::currency.eq_any(currency.clone()));
- }
+ query = match params.amount_filter {
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.between(start, end)),
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: None,
+ }) => query.filter(pi_dsl::amount.ge(start)),
+ Some(AmountFilter {
+ start_amount: None,
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.le(end)),
+ _ => query,
+ };
+
+ query = match ¶ms.currency {
+ Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())),
+ None => query,
+ };
let connectors = params
.connector
@@ -653,6 +672,13 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
None => query,
};
+ query = match ¶ms.merchant_connector_id {
+ Some(merchant_connector_id) => query.filter(
+ pa_dsl::merchant_connector_id.eq_any(merchant_connector_id.clone()),
+ ),
+ None => query,
+ };
+
query
}
};
@@ -690,8 +716,6 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
constraints: &PaymentIntentFetchConstraints,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
- use common_utils::errors::ReportSwitchExt;
-
let conn = connection::pg_connection_read(self).await.switch()?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
@@ -722,6 +746,22 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
None => query,
};
+ query = match params.amount_filter {
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.between(start, end)),
+ Some(AmountFilter {
+ start_amount: Some(start),
+ end_amount: None,
+ }) => query.filter(pi_dsl::amount.ge(start)),
+ Some(AmountFilter {
+ start_amount: None,
+ end_amount: Some(end),
+ }) => query.filter(pi_dsl::amount.le(end)),
+ _ => query,
+ };
+
query = match ¶ms.currency {
Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())),
None => query,
|
feat
|
add amount and connector id filter in list (#4354)
|
fb397956adf20219e039548b6a3682ba526a23f4
|
2023-08-31 19:53:51
|
Mani Chandra
|
fix(mock_db): insert merchant for mock_db (#1984)
| false
|
diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs
index db76f94b229..d8bbd911de7 100644
--- a/crates/router/src/db/merchant_account.rs
+++ b/crates/router/src/db/merchant_account.rs
@@ -253,10 +253,17 @@ impl MerchantAccountInterface for MockDb {
#[allow(clippy::panic)]
async fn insert_merchant(
&self,
- merchant_account: domain::MerchantAccount,
+ mut merchant_account: domain::MerchantAccount,
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantAccount, errors::StorageError> {
let mut accounts = self.merchant_accounts.lock().await;
+ merchant_account.id.get_or_insert(
+ accounts
+ .len()
+ .try_into()
+ .into_report()
+ .change_context(errors::StorageError::MockDbError)?,
+ );
let account = Conversion::convert(merchant_account)
.await
.change_context(errors::StorageError::EncryptionError)?;
|
fix
|
insert merchant for mock_db (#1984)
|
9e420d511dcda08110d41db9afb205881f161c91
|
2023-01-27 17:56:29
|
Nishant Joshi
|
fix: fix bug when creating customer who is redacted (#466)
| false
|
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index de1646ce89b..699c114d59e 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -75,9 +75,11 @@ pub async fn create_customer(
if error.current_context().is_db_unique_violation() {
db.find_customer_by_customer_id_merchant_id(customer_id, merchant_id)
.await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable_lazy(|| {
- format!("Failed while fetching Customer, customer_id: {customer_id}")
+ .map_err(|err| {
+ err.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(format!(
+ "Failed while fetching Customer, customer_id: {customer_id}",
+ ))
})?
} else {
Err(error
|
fix
|
fix bug when creating customer who is redacted (#466)
|
f40d1441787977b911f72abe3d9112e4c25817d0
|
2023-07-25 11:28:43
|
Prasunna Soppa
|
fix(connector): [Paypal] fix amount to its currency base unit (#1780)
| false
|
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 01e3859f2d3..21badc9b80e 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -387,6 +387,226 @@ impl Currency {
Self::ZAR => "710",
}
}
+
+ pub fn is_zero_decimal_currency(self) -> bool {
+ match self {
+ Self::JPY | Self::KRW => true,
+ Self::AED
+ | Self::ALL
+ | Self::AMD
+ | Self::ANG
+ | Self::ARS
+ | Self::AUD
+ | Self::AWG
+ | Self::AZN
+ | Self::BBD
+ | Self::BDT
+ | Self::BHD
+ | Self::BMD
+ | Self::BND
+ | Self::BOB
+ | Self::BRL
+ | Self::BSD
+ | Self::BWP
+ | Self::BZD
+ | Self::CAD
+ | Self::CHF
+ | Self::CNY
+ | Self::COP
+ | Self::CRC
+ | Self::CUP
+ | Self::CZK
+ | Self::DKK
+ | Self::DOP
+ | Self::DZD
+ | Self::EGP
+ | Self::ETB
+ | Self::EUR
+ | Self::FJD
+ | Self::GBP
+ | Self::GHS
+ | Self::GIP
+ | Self::GMD
+ | Self::GTQ
+ | Self::GYD
+ | Self::HKD
+ | Self::HNL
+ | Self::HRK
+ | Self::HTG
+ | Self::HUF
+ | Self::IDR
+ | Self::ILS
+ | Self::INR
+ | Self::JMD
+ | Self::JOD
+ | Self::KES
+ | Self::KGS
+ | Self::KHR
+ | Self::KWD
+ | Self::KYD
+ | Self::KZT
+ | Self::LAK
+ | Self::LBP
+ | Self::LKR
+ | Self::LRD
+ | Self::LSL
+ | Self::MAD
+ | Self::MDL
+ | Self::MKD
+ | Self::MMK
+ | Self::MNT
+ | Self::MOP
+ | Self::MUR
+ | Self::MVR
+ | Self::MWK
+ | Self::MXN
+ | Self::MYR
+ | Self::NAD
+ | Self::NGN
+ | Self::NIO
+ | Self::NOK
+ | Self::NPR
+ | Self::NZD
+ | Self::OMR
+ | Self::PEN
+ | Self::PGK
+ | Self::PHP
+ | Self::PKR
+ | Self::PLN
+ | Self::QAR
+ | Self::RON
+ | Self::RUB
+ | Self::SAR
+ | Self::SCR
+ | Self::SEK
+ | Self::SGD
+ | Self::SLL
+ | Self::SOS
+ | Self::SSP
+ | Self::SVC
+ | Self::SZL
+ | Self::THB
+ | Self::TRY
+ | Self::TTD
+ | Self::TWD
+ | Self::TZS
+ | Self::USD
+ | Self::UYU
+ | Self::UZS
+ | Self::VND
+ | Self::YER
+ | Self::ZAR => false,
+ }
+ }
+
+ pub fn is_three_decimal_currency(self) -> bool {
+ match self {
+ Self::BHD | Self::JOD | Self::KWD | Self::OMR => true,
+ Self::AED
+ | Self::ALL
+ | Self::AMD
+ | Self::ANG
+ | Self::ARS
+ | Self::AUD
+ | Self::AWG
+ | Self::AZN
+ | Self::BBD
+ | Self::BDT
+ | Self::BMD
+ | Self::BND
+ | Self::BOB
+ | Self::BRL
+ | Self::BSD
+ | Self::BWP
+ | Self::BZD
+ | Self::CAD
+ | Self::CHF
+ | Self::CNY
+ | Self::COP
+ | Self::CRC
+ | Self::CUP
+ | Self::CZK
+ | Self::DKK
+ | Self::DOP
+ | Self::DZD
+ | Self::EGP
+ | Self::ETB
+ | Self::EUR
+ | Self::FJD
+ | Self::GBP
+ | Self::GHS
+ | Self::GIP
+ | Self::GMD
+ | Self::GTQ
+ | Self::GYD
+ | Self::HKD
+ | Self::HNL
+ | Self::HRK
+ | Self::HTG
+ | Self::HUF
+ | Self::IDR
+ | Self::ILS
+ | Self::INR
+ | Self::JMD
+ | Self::JPY
+ | Self::KES
+ | Self::KGS
+ | Self::KHR
+ | Self::KRW
+ | Self::KYD
+ | Self::KZT
+ | Self::LAK
+ | Self::LBP
+ | Self::LKR
+ | Self::LRD
+ | Self::LSL
+ | Self::MAD
+ | Self::MDL
+ | Self::MKD
+ | Self::MMK
+ | Self::MNT
+ | Self::MOP
+ | Self::MUR
+ | Self::MVR
+ | Self::MWK
+ | Self::MXN
+ | Self::MYR
+ | Self::NAD
+ | Self::NGN
+ | Self::NIO
+ | Self::NOK
+ | Self::NPR
+ | Self::NZD
+ | Self::PEN
+ | Self::PGK
+ | Self::PHP
+ | Self::PKR
+ | Self::PLN
+ | Self::QAR
+ | Self::RON
+ | Self::RUB
+ | Self::SAR
+ | Self::SCR
+ | Self::SEK
+ | Self::SGD
+ | Self::SLL
+ | Self::SOS
+ | Self::SSP
+ | Self::SVC
+ | Self::SZL
+ | Self::THB
+ | Self::TRY
+ | Self::TTD
+ | Self::TWD
+ | Self::TZS
+ | Self::USD
+ | Self::UYU
+ | Self::UZS
+ | Self::VND
+ | Self::YER
+ | Self::ZAR => false,
+ }
+ }
}
#[derive(
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 855199cb3c8..32824e3cb84 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -5,7 +5,7 @@ use url::Url;
use crate::{
connector::utils::{
- to_connector_meta, AccessTokenRequestInfo, AddressDetailsData, CardData,
+ self, to_connector_meta, AccessTokenRequestInfo, AddressDetailsData, CardData,
PaymentsAuthorizeRequestData,
},
core::errors,
@@ -105,7 +105,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaypalPaymentsRequest {
};
let amount = OrderAmount {
currency_code: item.request.currency,
- value: item.request.amount.to_string(),
+ value: utils::to_currency_base_unit_with_zero_decimal_check(
+ item.request.amount,
+ item.request.currency,
+ )?,
};
let reference_id = item.attempt_id.clone();
@@ -135,7 +138,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaypalPaymentsRequest {
let intent = PaypalPaymentIntent::Capture;
let amount = OrderAmount {
currency_code: item.request.currency,
- value: item.request.amount.to_string(),
+ value: utils::to_currency_base_unit_with_zero_decimal_check(
+ item.request.amount,
+ item.request.currency,
+ )?,
};
let reference_id = item.attempt_id.clone();
let purchase_units = vec![PurchaseUnitRequest {
@@ -500,7 +506,10 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for PaypalPaymentsCaptureRequest
fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
let amount = OrderAmount {
currency_code: item.request.currency,
- value: item.request.amount_to_capture.to_string(),
+ value: utils::to_currency_base_unit_with_zero_decimal_check(
+ item.request.amount_to_capture,
+ item.request.currency,
+ )?,
};
Ok(Self {
amount,
@@ -636,7 +645,10 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for PaypalRefundRequest {
Ok(Self {
amount: OrderAmount {
currency_code: item.request.currency,
- value: item.request.refund_amount.to_string(),
+ value: utils::to_currency_base_unit_with_zero_decimal_check(
+ item.request.refund_amount,
+ item.request.currency,
+ )?,
},
})
}
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 66c980d2d3c..f9c73255d65 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -928,6 +928,14 @@ pub fn to_currency_base_unit(
.change_context(errors::ConnectorError::RequestEncodingFailed)
}
+pub fn to_currency_base_unit_with_zero_decimal_check(
+ amount: i64,
+ currency: diesel_models::enums::Currency,
+) -> Result<String, error_stack::Report<errors::ConnectorError>> {
+ utils::to_currency_base_unit_with_zero_decimal_check(amount, currency)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)
+}
+
pub fn to_currency_base_unit_asf64(
amount: i64,
currency: diesel_models::enums::Currency,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 371a8ca5643..763062fddfd 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -138,6 +138,21 @@ pub fn to_currency_base_unit(
Ok(format!("{amount_f64:.2}"))
}
+/// Convert the amount to its base denomination based on Currency and check for zero decimal currency and return String
+/// Paypal Connector accepts Zero and Two decimal currency but not three decimal and it should be updated as required for 3 decimal currencies.
+/// Paypal Ref - https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/
+pub fn to_currency_base_unit_with_zero_decimal_check(
+ amount: i64,
+ currency: diesel_models::enums::Currency,
+) -> Result<String, error_stack::Report<errors::ValidationError>> {
+ let amount_f64 = to_currency_base_unit_asf64(amount, currency)?;
+ if currency.is_zero_decimal_currency() {
+ Ok(amount_f64.to_string())
+ } else {
+ Ok(format!("{amount_f64:.2}"))
+ }
+}
+
/// Convert the amount to its base denomination based on Currency and return f64
pub fn to_currency_base_unit_asf64(
amount: i64,
@@ -149,13 +164,12 @@ pub fn to_currency_base_unit_asf64(
},
)?;
let amount_f64 = f64::from(amount_u32);
- let amount = match currency {
- diesel_models::enums::Currency::JPY | diesel_models::enums::Currency::KRW => amount_f64,
- diesel_models::enums::Currency::BHD
- | diesel_models::enums::Currency::JOD
- | diesel_models::enums::Currency::KWD
- | diesel_models::enums::Currency::OMR => amount_f64 / 1000.00,
- _ => amount_f64 / 100.00,
+ let amount = if currency.is_zero_decimal_currency() {
+ amount_f64
+ } else if currency.is_three_decimal_currency() {
+ amount_f64 / 1000.00
+ } else {
+ amount_f64 / 100.00
};
Ok(amount)
}
|
fix
|
[Paypal] fix amount to its currency base unit (#1780)
|
ed13ecac04f82b5c69b11636c1e355e7e17c60fd
|
2024-08-13 05:48:19
|
github-actions
|
chore(version): 2024.08.13.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7227e10cc65..e9b55338ed1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,36 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.08.13.0
+
+### Features
+
+- **analytics:** Populate status_code, initial_attempt_id & delivery_attempt on clickhouse for outgoing webhook events ([#5383](https://github.com/juspay/hyperswitch/pull/5383)) ([`f9c29b0`](https://github.com/juspay/hyperswitch/commit/f9c29b084b68563c10f07599e0d789a105958592))
+- **connector:**
+ - [WELLSFARGO_PAYOUT] PR template code ([#5567](https://github.com/juspay/hyperswitch/pull/5567)) ([`6a5b493`](https://github.com/juspay/hyperswitch/commit/6a5b49397adc402f7ce50543c817df3f11ca46ea))
+ - [FISERVEMEA] Add template code ([#5583](https://github.com/juspay/hyperswitch/pull/5583)) ([`74fcc91`](https://github.com/juspay/hyperswitch/commit/74fcc910e9f0b4487f5958f1872e71436fe8f40e))
+- **cypress:** Generate test reports ([#5563](https://github.com/juspay/hyperswitch/pull/5563)) ([`116f31c`](https://github.com/juspay/hyperswitch/commit/116f31cf9b79104d0e5b38ce774555a9ae2f4b88))
+- **payout_link:** Add localisation support for payout link's templates ([#5552](https://github.com/juspay/hyperswitch/pull/5552)) ([`b0346e0`](https://github.com/juspay/hyperswitch/commit/b0346e08f45c6739da22f370b657a41cf2a9cd67))
+- Change admin api key auth to merchant api key auth in few connectors flow ([#5572](https://github.com/juspay/hyperswitch/pull/5572)) ([`7a23e66`](https://github.com/juspay/hyperswitch/commit/7a23e663c283333aaa4e45550e2a36f223ad5e3e))
+
+### Bug Fixes
+
+- **frm:** Restrict enabled mca for frm connectors ([#5499](https://github.com/juspay/hyperswitch/pull/5499)) ([`7718800`](https://github.com/juspay/hyperswitch/commit/7718800e1fc434a553a211b24bd48d2cddc06d1f))
+- **payment_link:** Remove dynamic section if no fields are present ([#5579](https://github.com/juspay/hyperswitch/pull/5579)) ([`78d9906`](https://github.com/juspay/hyperswitch/commit/78d9906ebbedd9069a15b88f49b9348b663cbee8))
+
+### Refactors
+
+- **core:** Adapt the usage of routing_algorithm_id in routing and payments core for v2 ([#5533](https://github.com/juspay/hyperswitch/pull/5533)) ([`61de3e0`](https://github.com/juspay/hyperswitch/commit/61de3e025a21cc691852add8298573d5dd95388c))
+- **openapi_v2:** Add merchant account v2 openapi ([#5588](https://github.com/juspay/hyperswitch/pull/5588)) ([`c8943eb`](https://github.com/juspay/hyperswitch/commit/c8943eb289664093f2a4d515bfacd804f86cd20a))
+
+### Build System / Dependencies
+
+- Bump MSRV to 1.76.0 ([#5586](https://github.com/juspay/hyperswitch/pull/5586)) ([`59b36a0`](https://github.com/juspay/hyperswitch/commit/59b36a054cfdd30daf810ba514dd4f495e36734a))
+
+**Full Changelog:** [`2024.08.12.0...2024.08.13.0`](https://github.com/juspay/hyperswitch/compare/2024.08.12.0...2024.08.13.0)
+
+- - -
+
## 2024.08.12.0
### Features
|
chore
|
2024.08.13.0
|
638fc42217861924b5a43d33d691bad63338cac3
|
2023-06-09 13:18:42
|
Sanchith Hegde
|
ci: update versions of actions (#1388)
| false
|
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 3a85f302218..a4ab61e20c4 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -56,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
@@ -81,9 +81,10 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: "Fetch base branch"
+ shell: bash
run: git fetch origin $GITHUB_BASE_REF --depth 1
- name: Install mold linker
@@ -97,12 +98,12 @@ jobs:
with:
toolchain: 1.65
- - uses: Swatinem/[email protected]
+ - uses: Swatinem/[email protected]
with:
save-if: ${{ github.event_name == 'push' }}
- name: Install cargo-hack
- uses: baptiste0928/[email protected]
+ uses: baptiste0928/[email protected]
with:
crate: cargo-hack
@@ -111,6 +112,7 @@ jobs:
run: sed -i 's/rustflags = \[/rustflags = \[\n "-Dwarnings",/' .cargo/config.toml
- name: Check files changed
+ shell: bash
run: |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/api_models/; then
echo "api_models_changes_exist=false" >> $GITHUB_ENV
@@ -165,42 +167,52 @@ jobs:
- name: Cargo hack api_models
if: env.api_models_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p api_models
- name: Cargo hack common_enums
if: env.common_enums_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p common_enums
- name: Cargo hack common_utils
if: env.common_utils_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p common_utils
- name: Cargo hack drainer
if: env.drainer_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p drainer
- name: Cargo hack masking
if: env.masking_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p masking
- name: Cargo hack redis_interface
if: env.redis_interface_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p redis_interface
- name: Cargo hack router
if: env.router_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --skip kms,basilisk,kv_store,accounts_cache,openapi --no-dev-deps -p router
- name: Cargo hack router_derive
if: env.router_derive_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p router_derive
- name: Cargo hack router_env
if: env.router_env_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p router_env
- name: Cargo hack storage_models
if: env.storage_models_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p storage_models
# cargo-deny:
@@ -217,7 +229,7 @@ jobs:
# steps:
# - name: Checkout repository
- # uses: actions/[email protected]
+ # uses: actions/checkout@v3
# - name: Run cargo-deny
# uses: EmbarkStudios/[email protected]
@@ -237,9 +249,10 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: "Fetch base branch"
+ shell: bash
run: git fetch origin $GITHUB_BASE_REF --depth 1
- name: Install mold linker
@@ -252,19 +265,19 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- components: clippy, rustfmt
+ components: clippy
- name: Install cargo-hack
- uses: baptiste0928/[email protected]
+ uses: baptiste0928/[email protected]
with:
crate: cargo-hack
# - name: Install cargo-nextest
- # uses: baptiste0928/[email protected]
+ # uses: baptiste0928/[email protected]
# with:
# crate: cargo-nextest
- - uses: Swatinem/[email protected]
+ - uses: Swatinem/[email protected]
with:
save-if: ${{ github.event_name == 'push' }}
@@ -283,6 +296,7 @@ jobs:
run: cargo clippy --all-features --all-targets
- name: Check files changed
+ shell: bash
run: |
if git diff --exit-code --quiet origin/$GITHUB_BASE_REF -- crates/api_models/; then
echo "api_models_changes_exist=false" >> $GITHUB_ENV
@@ -337,42 +351,52 @@ jobs:
- name: Cargo hack api_models
if: env.api_models_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p api_models
- name: Cargo hack common_enums
if: env.common_enums_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p common_enums
- name: Cargo hack common_utils
if: env.common_utils_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p common_utils
- name: Cargo hack drainer
if: env.drainer_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p drainer
- name: Cargo hack masking
if: env.masking_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p masking
- name: Cargo hack redis_interface
if: env.redis_interface_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p redis_interface
- name: Cargo hack router
if: env.router_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --skip kms,basilisk,kv_store,accounts_cache,openapi --no-dev-deps -p router
- name: Cargo hack router_derive
if: env.router_derive_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p router_derive
- name: Cargo hack router_env
if: env.router_env_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p router_env
- name: Cargo hack storage_models
if: env.storage_models_changes_exist == 'true'
+ shell: bash
run: cargo hack check --each-feature --no-dev-deps -p storage_models
typos:
@@ -380,8 +404,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: Spell check
uses: crate-ci/typos@master
-
diff --git a/.github/workflows/connector-sanity-tests.yml b/.github/workflows/connector-sanity-tests.yml
index 1b5256ceb24..4d6199a86d3 100644
--- a/.github/workflows/connector-sanity-tests.yml
+++ b/.github/workflows/connector-sanity-tests.yml
@@ -79,25 +79,25 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- - uses: Swatinem/[email protected]
+ - uses: Swatinem/[email protected]
- name: Decrypt connector auth file
- run: ./scripts/decrypt_connector_auth.sh
env:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
+ shell: bash
+ run: ./scripts/decrypt_connector_auth.sh
- name: Set connector auth file path in env
+ shell: bash
run: echo "CONNECTOR_AUTH_FILE_PATH=$HOME/target/test/connector_auth.toml" >> $GITHUB_ENV
- name: Run connector tests
- uses: actions-rs/cargo@v1
- with:
- command: test
- args: --package router --test connectors -- "${{ matrix.connector }}::" --test-threads=1
+ shell: bash
+ run: cargo test --package router --test connectors -- "${{ matrix.connector }}::" --test-threads=1
diff --git a/.github/workflows/conventional-commit-check.yml b/.github/workflows/conventional-commit-check.yml
index 8e7c4334649..0f1a16e99f5 100644
--- a/.github/workflows/conventional-commit-check.yml
+++ b/.github/workflows/conventional-commit-check.yml
@@ -45,19 +45,9 @@ jobs:
with:
toolchain: stable
- - uses: Swatinem/[email protected]
+ - uses: baptiste0928/[email protected]
with:
- # We can use a single cache entry for all runs of this check, as only cocogitto needs to be cached
- shared-key: "pr_title_check"
- # We don't build any crates in this repository, no need to cache target directories
- cache-targets: "false"
- # Save cache even if commit message verification fails.
- # Only failure not considered is failures in installing cocogitto itself.
- cache-on-failure: "true"
-
- - name: Install cocogitto
- shell: bash
- run: cargo install cocogitto
+ crate: cocogitto
- name: Verify PR title follows conventional commit standards
id: pr_title_check
diff --git a/.github/workflows/migration-check.yaml b/.github/workflows/migration-check.yaml
index 81d9f42188b..201209c3e35 100644
--- a/.github/workflows/migration-check.yaml
+++ b/.github/workflows/migration-check.yaml
@@ -40,26 +40,18 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- - uses: Swatinem/[email protected]
+ - uses: baptiste0928/[email protected]
with:
- # We can use a single cache entry for all runs of this check, as only diesel CLI needs to be cached
- shared-key: "migration_verify"
- # We don't build any crates in this repository, no need to cache target directories
- cache-targets: "false"
- # Save cache even if migration verification fails.
- # Only failure not considered is failures in installing diesel CLI itself.
- cache-on-failure: "true"
-
- - name: Install diesel_cli
- shell: bash
- run: cargo install diesel_cli --no-default-features --features postgres
+ crate: diesel_cli
+ features: postgres
+ args: "--no-default-features"
- name: Verify `diesel migration run`
shell: bash
diff --git a/.github/workflows/validate-generated-json.yml b/.github/workflows/validate-generated-json.yml
index 3604a44cab6..2b5bbe93cd2 100644
--- a/.github/workflows/validate-generated-json.yml
+++ b/.github/workflows/validate-generated-json.yml
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- uses: actions/[email protected]
+ uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
diff --git a/.typos.toml b/.typos.toml
index 57cfce73ef1..167a5560c1d 100644
--- a/.typos.toml
+++ b/.typos.toml
@@ -3,14 +3,18 @@ check-filename = true
[default.extend-identifiers]
BA = "BA" # Bosnia and Herzegovina country code
+CAF = "CAF" # Central African Republic country code
flate2 = "flate2"
FO = "FO" # Faroe Islands (the) country code
-payment_vas = "payment_vas"
-PaymentVas = "PaymentVas"
HypoNoeLbFurNiederosterreichUWien = "HypoNoeLbFurNiederosterreichUWien"
hypo_noe_lb_fur_niederosterreich_u_wien = "hypo_noe_lb_fur_niederosterreich_u_wien"
+NAM = "NAM" # Namibia country code
+payment_vas = "payment_vas"
+PaymentVas = "PaymentVas"
+RegioBank = "RegioBank"
SOM = "SOM" # Somalia country code
THA = "THA" # Thailand country code
+ZAR = "ZAR" # South African Rand currency code
[default.extend-words]
aci = "aci" # Name of a connector
@@ -21,4 +25,5 @@ substituters = "substituters" # Present in `flake.nix`
[files]
extend-exclude = [
"config/redis.conf", # `typos` also checked "AKE" in the file, which is present as a quoted string
+ "openapi/open_api_spec.yaml", # no longer updated
]
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 3a4b93c833f..2d052b210ea 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -4,7 +4,7 @@ pub mod capture_flow;
pub mod complete_authorize_flow;
pub mod psync_flow;
pub mod session_flow;
-pub mod verfiy_flow;
+pub mod verify_flow;
use async_trait::async_trait;
diff --git a/crates/router/src/core/payments/flows/verfiy_flow.rs b/crates/router/src/core/payments/flows/verify_flow.rs
similarity index 100%
rename from crates/router/src/core/payments/flows/verfiy_flow.rs
rename to crates/router/src/core/payments/flows/verify_flow.rs
diff --git a/crates/router/tests/connectors/coinbase.rs b/crates/router/tests/connectors/coinbase.rs
index 0bb8a87c350..809fa83b85e 100644
--- a/crates/router/tests/connectors/coinbase.rs
+++ b/crates/router/tests/connectors/coinbase.rs
@@ -129,7 +129,7 @@ async fn should_sync_authorized_payment() {
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
-// Synchronizes a unresovled(underpaid) transaction.
+// Synchronizes a unresolved(underpaid) transaction.
#[actix_web::test]
async fn should_sync_unresolved_payment() {
let response = CONNECTOR
diff --git a/crates/router/tests/connectors/opennode.rs b/crates/router/tests/connectors/opennode.rs
index 20a3fde4b0b..8382c9cc6d3 100644
--- a/crates/router/tests/connectors/opennode.rs
+++ b/crates/router/tests/connectors/opennode.rs
@@ -128,7 +128,7 @@ async fn should_sync_authorized_payment() {
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
-// Synchronizes a unresovled(underpaid) transaction.
+// Synchronizes a unresolved(underpaid) transaction.
#[actix_web::test]
async fn should_sync_unresolved_payment() {
let response = CONNECTOR
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 9ad5ee7f488..ca09f8a22cb 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -1797,6 +1797,7 @@
"type": "object",
"required": [
"label",
+ "type",
"amount"
],
"properties": {
@@ -1806,8 +1807,7 @@
},
"type": {
"type": "string",
- "description": "A value that indicates whether the line item(Ex: total, tax, discount, or grand total) is final or pending.",
- "nullable": true
+ "description": "A value that indicates whether the line item(Ex: total, tax, discount, or grand total) is final or pending."
},
"amount": {
"type": "string",
@@ -1836,7 +1836,8 @@
"currency_code",
"total",
"merchant_capabilities",
- "supported_networks"
+ "supported_networks",
+ "merchant_identifier"
],
"properties": {
"country_code": {
@@ -1864,8 +1865,7 @@
"description": "The list of supported networks"
},
"merchant_identifier": {
- "type": "string",
- "nullable": true
+ "type": "string"
}
}
},
@@ -1873,24 +1873,72 @@
"type": "object"
},
"ApplePaySessionResponse": {
- "oneOf": [
- {
- "$ref": "#/components/schemas/ThirdPartySdkSessionResponse"
+ "type": "object",
+ "required": [
+ "epoch_timestamp",
+ "expires_at",
+ "merchant_session_identifier",
+ "nonce",
+ "merchant_identifier",
+ "domain_name",
+ "display_name",
+ "signature",
+ "operational_analytics_identifier",
+ "retries",
+ "psp_id"
+ ],
+ "properties": {
+ "epoch_timestamp": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Timestamp at which session is requested",
+ "minimum": 0.0
},
- {
- "allOf": [
- {
- "$ref": "#/components/schemas/NoThirdPartySdkSessionResponse"
- }
- ],
- "nullable": true
+ "expires_at": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Timestamp at which session expires",
+ "minimum": 0.0
},
- {
- "type": "object",
- "default": null,
- "nullable": true
+ "merchant_session_identifier": {
+ "type": "string",
+ "description": "The identifier for the merchant session"
+ },
+ "nonce": {
+ "type": "string",
+ "description": "Apple pay generated unique ID (UUID) value"
+ },
+ "merchant_identifier": {
+ "type": "string",
+ "description": "The identifier for the merchant"
+ },
+ "domain_name": {
+ "type": "string",
+ "description": "The domain name of the merchant which is registered in Apple Pay"
+ },
+ "display_name": {
+ "type": "string",
+ "description": "The name to be displayed on Apple Pay button"
+ },
+ "signature": {
+ "type": "string",
+ "description": "A string which represents the properties of a payment"
+ },
+ "operational_analytics_identifier": {
+ "type": "string",
+ "description": "The identifier for the operational analytics"
+ },
+ "retries": {
+ "type": "integer",
+ "format": "int32",
+ "description": "The number of retries to get the session response",
+ "minimum": 0.0
+ },
+ "psp_id": {
+ "type": "string",
+ "description": "The identifier for the connector transaction"
}
- ]
+ }
},
"ApplePayWalletData": {
"type": "object",
@@ -1939,32 +1987,18 @@
"type": "object",
"required": [
"session_token_data",
- "connector",
- "delayed_session_token",
- "sdk_next_action"
+ "payment_request_data",
+ "connector"
],
"properties": {
"session_token_data": {
"$ref": "#/components/schemas/ApplePaySessionResponse"
},
"payment_request_data": {
- "allOf": [
- {
- "$ref": "#/components/schemas/ApplePayPaymentRequest"
- }
- ],
- "nullable": true
+ "$ref": "#/components/schemas/ApplePayPaymentRequest"
},
"connector": {
- "type": "string",
- "description": "The session token is w.r.t this connector"
- },
- "delayed_session_token": {
- "type": "boolean",
- "description": "Identifier for the delayed session response"
- },
- "sdk_next_action": {
- "$ref": "#/components/schemas/SdkNextAction"
+ "type": "string"
}
}
},
@@ -5296,14 +5330,6 @@
"MobilePayRedirection": {
"type": "object"
},
- "NextActionCall": {
- "type": "string",
- "enum": [
- "confirm",
- "sync",
- "session_token"
- ]
- },
"NextActionData": {
"oneOf": [
{
@@ -5359,74 +5385,6 @@
"display_bank_transfer_information"
]
},
- "NoThirdPartySdkSessionResponse": {
- "type": "object",
- "required": [
- "epoch_timestamp",
- "expires_at",
- "merchant_session_identifier",
- "nonce",
- "merchant_identifier",
- "domain_name",
- "display_name",
- "signature",
- "operational_analytics_identifier",
- "retries",
- "psp_id"
- ],
- "properties": {
- "epoch_timestamp": {
- "type": "integer",
- "format": "int64",
- "description": "Timestamp at which session is requested",
- "minimum": 0.0
- },
- "expires_at": {
- "type": "integer",
- "format": "int64",
- "description": "Timestamp at which session expires",
- "minimum": 0.0
- },
- "merchant_session_identifier": {
- "type": "string",
- "description": "The identifier for the merchant session"
- },
- "nonce": {
- "type": "string",
- "description": "Apple pay generated unique ID (UUID) value"
- },
- "merchant_identifier": {
- "type": "string",
- "description": "The identifier for the merchant"
- },
- "domain_name": {
- "type": "string",
- "description": "The domain name of the merchant which is registered in Apple Pay"
- },
- "display_name": {
- "type": "string",
- "description": "The name to be displayed on Apple Pay button"
- },
- "signature": {
- "type": "string",
- "description": "A string which represents the properties of a payment"
- },
- "operational_analytics_identifier": {
- "type": "string",
- "description": "The identifier for the operational analytics"
- },
- "retries": {
- "type": "integer",
- "format": "int32",
- "description": "The number of retries to get the session response",
- "minimum": 0.0
- },
- "psp_id": {
- "type": "string",
- "description": "The identifier for the connector transaction"
- }
- }
- },
"OnlineMandate": {
"type": "object",
"required": [
@@ -6229,25 +6187,19 @@
"PaymentsCreateRequest": {
"type": "object",
"required": [
- "currency",
"manual_retry",
+ "currency",
"amount"
],
"properties": {
- "currency": {
+ "payment_method_data": {
"allOf": [
{
- "$ref": "#/components/schemas/Currency"
+ "$ref": "#/components/schemas/PaymentMethodData"
}
],
"nullable": true
},
- "description": {
- "type": "string",
- "description": "A description of the payment",
- "example": "It's my first payment request",
- "nullable": true
- },
"capture_method": {
"allOf": [
{
@@ -6256,127 +6208,105 @@
],
"nullable": true
},
- "statement_descriptor_suffix": {
+ "customer_id": {
"type": "string",
- "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.",
- "example": "Payment for shoes purchase",
+ "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
"maxLength": 255
},
- "metadata": {
+ "payment_method": {
"allOf": [
{
- "$ref": "#/components/schemas/Metadata"
+ "$ref": "#/components/schemas/PaymentMethod"
}
],
"nullable": true
},
- "payment_method": {
+ "confirm": {
+ "type": "boolean",
+ "description": "Whether to confirm the payment (if applicable)",
+ "default": false,
+ "example": true,
+ "nullable": true
+ },
+ "shipping": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethod"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "email": {
- "type": "string",
- "description": "description: The customer's email address",
- "example": "[email protected]",
- "nullable": true,
- "maxLength": 255
- },
- "customer_id": {
+ "payment_id": {
"type": "string",
- "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.",
+ "example": "pay_mbabizu24mvu3mela5njyhpit4",
"nullable": true,
- "maxLength": 255
- },
- "card_cvc": {
- "type": "string",
- "description": "This is used when payment is to be confirmed and the card is not saved",
- "nullable": true
+ "maxLength": 30,
+ "minLength": 30
},
- "business_country": {
+ "payment_method_type": {
"allOf": [
{
- "$ref": "#/components/schemas/CountryAlpha2"
+ "$ref": "#/components/schemas/PaymentMethodType"
}
],
"nullable": true
},
- "browser_info": {
- "type": "object",
- "description": "Additional details required by 3DS 2.0",
- "nullable": true
- },
- "routing": {
+ "payment_experience": {
"allOf": [
{
- "$ref": "#/components/schemas/RoutingAlgorithm"
+ "$ref": "#/components/schemas/PaymentExperience"
}
],
"nullable": true
},
- "merchant_id": {
+ "payment_token": {
"type": "string",
- "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
- "example": "merchant_1668273825",
- "nullable": true,
- "maxLength": 255
+ "description": "Provide a reference to a stored payment method",
+ "example": "187282ab-40ef-47a9-9206-5099ba31e432",
+ "nullable": true
},
- "shipping": {
+ "authentication_type": {
"allOf": [
{
- "$ref": "#/components/schemas/Address"
+ "$ref": "#/components/schemas/AuthenticationType"
}
],
"nullable": true
},
- "payment_token": {
- "type": "string",
- "description": "Provide a reference to a stored payment method",
- "example": "187282ab-40ef-47a9-9206-5099ba31e432",
+ "routing": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RoutingAlgorithm"
+ }
+ ],
"nullable": true
},
- "allowed_payment_method_types": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentMethodType"
- },
- "description": "Allowed Payment Method Types for a given PaymentIntent",
+ "business_country": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
"nullable": true
},
"manual_retry": {
"type": "boolean",
"description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
},
- "payment_id": {
- "type": "string",
- "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.",
- "example": "pay_mbabizu24mvu3mela5njyhpit4",
- "nullable": true,
- "maxLength": 30,
- "minLength": 30
- },
- "business_sub_label": {
+ "capture_on": {
"type": "string",
- "description": "Business sub label for the payment",
+ "format": "date-time",
+ "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true",
+ "example": "2022-09-10T10:11:12Z",
"nullable": true
},
- "amount": {
- "type": "integer",
- "format": "int64",
- "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
- "example": 6540,
- "nullable": true,
- "minimum": 0.0
- },
- "statement_descriptor_name": {
+ "statement_descriptor_suffix": {
"type": "string",
- "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
- "example": "Hyperswitch Router",
+ "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.",
+ "example": "Payment for shoes purchase",
"nullable": true,
"maxLength": 255
},
@@ -6388,55 +6318,70 @@
],
"nullable": true
},
- "billing": {
+ "business_sub_label": {
+ "type": "string",
+ "description": "Business sub label for the payment",
+ "nullable": true
+ },
+ "email": {
+ "type": "string",
+ "description": "description: The customer's email address",
+ "example": "[email protected]",
+ "nullable": true,
+ "maxLength": 255
+ },
+ "setup_future_usage": {
"allOf": [
{
- "$ref": "#/components/schemas/Address"
+ "$ref": "#/components/schemas/FutureUsage"
}
],
"nullable": true
},
- "capture_on": {
- "type": "string",
- "format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
- },
- "confirm": {
- "type": "boolean",
- "description": "Whether to confirm the payment (if applicable)",
- "default": false,
- "example": true,
+ "allowed_payment_method_types": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "description": "Allowed Payment Method Types for a given PaymentIntent",
"nullable": true
},
- "client_secret": {
- "type": "string",
- "description": "It's a token used for client side verification.",
- "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
+ "currency": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Currency"
+ }
+ ],
"nullable": true
},
- "mandate_data": {
+ "billing": {
"allOf": [
{
- "$ref": "#/components/schemas/MandateData"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "mandate_id": {
+ "phone_country_code": {
"type": "string",
- "description": "A unique identifier to link the payment to a mandate, can be use instead of payment_method_data",
- "example": "mandate_iwer89rnjef349dni3",
+ "description": "The country code for the customer phone number",
+ "example": "+1",
"nullable": true,
"maxLength": 255
},
- "business_label": {
+ "return_url": {
"type": "string",
- "description": "Business label of the merchant for this payment",
- "example": "food",
+ "description": "The URL to redirect after the completion of the operation",
+ "example": "https://hyperswitch.io",
"nullable": true
},
+ "statement_descriptor_name": {
+ "type": "string",
+ "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
+ "example": "Hyperswitch Router",
+ "nullable": true,
+ "maxLength": 255
+ },
"name": {
"type": "string",
"description": "description: The customer's name",
@@ -6444,26 +6389,36 @@
"nullable": true,
"maxLength": 255
},
- "connector": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Connector"
- },
- "description": "This allows the merchant to manually select a connector with which the payment can go through",
- "example": [
- "stripe",
- "adyen"
- ],
+ "amount": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
+ "example": 6540,
+ "nullable": true,
+ "minimum": 0.0
+ },
+ "amount_to_capture": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,\nIf not provided, the default amount_to_capture will be the payment amount.",
+ "example": 6540,
"nullable": true
},
- "authentication_type": {
+ "metadata": {
"allOf": [
{
- "$ref": "#/components/schemas/AuthenticationType"
+ "$ref": "#/components/schemas/Metadata"
}
],
"nullable": true
},
+ "merchant_id": {
+ "type": "string",
+ "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
+ "example": "merchant_1668273825",
+ "nullable": true,
+ "maxLength": 255
+ },
"phone": {
"type": "string",
"description": "The customer's phone number",
@@ -6471,56 +6426,47 @@
"nullable": true,
"maxLength": 255
},
- "amount_to_capture": {
- "type": "integer",
- "format": "int64",
- "description": "The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,\nIf not provided, the default amount_to_capture will be the payment amount.",
- "example": 6540,
- "nullable": true
- },
- "return_url": {
+ "client_secret": {
"type": "string",
- "description": "The URL to redirect after the completion of the operation",
- "example": "https://hyperswitch.io",
- "nullable": true
- },
- "setup_future_usage": {
- "allOf": [
- {
- "$ref": "#/components/schemas/FutureUsage"
- }
- ],
+ "description": "It's a token used for client side verification.",
+ "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
"nullable": true
},
- "payment_method_data": {
+ "mandate_data": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/MandateData"
}
],
"nullable": true
},
- "phone_country_code": {
+ "mandate_id": {
"type": "string",
- "description": "The country code for the customer phone number",
- "example": "+1",
+ "description": "A unique identifier to link the payment to a mandate, can be use instead of payment_method_data",
+ "example": "mandate_iwer89rnjef349dni3",
"nullable": true,
"maxLength": 255
},
- "payment_experience": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentExperience"
- }
- ],
+ "browser_info": {
+ "type": "object",
+ "description": "Additional details required by 3DS 2.0",
"nullable": true
},
- "payment_method_type": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PaymentMethodType"
- }
- ],
+ "business_label": {
+ "type": "string",
+ "description": "Business label of the merchant for this payment",
+ "example": "food",
+ "nullable": true
+ },
+ "description": {
+ "type": "string",
+ "description": "A description of the payment",
+ "example": "It's my first payment request",
+ "nullable": true
+ },
+ "card_cvc": {
+ "type": "string",
+ "description": "This is used when payment is to be confirmed and the card is not saved",
"nullable": true
},
"off_session": {
@@ -6528,6 +6474,18 @@
"description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with `confirm: true`.",
"example": true,
"nullable": true
+ },
+ "connector": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Connector"
+ },
+ "description": "This allows the merchant to manually select a connector with which the payment can go through",
+ "example": [
+ "stripe",
+ "adyen"
+ ],
+ "nullable": true
}
}
},
@@ -7210,11 +7168,6 @@
}
],
"nullable": true
- },
- "delayed_session_token": {
- "type": "boolean",
- "description": "Identifier for the delayed session response",
- "nullable": true
}
}
},
@@ -7680,32 +7633,6 @@
],
"example": "custom"
},
- "SdkNextAction": {
- "type": "object",
- "required": [
- "next_action"
- ],
- "properties": {
- "next_action": {
- "$ref": "#/components/schemas/NextActionCall"
- }
- }
- },
- "SecretInfoToInitiateSdk": {
- "type": "object",
- "required": [
- "display",
- "payment"
- ],
- "properties": {
- "display": {
- "type": "string"
- },
- "payment": {
- "type": "string"
- }
- }
- },
"SepaAndBacsBillingDetails": {
"type": "object",
"required": [
@@ -7842,17 +7769,6 @@
"propertyName": "wallet_name"
}
},
- "ThirdPartySdkSessionResponse": {
- "type": "object",
- "required": [
- "secrets"
- ],
- "properties": {
- "secrets": {
- "$ref": "#/components/schemas/SecretInfoToInitiateSdk"
- }
- }
- },
"UpdateApiKeyRequest": {
"type": "object",
"description": "The request body for updating an API Key.",
|
ci
|
update versions of actions (#1388)
|
2d895be9856d17cd923665568aa9b6e54fc1a305
|
2023-12-17 23:09:08
|
oscar2d2
|
refactor(connector): [Cryptopay] change error message from not supported to not implemented (#2846)
| false
|
diff --git a/crates/router/src/connector/cryptopay/transformers.rs b/crates/router/src/connector/cryptopay/transformers.rs
index 3af604c786b..4102945b201 100644
--- a/crates/router/src/connector/cryptopay/transformers.rs
+++ b/crates/router/src/connector/cryptopay/transformers.rs
@@ -82,10 +82,9 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>>
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::GiftCard(_)
| api_models::payments::PaymentMethodData::CardToken(_) => {
- Err(errors::ConnectorError::NotSupported {
- message: utils::SELECTED_PAYMENT_METHOD.to_string(),
- connector: "CryptoPay",
- })
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("CryptoPay"),
+ ))
}
}?;
Ok(cryptopay_request)
|
refactor
|
[Cryptopay] change error message from not supported to not implemented (#2846)
|
3df944196f710587eee32be871eaef1d764b694a
|
2023-08-11 00:09:23
|
Sai Harsha Vardhan
|
fix(connector): [Paypal] send valid error_reason in all the error responses (#1914)
| false
|
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index ae1777279c1..fa92b233f49 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -77,8 +77,8 @@ impl Paypal {
.parse_struct("Paypal ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- let error_reason = match response.details {
- Some(order_errors) => order_errors
+ let error_reason = response.details.map(|order_errors| {
+ order_errors
.iter()
.map(|error| {
let mut reason = format!("description - {}", error.description);
@@ -95,14 +95,13 @@ impl Paypal {
reason.push(';');
reason
})
- .collect::<String>(),
- None => consts::NO_ERROR_MESSAGE.to_string(),
- };
+ .collect::<String>()
+ });
Ok(ErrorResponse {
status_code: res.status_code,
code: response.name,
- message: response.message,
- reason: Some(error_reason),
+ message: response.message.clone(),
+ reason: error_reason.or(Some(response.message)),
})
}
}
@@ -178,18 +177,17 @@ impl ConnectorCommon for Paypal {
.parse_struct("Paypal ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- let error_reason = match response.details {
- Some(error_details) => error_details
+ let error_reason = response.details.map(|error_details| {
+ error_details
.iter()
.map(|error| format!("description - {} ; ", error.description))
- .collect::<String>(),
- None => consts::NO_ERROR_MESSAGE.to_string(),
- };
+ .collect::<String>()
+ });
Ok(ErrorResponse {
status_code: res.status_code,
code: response.name,
- message: response.message,
- reason: Some(error_reason),
+ message: response.message.clone(),
+ reason: error_reason.or(Some(response.message)),
})
}
}
@@ -306,8 +304,8 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t
Ok(ErrorResponse {
status_code: res.status_code,
code: response.error,
- message: response.error_description,
- reason: None,
+ message: response.error_description.clone(),
+ reason: Some(response.error_description),
})
}
}
|
fix
|
[Paypal] send valid error_reason in all the error responses (#1914)
|
90e43929a0c05e39feac4f13d75b2eea60b858a0
|
2023-09-22 14:45:33
|
BallaNitesh
|
refactor(core): eliminate business profile database queries in payments confirm flow (#2190)
| false
|
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index db1af73e622..a6847968c28 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -636,6 +636,7 @@ pub async fn create_payment_connector(
&merchant_account,
req.profile_id.as_ref(),
&*state.store,
+ true,
)
.await?;
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index ee790c95115..7cc4eacbe35 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -879,6 +879,7 @@ pub async fn list_payment_methods(
&merchant_account,
payment_intent.profile_id.as_ref(),
db,
+ false,
)
.await
.attach_printable("Could not find profile id from business details")
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 4f8fa4a7b5b..d2bd5beae79 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -591,6 +591,7 @@ where
payment_data,
connector_name,
key_store,
+ false,
)
.await?;
@@ -610,6 +611,7 @@ where
customer,
merchant_account,
key_store,
+ &merchant_connector_account,
payment_data,
)
.await?;
@@ -799,6 +801,7 @@ where
&mut payment_data,
&session_connector_data.connector.connector_name.to_string(),
key_store,
+ false,
)
.await?;
@@ -870,6 +873,7 @@ pub async fn call_create_connector_customer_if_required<F, Req>(
customer: &Option<domain::Customer>,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
+ merchant_connector_account: &helpers::MerchantConnectorAccountType,
payment_data: &mut PaymentData<F>,
) -> RouterResult<Option<storage::CustomerUpdate>>
where
@@ -888,15 +892,6 @@ where
match connector_name {
Some(connector_name) => {
- let merchant_connector_account = construct_profile_id_and_get_mca(
- state,
- merchant_account,
- payment_data,
- &connector_name,
- key_store,
- )
- .await?;
-
let connector = api::ConnectorData::get_connector_by_name(
&state.conf.connectors,
&connector_name,
@@ -919,6 +914,7 @@ where
merchant_account,
payment_data.payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.attach_printable("Could not find profile id from business details")?;
@@ -943,7 +939,7 @@ where
merchant_account,
key_store,
customer,
- &merchant_connector_account,
+ merchant_connector_account,
)
.await?;
@@ -1057,6 +1053,7 @@ pub async fn construct_profile_id_and_get_mca<'a, F>(
payment_data: &mut PaymentData<F>,
connector_id: &str,
key_store: &domain::MerchantKeyStore,
+ should_validate: bool,
) -> RouterResult<helpers::MerchantConnectorAccountType>
where
F: Clone,
@@ -1067,6 +1064,7 @@ where
merchant_account,
payment_data.payment_intent.profile_id.as_ref(),
&*state.store,
+ should_validate,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 831090c14cd..5ebd0995f7b 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -615,6 +615,7 @@ impl PaymentCreate {
merchant_account,
request.profile_id.as_ref(),
&*state.store,
+ true,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index fb65a5507d9..938441962b2 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -340,6 +340,7 @@ where
merchant_account,
payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.attach_printable("Could not find profile id from business details")?;
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index a487700a364..fcb7fc571d5 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -565,6 +565,7 @@ pub async fn create_recipient(
merchant_account,
payout_data.payout_attempt.profile_id.as_ref(),
&*state.store,
+ false,
)
.await?;
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 14a3b777149..bf34c132961 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -211,6 +211,7 @@ pub async fn construct_refund_router_data<'a, F>(
merchant_account,
payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -484,6 +485,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
merchant_account,
payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -570,6 +572,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
merchant_account,
payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -654,6 +657,7 @@ pub async fn construct_upload_file_router_data<'a>(
merchant_account,
payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -741,6 +745,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
merchant_account,
payment_intent.profile_id.as_ref(),
&*state.store,
+ false,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -992,16 +997,19 @@ pub async fn get_profile_id_from_business_details(
merchant_account: &domain::MerchantAccount,
request_profile_id: Option<&String>,
db: &dyn StorageInterface,
+ should_validate: bool,
) -> RouterResult<String> {
match request_profile_id.or(merchant_account.default_profile.as_ref()) {
Some(profile_id) => {
// Check whether this business profile belongs to the merchant
- let _ = validate_and_get_business_profile(
- db,
- Some(profile_id),
- &merchant_account.merchant_id,
- )
- .await?;
+ if should_validate {
+ let _ = validate_and_get_business_profile(
+ db,
+ Some(profile_id),
+ &merchant_account.merchant_id,
+ )
+ .await?;
+ }
Ok(profile_id.clone())
}
None => match business_country.zip(business_label) {
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 27c8acb1fa2..72fce16bdda 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -320,6 +320,7 @@ pub async fn get_profile_id_using_object_reference_id(
merchant_account,
payment_intent.profile_id.as_ref(),
db,
+ false,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
|
refactor
|
eliminate business profile database queries in payments confirm flow (#2190)
|
9f385008106e1cfca8ded40009b364f97ecf69f2
|
2024-02-15 19:30:44
|
likhinbopanna
|
ci(postman): Add Cybersource Collection (#3657)
| false
|
diff --git a/postman/collection-dir/cybersource/.auth.json b/postman/collection-dir/cybersource/.auth.json
new file mode 100644
index 00000000000..915a2835790
--- /dev/null
+++ b/postman/collection-dir/cybersource/.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/cybersource/.event.meta.json b/postman/collection-dir/cybersource/.event.meta.json
new file mode 100644
index 00000000000..2df9d47d936
--- /dev/null
+++ b/postman/collection-dir/cybersource/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.prerequest.js",
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/.info.json b/postman/collection-dir/cybersource/.info.json
new file mode 100644
index 00000000000..a57dfe35e30
--- /dev/null
+++ b/postman/collection-dir/cybersource/.info.json
@@ -0,0 +1,9 @@
+{
+ "info": {
+ "_postman_id": "def65b5c-dc11-4917-a1bb-508988011eff",
+ "name": "cybersource",
+ "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": "24206034"
+ }
+}
diff --git a/postman/collection-dir/cybersource/.meta.json b/postman/collection-dir/cybersource/.meta.json
new file mode 100644
index 00000000000..91b6a65c5bc
--- /dev/null
+++ b/postman/collection-dir/cybersource/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Health check",
+ "Flow Testcases"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/.variable.json b/postman/collection-dir/cybersource/.variable.json
new file mode 100644
index 00000000000..1800610b83e
--- /dev/null
+++ b/postman/collection-dir/cybersource/.variable.json
@@ -0,0 +1,96 @@
+{
+ "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": "cybersourcecustomer"
+ },
+ {
+ "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"
+ },
+ {
+ "key": "certificate",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "certificate_keys",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ },
+ {
+ "key": "connector_api_secret",
+ "value": "",
+ "type": "string"
+ }
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/.meta.json
new file mode 100644
index 00000000000..1bbce843680
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "QuickStart",
+ "Happy Cases",
+ "Variation Cases"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json
new file mode 100644
index 00000000000..9339372cc71
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json
@@ -0,0 +1,30 @@
+{
+ "childrenOrder": [
+ "Scenario1-Create payment with confirm true",
+ "Scenario2-Create payment with confirm false",
+ "Scenario2a-Create payment with confirm false card holder name null",
+ "Scenario2b-Create payment with confirm false card holder name empty",
+ "Scenario3-Create payment without PMD",
+ "Scenario4-Create payment with Manual capture",
+ "Scenario4a-Create payment with partial capture",
+ "Scenario5-Void the payment",
+ "Scenario6-Refund full payment",
+ "Scenario6a-Partial refund",
+ "Scenario7-Create a mandate and recurring payment",
+ "Scenario7a-Manual capture for recurring payments",
+ "Scenario8-Refund recurring payment",
+ "Scenario9-Add card flow",
+ "Scenario10-Don't Pass CVV for save card flow and verifysuccess payment",
+ "Scenario11-Save card payment with manual capture",
+ "Scenario12-Zero auth mandates",
+ "Scenario13-Incremental auth",
+ "Scenario14-Incremental auth for mandates",
+ "Scenario15-Incremental auth with partial capture",
+ "Scenario16-Verify PML for mandate",
+ "Scenario17-Revoke mandates",
+ "Scenario18-Update mandate card details",
+ "Scenario19-Create 3ds payment",
+ "Scenario20-Create 3ds mandate",
+ "Scenario21-Create a mandate without customer acceptance"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json
new file mode 100644
index 00000000000..60051ecca22
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js
new file mode 100644
index 00000000000..03f71bc5fc8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js
@@ -0,0 +1,67 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
new file mode 100644
index 00000000000..a38f7113dcf
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -0,0 +1,97 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "business_country": "US",
+ "business_label": "default",
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "01",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..03afa8d96f8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/event.test.js
@@ -0,0 +1,67 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/.meta.json
new file mode 100644
index 00000000000..1ebea8f5e86
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "List payment methods for a Customer",
+ "Save card payments - Create",
+ "Save card payments - Confirm"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/event.test.js
new file mode 100644
index 00000000000..f844efad42c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/event.test.js
@@ -0,0 +1,20 @@
+// Validate status 2xx
+pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payment_methods/:customer_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){}
+
+if (jsonData?.customer_payment_methods[0]?.payment_token) {
+ pm.collectionVariables.set("payment_token", jsonData.customer_payment_methods[0].payment_token);
+ console.log("- use {{payment_token}} as collection variable for value", jsonData.customer_payment_methods[0].payment_token);
+} else {
+ console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/request.json
new file mode 100644
index 00000000000..cff6d6d715c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/List payment methods for a Customer/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..31c6af0dfbb
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/event.test.js
@@ -0,0 +1,41 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id);
+} else {
+ console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
new file mode 100644
index 00000000000..d69394e2926
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
@@ -0,0 +1,99 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "stripesavecard_{{random_number}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "setup_future_usage": "on_session",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "371449635398431",
+ "card_exp_month": "03",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "7373"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/event.test.js
new file mode 100644
index 00000000000..28a0d23f0b8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/event.test.js
@@ -0,0 +1,67 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "cybersource" for "connector"
+if (jsonData?.connector) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'cybersource'",
+ function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test("[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'", function() {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ })};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/request.json
new file mode 100644
index 00000000000..a1442beda71
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/request.json
@@ -0,0 +1,65 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_token": "{{payment_token}}"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/event.test.js
new file mode 100644
index 00000000000..24a2a8d65f2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/event.test.js
@@ -0,0 +1,42 @@
+// 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.');
+};
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id);
+} else {
+ console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/request.json
new file mode 100644
index 00000000000..5890966b8b8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card 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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/.meta.json
new file mode 100644
index 00000000000..406fa0753a5
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/.meta.json
@@ -0,0 +1,13 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "List payment methods for a Customer",
+ "Save card payments - Create",
+ "Save card payments - Confirm",
+ "Payments - Capture",
+ "Payments - Retrieve-copy",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/event.test.js
new file mode 100644
index 00000000000..f844efad42c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/event.test.js
@@ -0,0 +1,20 @@
+// Validate status 2xx
+pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payment_methods/:customer_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){}
+
+if (jsonData?.customer_payment_methods[0]?.payment_token) {
+ pm.collectionVariables.set("payment_token", jsonData.customer_payment_methods[0].payment_token);
+ console.log("- use {{payment_token}} as collection variable for value", jsonData.customer_payment_methods[0].payment_token);
+} else {
+ console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/request.json
new file mode 100644
index 00000000000..cff6d6d715c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/List payment methods for a Customer/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..962c263b0c4
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/event.test.js
@@ -0,0 +1,97 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+});
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount_capturable"
+if (jsonData?.amount_capturable) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/request.json
new file mode 100644
index 00000000000..8efb99d3c90
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 6540,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/event.test.js
new file mode 100644
index 00000000000..7e612295118
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/event.test.js
@@ -0,0 +1,51 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id);
+} else {
+ console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');
+};
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json
new file mode 100644
index 00000000000..5332a1326c1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json
@@ -0,0 +1,99 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "adyensavecard_{{random_number}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "setup_future_usage": "on_session",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "371449635398431",
+ "card_exp_month": "03",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "7373"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..48276c3fd67
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,93 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+});
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "0" for "amount_capturable"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(0);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..533e04ef075
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/event.test.js
@@ -0,0 +1,93 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+});
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "0" for "amount_capturable"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(0);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..b3499d9a0d1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/event.test.js
@@ -0,0 +1,55 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(540);
+ },
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/request.json
new file mode 100644
index 00000000000..d18aaf8befd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 540,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..cce8d2b8ea9
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/event.test.js
new file mode 100644
index 00000000000..aae1b9a08f2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/event.test.js
@@ -0,0 +1,72 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
+
+
+// Response body should have value "cybersource" for "connector"
+if (jsonData?.connector) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'cybersource'",
+ function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/request.json
new file mode 100644
index 00000000000..5d78ead7de9
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/request.json
@@ -0,0 +1,66 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_token": "{{payment_token}}",
+ "card_cvc": "7373"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/event.test.js
new file mode 100644
index 00000000000..31c6af0dfbb
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/event.test.js
@@ -0,0 +1,41 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id);
+} else {
+ console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/request.json
new file mode 100644
index 00000000000..4c02f6d109f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card 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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Save card payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/.meta.json
new file mode 100644
index 00000000000..5a828a2779b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Mandate Payments - Create",
+ "Payments - Confirm",
+ "Recurring Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/event.test.js
new file mode 100644
index 00000000000..17c0ca2950f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/event.test.js
@@ -0,0 +1,51 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'", function() {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+})};
+
+// Response body should have "mandate_id"
+pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() {
+ pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true;
+});
+
+// Response body should have "mandate_data"
+pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() {
+ pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true;
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/request.json
new file mode 100644
index 00000000000..71d51a87390
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/request.json
@@ -0,0 +1,126 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{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": {
+ "amount": 0,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "John",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "John",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "order_details": [
+ {
+ "product_name": "Apple iphone 15",
+ "quantity": 1,
+ "amount": 0,
+ "account_name": "transaction_processing"
+ }
+ ],
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Mandate Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..2b8a0318d38
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/event.test.js
@@ -0,0 +1,59 @@
+// 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.');
+};
+
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id);
+} else {
+ console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'succeeded'", function() {
+ pm.expect(jsonData.status).to.eql("succeeded");
+})};
+
+// Response body should have "mandate_id"
+pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() {
+ pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true;
+});
+
+// Response body should have "mandate_data"
+pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() {
+ pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true;
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/request.json
new file mode 100644
index 00000000000..a53d07461a2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/request.json
@@ -0,0 +1,107 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "publishable_key",
+ "value": "pk_snd_8798c6a9114646f8b970b93ad5765ddf",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "03",
+ "card_exp_year": "2030",
+ "card_holder_name": "CLBRW1",
+ "card_cvc": "737"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "payment_type": "setup_mandate",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "125.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "multi_use": {
+ "amount": 1000,
+ "currency": "USD",
+ "start_date": "2023-04-21T00:00:00Z",
+ "end_date": "2023-05-21T00:00:00Z",
+ "metadata": {
+ "frequency": "13"
+ }
+ }
+ }
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..0868d67db09
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/event.test.js
@@ -0,0 +1,65 @@
+// 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.');
+};
+
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log("- use {{mandate_id}} as collection variable for value",jsonData.mandate_id);
+} else {
+ console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'succeeded'", function() {
+ pm.expect(jsonData.status).to.eql("succeeded");
+})};
+
+// Response body should have "mandate_id"
+pm.test("[POST]::/payments - Content check if 'mandate_id' exists", function() {
+ pm.expect((typeof jsonData.mandate_id !== "undefined")).to.be.true;
+});
+
+// Response body should have "mandate_data"
+pm.test("[POST]::/payments - Content check if 'mandate_data' exists", function() {
+ pm.expect((typeof jsonData.mandate_data !== "undefined")).to.be.true;
+});
+
+// Response body should have "payment_method_data"
+pm.test("[POST]::/payments - Content check if 'payment_method_data' exists", function() {
+ pm.expect((typeof jsonData.payment_method_data !== "undefined")).to.be.true;
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..7122da10b6b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/request.json
@@ -0,0 +1,124 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{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": {
+ "amount": 1000,
+ "currency": "USD",
+ "confirm": true,
+ "business_country": "US",
+ "business_label": "default",
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "three_ds",
+ "return_url": "https://google.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "billing": {
+ "address": {
+ "first_name": "John",
+ "last_name": "Doe",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "first_name": "John",
+ "last_name": "Doe",
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ },
+ "order_details": [
+ {
+ "product_name": "Apple iphone 15",
+ "quantity": 1,
+ "amount": 1000,
+ "account_name": "transaction_processing"
+ }
+ ]
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario12- Zero auth mandates/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/.meta.json
new file mode 100644
index 00000000000..f429c3305a2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/.meta.json
@@ -0,0 +1,10 @@
+{
+ "childrenOrder": [
+ "Payments-Create",
+ "Incremental Authorization",
+ "Payments - Retrieve",
+ "Payments - Capture",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/event.test.js
new file mode 100644
index 00000000000..dbf6517a0de
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/event.test.js
@@ -0,0 +1,15 @@
+pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () {
+ // Parse the response JSON
+ var jsonData = pm.response.json();
+
+ // Check if the 'amount' in the response matches the expected value
+ pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);
+});
+
+pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () {
+ // Parse the response JSON
+ var jsonData = pm.response.json();
+
+ // Check if the 'status' in the response matches the expected value
+ pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success");
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/request.json
new file mode 100644
index 00000000000..7370c98307d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/request.json
@@ -0,0 +1,26 @@
+{
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 1001
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ "{{payment_id}}",
+ "incremental_authorization"
+ ]
+ }
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Incremental Authorization/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..772fa019b9f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1001);
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(1001);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/request.json
new file mode 100644
index 00000000000..236b80311e2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 1001,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..8cf4006b877
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/event.test.js
@@ -0,0 +1,41 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+})};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..33a6d1f64b1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?expand_attempts=true&force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "expand_attempts",
+ "value": "true"
+ },
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/event.test.js
new file mode 100644
index 00000000000..41883b25ac7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/event.test.js
@@ -0,0 +1,35 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/request.json
new file mode 100644
index 00000000000..f28f6281c71
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/request.json
@@ -0,0 +1,142 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "Authorization",
+ "value": "",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "x-feature",
+ "value": "integ-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 1000,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "amount_to_capture": 1000,
+ "description": "Its my first payment request",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "return_url": "https://google.com",
+ "name": "Preetam",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "authentication_type": "no_three_ds",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "09",
+ "card_exp_year": "2027",
+ "card_holder_name": "",
+ "card_cvc": "975"
+ }
+ },
+ "connector_metadata": {
+ "noon": {
+ "order_category": "pay"
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "128.0.0.1"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "PL",
+ "first_name": "preetam",
+ "last_name": "revankar"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "PL",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "order_details": [
+ {
+ "product_name": "Apple iphone 15",
+ "quantity": 1,
+ "amount": 1000,
+ "account_name": "transaction_processing"
+ }
+ ],
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "request_incremental_authorization": true,
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Payments-Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..5b54b717e2d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1001);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/request.json
new file mode 100644
index 00000000000..d48ee5a25bc
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 1001,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..2b906dedf6c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '1001'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1001);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario13 Incremental auth/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/.meta.json
new file mode 100644
index 00000000000..522a1196294
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Incremental Authorization",
+ "Payments - Retrieve",
+ "Payments - Capture"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/event.test.js
new file mode 100644
index 00000000000..dbf6517a0de
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/event.test.js
@@ -0,0 +1,15 @@
+pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () {
+ // Parse the response JSON
+ var jsonData = pm.response.json();
+
+ // Check if the 'amount' in the response matches the expected value
+ pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);
+});
+
+pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () {
+ // Parse the response JSON
+ var jsonData = pm.response.json();
+
+ // Check if the 'status' in the response matches the expected value
+ pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success");
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/request.json
new file mode 100644
index 00000000000..7370c98307d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/request.json
@@ -0,0 +1,26 @@
+{
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 1001
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ "{{payment_id}}",
+ "incremental_authorization"
+ ]
+ }
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Incremental Authorization/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..772fa019b9f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1001);
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '1001'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(1001);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/request.json
new file mode 100644
index 00000000000..236b80311e2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 1001,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..8cf4006b877
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/event.test.js
@@ -0,0 +1,41 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+})};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..33a6d1f64b1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?expand_attempts=true&force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "expand_attempts",
+ "value": "true"
+ },
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/event.test.js
new file mode 100644
index 00000000000..41883b25ac7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/event.test.js
@@ -0,0 +1,35 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/request.json
new file mode 100644
index 00000000000..f28f6281c71
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/request.json
@@ -0,0 +1,142 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "Authorization",
+ "value": "",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "x-feature",
+ "value": "integ-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 1000,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "amount_to_capture": 1000,
+ "description": "Its my first payment request",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "return_url": "https://google.com",
+ "name": "Preetam",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "authentication_type": "no_three_ds",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "09",
+ "card_exp_year": "2027",
+ "card_holder_name": "",
+ "card_cvc": "975"
+ }
+ },
+ "connector_metadata": {
+ "noon": {
+ "order_category": "pay"
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "128.0.0.1"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "PL",
+ "first_name": "preetam",
+ "last_name": "revankar"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "PL",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "order_details": [
+ {
+ "product_name": "Apple iphone 15",
+ "quantity": 1,
+ "amount": 1000,
+ "account_name": "transaction_processing"
+ }
+ ],
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "request_incremental_authorization": true,
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario14 Incremental auth for mandates/Payments-Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/.meta.json
new file mode 100644
index 00000000000..784f5e06db4
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/.meta.json
@@ -0,0 +1,10 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Incremental Authorization",
+ "Payments - Retrieve",
+ "Payments - Capture",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/event.test.js
new file mode 100644
index 00000000000..dbf6517a0de
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/event.test.js
@@ -0,0 +1,15 @@
+pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'amount' matches '1001'", function () {
+ // Parse the response JSON
+ var jsonData = pm.response.json();
+
+ // Check if the 'amount' in the response matches the expected value
+ pm.expect(jsonData.incremental_authorizations[0].amount).to.eql(1001);
+});
+
+pm.test("[POST]::/payments:id/incremental_authorizations - Content check if value for 'status' matches 'success'", function () {
+ // Parse the response JSON
+ var jsonData = pm.response.json();
+
+ // Check if the 'status' in the response matches the expected value
+ pm.expect(jsonData.incremental_authorizations[0].status).to.eql("success");
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/request.json
new file mode 100644
index 00000000000..7370c98307d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/request.json
@@ -0,0 +1,26 @@
+{
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 1001
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/{{payment_id}}/incremental_authorization",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ "{{payment_id}}",
+ "incremental_authorization"
+ ]
+ }
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Incremental Authorization/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..70312d39fe2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "partially_captured" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
+
+// Response body should have value "1001" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '1001'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1001);
+ },
+ );
+}
+
+// Response body should have value "500" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '500'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(500);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/request.json
new file mode 100644
index 00000000000..4f054db2954
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 500,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..8cf4006b877
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/event.test.js
@@ -0,0 +1,41 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+pm.test("[POST]::/payments - Content check if value for 'status' matches 'requires_capture'", function() {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+})};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..33a6d1f64b1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?expand_attempts=true&force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "expand_attempts",
+ "value": "true"
+ },
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/event.test.js
new file mode 100644
index 00000000000..41883b25ac7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/event.test.js
@@ -0,0 +1,35 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/request.json
new file mode 100644
index 00000000000..4e501feb9f5
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/request.json
@@ -0,0 +1,150 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{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"
+ },
+ {
+ "key": "Authorization",
+ "value": "",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 1000,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "amount_to_capture": 1000,
+ "description": "Its my first payment request",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "return_url": "https://google.com",
+ "name": "Preetam",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "authentication_type": "no_three_ds",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "09",
+ "card_exp_year": "2027",
+ "card_holder_name": "",
+ "card_cvc": "975"
+ }
+ },
+ "connector_metadata": {
+ "noon": {
+ "order_category": "pay"
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "128.0.0.1"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "PL",
+ "first_name": "preetam",
+ "last_name": "revankar"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "PL",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "order_details": [
+ {
+ "product_name": "Apple iphone 15",
+ "quantity": 1,
+ "amount": 1000,
+ "account_name": "transaction_processing"
+ }
+ ],
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "request_incremental_authorization": true,
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Payments-Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..98db0f1b7a5
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "500" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '500'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(500);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/request.json
new file mode 100644
index 00000000000..241a13121e9
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 500,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..437b5a3c487
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "500" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '500'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(500);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario15 Incremental auth with partial capture/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/.meta.json
new file mode 100644
index 00000000000..086e649c47c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "List payment methods for a Merchant",
+ "Payments - Create-copy",
+ "List payment methods for a Merchant-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js
new file mode 100644
index 00000000000..7ac718d6f21
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/event.test.js
@@ -0,0 +1,34 @@
+// Validate status 2xx
+pm.test(
+ "[GET]::/payment_methods/:merchant_id - Status code is 2xx",
+ function () {
+ pm.response.to.be.success;
+ },
+);
+
+// Validate if response header has matching content-type
+pm.test(
+ "[GET]::/payment_methods/: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) {}
+
+
+// Response body should have value "setup_mandate" for "payment_type"
+if (jsonData?.payment_type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'payment_type' matches 'setup_mandate'",
+ function () {
+ pm.expect(jsonData.payment_type).to.eql("setup_mandate");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/request.json
new file mode 100644
index 00000000000..bc72009ae2e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/request.json
@@ -0,0 +1,46 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ "payment_methods"
+ ],
+ "query": [
+ {
+ "key": "client_secret",
+ "value": "{{client_secret}}"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular merchant id."
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/event.test.js
new file mode 100644
index 00000000000..fe073c5a624
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/event.test.js
@@ -0,0 +1,34 @@
+// Validate status 2xx
+pm.test(
+ "[GET]::/payment_methods/:merchant_id - Status code is 2xx",
+ function () {
+ pm.response.to.be.success;
+ },
+);
+
+// Validate if response header has matching content-type
+pm.test(
+ "[GET]::/payment_methods/: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) {}
+
+
+// Response body should have value "new_mandate" for "payment_type"
+if (jsonData?.payment_type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'payment_type' matches 'new_mandate'",
+ function () {
+ pm.expect(jsonData.payment_type).to.eql("new_mandate");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/request.json
new file mode 100644
index 00000000000..bc72009ae2e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/request.json
@@ -0,0 +1,46 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ "payment_methods"
+ ],
+ "query": [
+ {
+ "key": "client_secret",
+ "value": "{{client_secret}}"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular merchant id."
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/List payment methods for a Merchant/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/event.test.js
new file mode 100644
index 00000000000..aac7a8add21
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/event.test.js
@@ -0,0 +1,73 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log(
+ "- use {{customer_id}} as collection variable for value",
+ jsonData.customer_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/request.json
new file mode 100644
index 00000000000..0aba8b9170b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/request.json
@@ -0,0 +1,106 @@
+{
+ "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": 0,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "payment_type": "setup_mandate",
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/event.test.js
new file mode 100644
index 00000000000..982b4df0e37
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/event.test.js
@@ -0,0 +1,87 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_confirmation" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_confirmation");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/request.json
new file mode 100644
index 00000000000..480173f4279
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario16-Verify PML for mandate/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/.meta.json
new file mode 100644
index 00000000000..64790ff219f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/.meta.json
@@ -0,0 +1,9 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "List - Mandates",
+ "Revoke - Mandates",
+ "List - Mandates-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/event.test.js
new file mode 100644
index 00000000000..aee3da3b622
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/event.test.js
@@ -0,0 +1,39 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "revoked" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'revoked'",
+ function () {
+ pm.expect(jsonData.status).to.eql("revoked");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/request.json
new file mode 100644
index 00000000000..349b5117443
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}",
+ "description": "(Required) Unique mandate id"
+ }
+ ]
+ },
+ "description": "To list the details of a mandate"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/event.test.js
new file mode 100644
index 00000000000..3ad4ac60509
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/event.test.js
@@ -0,0 +1,39 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "active" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'active'",
+ function () {
+ pm.expect(jsonData.status).to.eql("active");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/request.json
new file mode 100644
index 00000000000..349b5117443
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}",
+ "description": "(Required) Unique mandate id"
+ }
+ ]
+ },
+ "description": "To list the details of a mandate"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/List - Mandates/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9d11debb6e8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/event.test.js
@@ -0,0 +1,98 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/request.json
new file mode 100644
index 00000000000..f0be44bec91
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/event.test.js
new file mode 100644
index 00000000000..74c5e000fc3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/event.test.js
@@ -0,0 +1,37 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "revoked" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'revoked'",
+ function () {
+ pm.expect(jsonData.status).to.eql("revoked");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/request.json
new file mode 100644
index 00000000000..3c7b05bbde6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/revoke/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ "revoke",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}"
+ }
+ ]
+ },
+ "description": "To revoke a mandate registered against a customer"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario17- Revoke mandates/Revoke - Mandates/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/.meta.json
new file mode 100644
index 00000000000..20ac234bf99
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/.meta.json
@@ -0,0 +1,11 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "List - Mandates",
+ "Mandate - Update",
+ "List - Mandates-copy",
+ "Recurring Payments - Create",
+ "Payments - Retrieve-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/event.test.js
new file mode 100644
index 00000000000..0d07a384aed
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/event.test.js
@@ -0,0 +1,46 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "active" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'active'",
+ function () {
+ pm.expect(jsonData.status).to.eql("active");
+ },
+ );
+}
+
+pm.test("[POST]::/payments - Verify last 4 digits of the card", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.card.last4_digits).to.eql("1111");
+});
+
+pm.test("[POST]::/payments - Verify card expiration month", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.card.card_exp_month).to.eql("12");
+});
+
+pm.test("[POST]::/payments - Verify card expiration year", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.card.card_exp_year).to.eql("30");
+});
+
+
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/request.json
new file mode 100644
index 00000000000..349b5117443
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}",
+ "description": "(Required) Unique mandate id"
+ }
+ ]
+ },
+ "description": "To list the details of a mandate"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/event.test.js
new file mode 100644
index 00000000000..3a7c6c4468b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/event.test.js
@@ -0,0 +1,46 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "active" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'active'",
+ function () {
+ pm.expect(jsonData.status).to.eql("active");
+ },
+ );
+}
+
+pm.test("[POST]::/payments - Verify last 4 digits of the card", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.card.last4_digits).to.eql("4242");
+});
+
+pm.test("[POST]::/payments - Verify card expiration month", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.card.card_exp_month).to.eql("10");
+});
+
+pm.test("[POST]::/payments - Verify card expiration year", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.card.card_exp_year).to.eql("25");
+});
+
+
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/request.json
new file mode 100644
index 00000000000..349b5117443
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}",
+ "description": "(Required) Unique mandate id"
+ }
+ ]
+ },
+ "description": "To list the details of a mandate"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/List - Mandates/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/event.test.js
new file mode 100644
index 00000000000..13d57327d21
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/event.test.js
@@ -0,0 +1,80 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/request.json
new file mode 100644
index 00000000000..b8a76d3412a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/request.json
@@ -0,0 +1,102 @@
+{
+ "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": 0,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "12",
+ "card_exp_year": "30",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "payment_type": "setup_mandate",
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "update_mandate_id": "{{mandate_id}}",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Mandate -Update/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/event.test.js
new file mode 100644
index 00000000000..29cba989186
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/event.test.js
@@ -0,0 +1,109 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log(
+ "- use {{customer_id}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/request.json
new file mode 100644
index 00000000000..4a698997169
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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": 0,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "customer_id": "customer_{{$randomAbbreviation}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "payment_type": "setup_mandate",
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..fe8fa706b96
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,75 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..4d0a9b9ca2c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/event.test.js
@@ -0,0 +1,87 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..e2ddde7136f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/event.test.js
@@ -0,0 +1,95 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "payment_method_data"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..0ae243421f6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18- Update mandate card details/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/.meta.json
new file mode 100644
index 00000000000..60051ecca22
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..b2f94f95cf3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/event.test.js
@@ -0,0 +1,67 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_customer_action" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/request.json
new file mode 100644
index 00000000000..19f21ff741b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/request.json
@@ -0,0 +1,98 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "business_country": "US",
+ "business_label": "default",
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "setup_future_usage": "on_session",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4000000000001000",
+ "card_exp_month": "01",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..a41f14a8e9a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/event.test.js
@@ -0,0 +1,67 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_customer_action" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'requires_customer_action'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19- Create 3ds payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..636ad8002fa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
@@ -0,0 +1,62 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
new file mode 100644
index 00000000000..d1d4064139b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
new file mode 100644
index 00000000000..905cc479002
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
new file mode 100644
index 00000000000..e9f43ea28c3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..cbed79e0c47
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/.meta.json
new file mode 100644
index 00000000000..60051ecca22
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/event.test.js
new file mode 100644
index 00000000000..b2f94f95cf3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/event.test.js
@@ -0,0 +1,67 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_customer_action" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/request.json
new file mode 100644
index 00000000000..576f81c5d89
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/request.json
@@ -0,0 +1,111 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4000000000001000",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..a41f14a8e9a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/event.test.js
@@ -0,0 +1,67 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_customer_action" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'requires_customer_action'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_customer_action");
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20- Create 3ds mandate/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json
new file mode 100644
index 00000000000..eef3cab151c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json
@@ -0,0 +1,9 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve",
+ "Recurring Payments - Create",
+ "Payments - Retrieve-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..f92fba3d044
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json
new file mode 100644
index 00000000000..c564a62c80e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json
@@ -0,0 +1,102 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js
new file mode 100644
index 00000000000..ddc23615a00
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js
@@ -0,0 +1,100 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log(
+ "- use {{customer_id}} as collection variable for value",
+ jsonData.customer_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/request.json
new file mode 100644
index 00000000000..726a3b13fdb
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "customer{{$randomAlphaNumeric}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..fe8fa706b96
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,75 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..e2ddde7136f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
@@ -0,0 +1,95 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "payment_method_data"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..0ae243421f6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..0c2cda65e52
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
@@ -0,0 +1,61 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/request.json
new file mode 100644
index 00000000000..604ac54144d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": null,
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.test.js
new file mode 100644
index 00000000000..905cc479002
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/request.json
new file mode 100644
index 00000000000..e9f43ea28c3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..cbed79e0c47
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..73f8c8f4563
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js
@@ -0,0 +1,61 @@
+// 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/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/request.json
new file mode 100644
index 00000000000..371ef616fe4
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "",
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.test.js
new file mode 100644
index 00000000000..905cc479002
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/request.json
new file mode 100644
index 00000000000..e9f43ea28c3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..22f8a448751
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..9d295f66040
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/event.test.js
@@ -0,0 +1,60 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
new file mode 100644
index 00000000000..8ac0a623f77
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
@@ -0,0 +1,73 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/event.test.js
new file mode 100644
index 00000000000..905cc479002
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
new file mode 100644
index 00000000000..e9f43ea28c3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..cbed79e0c47
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/.meta.json
new file mode 100644
index 00000000000..e4ef30e39e8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Capture",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..44a6caa3e3a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json
new file mode 100644
index 00000000000..8efb99d3c90
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 6540,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/event.test.js
new file mode 100644
index 00000000000..c591a4e66b6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json
new file mode 100644
index 00000000000..0f5db3f39df
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..f88687240aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/.meta.json
new file mode 100644
index 00000000000..e4ef30e39e8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Capture",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..ad7ec549dd5
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6000);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/request.json
new file mode 100644
index 00000000000..8975575ca40
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 6000,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/event.test.js
new file mode 100644
index 00000000000..c591a4e66b6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/request.json
new file mode 100644
index 00000000000..0f5db3f39df
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..27ce6277ba8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario4a-Create payment with partial capture/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/.meta.json
new file mode 100644
index 00000000000..14bab2fbd26
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Cancel",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js
new file mode 100644
index 00000000000..dcf3f191643
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js
@@ -0,0 +1,61 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/cancel - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/cancel - 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/:id/cancel - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "cancelled" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'",
+ function () {
+ pm.expect(jsonData.status).to.eql("cancelled");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/request.json
new file mode 100644
index 00000000000..f64e37a125a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/request.json
@@ -0,0 +1,43 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "cancellation_reason": "requested_by_customer"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/cancel",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "cancel"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..c591a4e66b6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json
new file mode 100644
index 00000000000..0f5db3f39df
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..5ecc1148ece
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "cancelled" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'",
+ function () {
+ pm.expect(jsonData.status).to.eql("cancelled");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/.meta.json
new file mode 100644
index 00000000000..02cae2ee1d7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9885d5f5e70
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json
new file mode 100644
index 00000000000..3426ad7a087
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..d413cc72648
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/event.test.js
@@ -0,0 +1,59 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..46c1ca22124
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json
new file mode 100644
index 00000000000..5e306df7a55
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 6540,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..25b292d1911
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/.meta.json
new file mode 100644
index 00000000000..a2bda58fedc
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/.meta.json
@@ -0,0 +1,11 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Refunds - Create",
+ "Refunds - Retrieve",
+ "Refunds - Create-copy",
+ "Refunds - Retrieve-copy",
+ "Payments - Retrieve-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9885d5f5e70
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/request.json
new file mode 100644
index 00000000000..3426ad7a087
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..1539b3d9daa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,63 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "refunds"
+pm.test("[POST]::/payments - Content check if 'refunds' exists", function () {
+ pm.expect(typeof jsonData.refunds !== "undefined").to.be.true;
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..4c3c3535efa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/event.test.js
new file mode 100644
index 00000000000..6fed2695166
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "1000" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '1000'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1000);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/request.json
new file mode 100644
index 00000000000..b56057fad5d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 1000,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..a472f116d47
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/request.json
new file mode 100644
index 00000000000..d18aaf8befd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 540,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..4d96411763e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '1000'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(1000);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..cce8d2b8ea9
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario6a-Partial refund/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/.meta.json
new file mode 100644
index 00000000000..9341a6edf0b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/.meta.json
@@ -0,0 +1,10 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "List payment methods for a Customer",
+ "Payments - Retrieve",
+ "Recurring Payments - Create",
+ "Payments - Retrieve-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/event.test.js
new file mode 100644
index 00000000000..f844efad42c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/event.test.js
@@ -0,0 +1,20 @@
+// Validate status 2xx
+pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payment_methods/:customer_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){}
+
+if (jsonData?.customer_payment_methods[0]?.payment_token) {
+ pm.collectionVariables.set("payment_token", jsonData.customer_payment_methods[0].payment_token);
+ console.log("- use {{payment_token}} as collection variable for value", jsonData.customer_payment_methods[0].payment_token);
+} else {
+ console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/request.json
new file mode 100644
index 00000000000..cff6d6d715c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/List payment methods for a Customer/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..636ad8002fa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/event.test.js
@@ -0,0 +1,62 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/request.json
new file mode 100644
index 00000000000..c564a62c80e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/request.json
@@ -0,0 +1,102 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..8b198f9f6f3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/event.test.js
@@ -0,0 +1,87 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/request.json
new file mode 100644
index 00000000000..5eb52f3b470
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..fe8fa706b96
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,75 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..86d60588494
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
@@ -0,0 +1,86 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..e2ddde7136f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
@@ -0,0 +1,95 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "payment_method_data"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..0ae243421f6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7-Create a mandate and recurring payment/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/.meta.json
new file mode 100644
index 00000000000..640b0857841
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/.meta.json
@@ -0,0 +1,9 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Recurring Payments - Create",
+ "Payments - Capture",
+ "Payments - Retrieve-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..44a6caa3e3a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/request.json
new file mode 100644
index 00000000000..8efb99d3c90
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 6540,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/event.test.js
new file mode 100644
index 00000000000..1b37dc2c7d1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/event.test.js
@@ -0,0 +1,97 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/request.json
new file mode 100644
index 00000000000..f0be44bec91
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..fe8fa706b96
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,75 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..7c16f15a6e1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/event.test.js
@@ -0,0 +1,95 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "payment_method_data"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..3aac08f6e3b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario7a-Manual capture for recurring payments/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/.meta.json
new file mode 100644
index 00000000000..e8b3174bc0e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/.meta.json
@@ -0,0 +1,10 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Recurring Payments - Create",
+ "Payments - Retrieve-copy",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..1b37dc2c7d1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/event.test.js
@@ -0,0 +1,97 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/request.json
new file mode 100644
index 00000000000..f0be44bec91
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..ef2a8b7e7ac
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/event.test.js
@@ -0,0 +1,105 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "payment_method_data"
+pm.test(
+ "[POST]::/payments - Content check if 'payment_method_data' exists",
+ function () {
+ pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..7b12dcdde50
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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": 6570,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6570,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..46c1ca22124
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/request.json
new file mode 100644
index 00000000000..5e306df7a55
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 6540,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..25b292d1911
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have value "pending" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'status' matches 'pending'",
+ function () {
+ pm.expect(jsonData.status).to.eql("pending");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario8-Refund recurring payment/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/.meta.json
new file mode 100644
index 00000000000..fc1db5626f0
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/.meta.json
@@ -0,0 +1,12 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "List payment methods for a Customer",
+ "Save card payments - Create",
+ "Save card payments - Confirm",
+ "Payments - Retrieve",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/event.test.js
new file mode 100644
index 00000000000..f844efad42c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/event.test.js
@@ -0,0 +1,20 @@
+// Validate status 2xx
+pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payment_methods/:customer_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){}
+
+if (jsonData?.customer_payment_methods[0]?.payment_token) {
+ pm.collectionVariables.set("payment_token", jsonData.customer_payment_methods[0].payment_token);
+ console.log("- use {{payment_token}} as collection variable for value", jsonData.customer_payment_methods[0].payment_token);
+} else {
+ console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/request.json
new file mode 100644
index 00000000000..cff6d6d715c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/List payment methods for a Customer/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..636ad8002fa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/event.test.js
@@ -0,0 +1,62 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/request.json
new file mode 100644
index 00000000000..fd771e557f8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/request.json
@@ -0,0 +1,87 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4111111111111111",
+ "card_exp_month": "03",
+ "card_exp_year": "2030",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "737"
+ }
+ },
+ "setup_future_usage": "on_session",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/event.test.js
new file mode 100644
index 00000000000..24c0c554d7d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/event.test.js
@@ -0,0 +1,48 @@
+// 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.');
+};
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id);
+} else {
+ console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');
+};
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test("[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_payment_method'", function() {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ })};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json
new file mode 100644
index 00000000000..750011ab177
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json
@@ -0,0 +1,87 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "stripesavecard_{{random_number}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..4ae08a2606b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/event.test.js
@@ -0,0 +1,49 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+// Validate if response has JSON Body
+pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..c71774083b2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..dbc930608cb
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/event.test.js
@@ -0,0 +1,30 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/request.json
new file mode 100644
index 00000000000..4dbca4d01f2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 600,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..bbd8e544e2c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/event.test.js
@@ -0,0 +1,30 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/event.test.js
new file mode 100644
index 00000000000..a2afa5194f4
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/event.test.js
@@ -0,0 +1,72 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+
+// Response body should have value "cybersource" for "connector"
+if (jsonData?.connector) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'cybersource'",
+ function () {
+ pm.expect(jsonData.connector).to.eql("cybersource");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/request.json
new file mode 100644
index 00000000000..68ba9ce708f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/request.json
@@ -0,0 +1,66 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_token": "{{payment_token}}",
+ "card_cvc": "737"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/event.test.js
new file mode 100644
index 00000000000..31c6af0dfbb
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/event.test.js
@@ -0,0 +1,41 @@
+// 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.');
+};
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log("- use {{client_secret}} as collection variable for value",jsonData.client_secret);
+} else {
+ console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');
+};
+
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log("- use {{customer_id}} as collection variable for value",jsonData.customer_id);
+} else {
+ console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');
+};
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/request.json
new file mode 100644
index 00000000000..1f1ca9cbc54
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/request.json
@@ -0,0 +1,92 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://google.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "routing": {
+ "type": "single",
+ "data": "stripe"
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Save card payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/.meta.json
new file mode 100644
index 00000000000..c4939d7ab91
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/.meta.json
@@ -0,0 +1,11 @@
+{
+ "childrenOrder": [
+ "Merchant Account - Create",
+ "API Key - Create",
+ "Payment Connector - Create",
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Refunds - Create",
+ "Refunds - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/event.test.js
new file mode 100644
index 00000000000..4e27c5a5025
--- /dev/null
+++ b/postman/collection-dir/cybersource/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/cybersource/Flow Testcases/QuickStart/API Key - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/request.json
new file mode 100644
index 00000000000..4e4c6628497
--- /dev/null
+++ b/postman/collection-dir/cybersource/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/cybersource/Flow Testcases/QuickStart/API Key - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/API Key - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
new file mode 100644
index 00000000000..70f5e50bbde
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js
@@ -0,0 +1,53 @@
+// 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/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/request.json
new file mode 100644
index 00000000000..faf64d6e2ae
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/request.json
@@ -0,0 +1,101 @@
+{
+ "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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "merchant_id": "postman_merchant_GHAction_{{$guid}}",
+ "locker_id": "m0010",
+ "merchant_name": "NewAge Retailer",
+ "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/success",
+ "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"
+ },
+ "primary_business_details": [
+ {
+ "country": "US",
+ "business": "default"
+ }
+ ]
+ }
+ },
+ "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/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Merchant Account - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
new file mode 100644
index 00000000000..2df9d47d936
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.prerequest.js",
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js
new file mode 100644
index 00000000000..88e92d8d84a
--- /dev/null
+++ b/postman/collection-dir/cybersource/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/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json
new file mode 100644
index 00000000000..1823e35c37b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/request.json
@@ -0,0 +1,115 @@
+{
+ "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": "payment_processor",
+ "connector_name": "cybersource",
+ "connector_account_details": {
+ "auth_type": "SignatureKey",
+ "api_secret": "{{connector_api_secret}}",
+ "api_key": "{{connector_api_key}}",
+ "key1": "{{connector_key1}}"
+ },
+ "test_mode": false,
+ "disabled": false,
+ "payment_methods_enabled": [
+ {
+ "payment_method": "card",
+ "payment_method_types": [
+ {
+ "payment_method_type": "credit",
+ "card_networks": [
+ "AmericanExpress",
+ "Discover",
+ "Interac",
+ "JCB",
+ "Mastercard",
+ "Visa",
+ "DinersClub",
+ "UnionPay",
+ "RuPay"
+ ],
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ },
+ {
+ "payment_method_type": "debit",
+ "card_networks": [
+ "AmericanExpress",
+ "Discover",
+ "Interac",
+ "JCB",
+ "Mastercard",
+ "Visa",
+ "DinersClub",
+ "UnionPay",
+ "RuPay"
+ ],
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "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/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payment Connector - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/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/cybersource/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/event.test.js
new file mode 100644
index 00000000000..a63c5a19df6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/event.test.js
@@ -0,0 +1,91 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log(
+ "- use {{customer_id}} as collection variable for value",
+ jsonData.customer_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "succeeded"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have an error message
+if (jsonData?.error_message) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error_message' is not 'null'",
+ function () {
+ pm.expect(jsonData.error_message).is.not.null;
+ },
+ );
+}
+
+// Response body should have "connector_transaction_id"
+pm.test(
+ "[POST]::/payments - Content check if 'connector_transaction_id' exists",
+ function () {
+ pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
+ .true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/request.json
new file mode 100644
index 00000000000..1f7ee652671
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -0,0 +1,94 @@
+{
+ "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": 12345,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 12345,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+1",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_type": "credit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/QuickStart/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..d0a02af7436
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/event.test.js
@@ -0,0 +1,61 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+// Validate if response has JSON Body
+pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..c71774083b2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..f88e7ae9d6a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/event.test.js
@@ -0,0 +1,40 @@
+// Validate status 2xx
+pm.test("[POST]::/refunds - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+
+// Response body should have "profile_id" and not "null"
+pm.test(
+ "[POST]::/payments - Content check if 'profile_id' exists and is not 'null'",
+ function () {
+ pm.expect(typeof jsonData.profile_id !== "undefined").to.be.true;
+ pm.expect(jsonData.profile_id).is.not.null;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/request.json
new file mode 100644
index 00000000000..4dbca4d01f2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 600,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
new file mode 100644
index 00000000000..bbd8e544e2c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/event.test.js
@@ -0,0 +1,30 @@
+// Validate status 2xx
+pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/request.json
new file mode 100644
index 00000000000..6c28619e856
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/QuickStart/Refunds - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/.meta.json
new file mode 100644
index 00000000000..b7ca4ab1f55
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/.meta.json
@@ -0,0 +1,20 @@
+{
+ "childrenOrder": [
+ "Scenario1-Create payment with Invalid card details",
+ "Scenario2-Confirming the payment without PMD",
+ "Scenario3-Capture greater amount",
+ "Scenario4-Capture the succeeded payment",
+ "Scenario5-Void the success_slash_failure payment",
+ "Scenario7-Refund exceeds amount",
+ "Scenario8-Refund for unsuccessful payment",
+ "Scenario9-Create a recurring payment with greater mandate amount",
+ "Scenario10-Manual multiple capture",
+ "Scenario11-Failure card",
+ "Scenario12-Refund exceeds amount captured",
+ "Scenario13-Revoke for revoked mandates",
+ "Scenario14-Recurring payment for revoked mandates",
+ "Scenario15-Setup_future_usage is off_session for normal payments",
+ "Scenario16-Setup_future_usage is on_session for mandates payments -confirm false",
+ "Scenario17-Setup_future_usage is null for normal payments"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/.meta.json
new file mode 100644
index 00000000000..6604e8a748b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create(Invalid card number)",
+ "Payments - Create(Invalid Exp month)",
+ "Payments - Create(Invalid Exp Year)",
+ "Payments - Create(invalid CVV)"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/event.test.js
new file mode 100644
index 00000000000..c4b29d78d25
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/event.test.js
@@ -0,0 +1,73 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "next_action.redirect_to_url"
+pm.test("[POST]::/payments - Content check if 'error' exists", function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+});
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
+
+// Response body should have value "connector error" for "error message"
+if (jsonData?.error?.message) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.message' matches 'Invalid Expiry Year'",
+ function () {
+ pm.expect(jsonData.error.message).to.eql("Invalid Expiry Year");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json
new file mode 100644
index 00000000000..bba838e5e1b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "2022",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/event.test.js
new file mode 100644
index 00000000000..ee90c62b81b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/event.test.js
@@ -0,0 +1,63 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "next_action.redirect_to_url"
+pm.test("[POST]::/payments - Content check if 'error' exists", function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+});
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json
new file mode 100644
index 00000000000..7da436d9d14
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "01",
+ "card_exp_year": "2023",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/event.test.js
new file mode 100644
index 00000000000..a58e23401e4
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/event.test.js
@@ -0,0 +1,63 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test("[POST]::/payments - Content check if 'error' exists", function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+});
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("connector_error");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json
new file mode 100644
index 00000000000..183f96f5a5f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "123456",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "united states",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "united states",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/event.test.js
new file mode 100644
index 00000000000..81ba4d3442c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/event.test.js
@@ -0,0 +1,63 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test("[POST]::/payments - Content check if 'error' exists", function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+});
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'connector'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("connector");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json
new file mode 100644
index 00000000000..a68012553e8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "123456",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "12345"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/.meta.json
new file mode 100644
index 00000000000..abc159198ae
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/event.test.js
new file mode 100644
index 00000000000..90bb7fec7de
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 5xx
+pm.test("[POST]::/payments - Status code is 5xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/request.json
new file mode 100644
index 00000000000..075eee8ca46
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual_multiple",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario10- Manual multiple capture/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/.meta.json
new file mode 100644
index 00000000000..60051ecca22
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/event.test.js
new file mode 100644
index 00000000000..1d169aade2d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "failed" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'failed'",
+ function () {
+ pm.expect(jsonData.status).to.eql("failed");
+ },
+ );
+}
+
+// Check if error code exists
+pm.test("[POST]::/payments - Content check if error code exists", function () {
+ pm.expect(jsonData.error_code).to.not.equal(null);;
+});
+
+// Check if error message exists
+pm.test("[POST]::/payments - Content check if error message exists", function () {
+ pm.expect(jsonData.error_message).to.not.equal(null);;
+});
+
+
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/request.json
new file mode 100644
index 00000000000..643920b4c64
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/request.json
@@ -0,0 +1,98 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "business_country": "US",
+ "business_label": "default",
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "setup_future_usage": "on_session",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_type": "debit",
+ "payment_method_data": {
+ "card": {
+ "card_number": "412345678912345678914",
+ "card_exp_month": "01",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari",
+ "last_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..0ef16bb9566
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/event.test.js
@@ -0,0 +1,69 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "failed" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'failed'",
+ function () {
+ pm.expect(jsonData.status).to.eql("failed");
+ },
+ );
+}
+
+// Check if error code exists
+pm.test("[POST]::/payments - Content check if error code exists", function () {
+ pm.expect(jsonData.error_code).to.not.equal(null);;
+});
+
+// Check if error message exists
+pm.test("[POST]::/payments - Content check if error message exists", function () {
+ pm.expect(jsonData.error_message).to.not.equal(null);;
+});
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario11-Failure card/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/.meta.json
new file mode 100644
index 00000000000..daea208e6af
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Capture",
+ "Payments - Retrieve",
+ "Refunds - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..ad7ec549dd5
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/event.test.js
@@ -0,0 +1,81 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6000);
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/request.json
new file mode 100644
index 00000000000..8975575ca40
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 6000,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/event.test.js
new file mode 100644
index 00000000000..c591a4e66b6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/request.json
new file mode 100644
index 00000000000..17124cfef67
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..550547e3399
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..07721f97af3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 4xx
+pm.test("[POST]::/refunds - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "invalid_request" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
+
+// Response body should have value "The refund amount exceeds the amount captured" for "error message"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.message' matches 'The refund amount exceeds the amount captured'",
+ function () {
+ pm.expect(jsonData.error.message).to.eql("The refund amount exceeds the amount captured");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/request.json
new file mode 100644
index 00000000000..5e306df7a55
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 6540,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario12-Refund exceeds amount captured/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/.meta.json
new file mode 100644
index 00000000000..3e828fa121b
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Revoke - Mandates",
+ "Revoke - Mandates-copy"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9d11debb6e8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/event.test.js
@@ -0,0 +1,98 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/request.json
new file mode 100644
index 00000000000..f0be44bec91
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
new file mode 100644
index 00000000000..41174ecd8a6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/event.test.js
@@ -0,0 +1,31 @@
+// Validate status 4xx
+pm.test("[GET]::/payments/:id - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
+
+pm.test("[POST]::/payments - Content check if value for 'error.reason' matches 'Mandate has already been revoked", function () {
+ pm.expect(jsonData.error.reason).to.eql("Mandate has already been revoked");
+});
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/request.json
new file mode 100644
index 00000000000..3c7b05bbde6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/revoke/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ "revoke",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}"
+ }
+ ]
+ },
+ "description": "To revoke a mandate registered against a customer"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates-copy/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/event.test.js
new file mode 100644
index 00000000000..74c5e000fc3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/event.test.js
@@ -0,0 +1,37 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "revoked" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'revoked'",
+ function () {
+ pm.expect(jsonData.status).to.eql("revoked");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/request.json
new file mode 100644
index 00000000000..3c7b05bbde6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/revoke/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ "revoke",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}"
+ }
+ ]
+ },
+ "description": "To revoke a mandate registered against a customer"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario13- Revoke for revoked mandates/Revoke - Mandates/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/.meta.json
new file mode 100644
index 00000000000..4f0d340c47e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Revoke - Mandates",
+ "Recurring Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/event.test.js
new file mode 100644
index 00000000000..1b37dc2c7d1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/event.test.js
@@ -0,0 +1,97 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/request.json
new file mode 100644
index 00000000000..f0be44bec91
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..fe8fa706b96
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/event.test.js
@@ -0,0 +1,75 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..c121237d81c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/event.test.js
@@ -0,0 +1,50 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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 client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
+
+pm.test("[POST]::/payments - Content check if value for 'error.message' matches 'Mandate is not active", function () {
+ pm.expect(jsonData.error.message).to.eql("mandate is not active");
+});
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..0ae243421f6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
new file mode 100644
index 00000000000..74c5e000fc3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/event.test.js
@@ -0,0 +1,37 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/: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) {}
+
+
+// Response body should have value "revoked" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'revoked'",
+ function () {
+ pm.expect(jsonData.status).to.eql("revoked");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/request.json
new file mode 100644
index 00000000000..3c7b05bbde6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/request.json
@@ -0,0 +1,27 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/mandates/revoke/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "mandates",
+ "revoke",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{mandate_id}}"
+ }
+ ]
+ },
+ "description": "To revoke a mandate registered against a customer"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario14- Recurring payment for revoked mandates/Revoke - Mandates/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/.meta.json
new file mode 100644
index 00000000000..abc159198ae
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
new file mode 100644
index 00000000000..fa63b7d5d7c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/event.test.js
@@ -0,0 +1,63 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
+
+pm.test("[POST]::/payments - Content check if value for 'error.message' matches 'setup_future_usage` cannot be `off_session` for normal payments", function () {
+ pm.expect(jsonData.error.message).to.eql("`setup_future_usage` cannot be `off_session` for normal payments");
+});
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/request.json
new file mode 100644
index 00000000000..5f55f09c9b4
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/request.json
@@ -0,0 +1,80 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "customer_{{$randomAlphaNumeric}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "setup_future_usage": "off_session",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario15- Setup_future_usage is off_session for normal payments/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
new file mode 100644
index 00000000000..90b19864ee1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..e669e9b3f4a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/event.test.js
@@ -0,0 +1,69 @@
+// Validate status 4xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
+
+pm.test("[POST]::/payments - Content check if value for 'error.message' matches 'setup_future_usage` cannot be `off_session` for normal payments", function () {
+ pm.expect(jsonData.error.message).to.eql("`setup_future_usage` must be `off_session` for mandates");
+});
+
+
+
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
new file mode 100644
index 00000000000..c9da92e0ca9
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/request.json
@@ -0,0 +1,102 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "setup_future_usage": "on_session",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9439fd2a581
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log(
+ "- use {{customer_id}} as collection variable for value",
+ jsonData.customer_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
new file mode 100644
index 00000000000..a929371080c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "customer{{$randomAlphaNumeric}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario16- Setup_future_usage is on_session for mandates payments -confirm false/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/.meta.json
new file mode 100644
index 00000000000..a61911ba718
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "List payment methods for a Customer"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
new file mode 100644
index 00000000000..5362f6707b3
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/event.test.js
@@ -0,0 +1,18 @@
+// Validate status 2xx
+pm.test("[GET]::/payment_methods/:customer_id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payment_methods/:customer_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.test("[GET]::/payment_methods/:customer_id Check if card not stored in the locker ", function () {
+ var jsonData = pm.response.json();
+ pm.expect(jsonData.customer_payment_methods).to.be.an('array').that.is.empty;
+});
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
new file mode 100644
index 00000000000..cff6d6d715c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/List payment methods for a Customer/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..e81508b4d42
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/event.test.js
@@ -0,0 +1,62 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/request.json
new file mode 100644
index 00000000000..09824d84312
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/request.json
@@ -0,0 +1,86 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": null,
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9439fd2a581
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id
+if (jsonData?.customer_id) {
+ pm.collectionVariables.set("customer_id", jsonData.customer_id);
+ console.log(
+ "- use {{customer_id}} as collection variable for value",
+ jsonData.customer_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/request.json
new file mode 100644
index 00000000000..a929371080c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/request.json
@@ -0,0 +1,79 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "customer{{$randomAlphaNumeric}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario17- Setup_future_usage is null for normal payments/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/.meta.json
new file mode 100644
index 00000000000..90b19864ee1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..839f2246ae7
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/event.test.js
@@ -0,0 +1,69 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json
new file mode 100644
index 00000000000..16f6e13983f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/request.json
@@ -0,0 +1,63 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "client_secret": "{{client_secret}}"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/event.test.js
new file mode 100644
index 00000000000..905cc479002
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json
new file mode 100644
index 00000000000..6a2576612d6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json
@@ -0,0 +1,77 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/.meta.json
new file mode 100644
index 00000000000..e4ef30e39e8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Capture",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..51484967314
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/event.test.js
@@ -0,0 +1,69 @@
+// Validate status 4xx
+pm.test("[POST]::/payments/:id/capture - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/request.json
new file mode 100644
index 00000000000..766a8330d6e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 7000,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/event.test.js
new file mode 100644
index 00000000000..c591a4e66b6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json
new file mode 100644
index 00000000000..0f5db3f39df
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..5bbd978e9ca
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/.meta.json
new file mode 100644
index 00000000000..cafd3a6808e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Capture"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..51484967314
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/event.test.js
@@ -0,0 +1,69 @@
+// Validate status 4xx
+pm.test("[POST]::/payments/:id/capture - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - 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/:id/capture - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/request.json
new file mode 100644
index 00000000000..766a8330d6e
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/request.json
@@ -0,0 +1,45 @@
+{
+ "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_to_capture": 7000,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9885d5f5e70
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json
new file mode 100644
index 00000000000..3426ad7a087
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/.meta.json
new file mode 100644
index 00000000000..afba25ab6d6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Cancel"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/event.test.js
new file mode 100644
index 00000000000..0f869a6dfb8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/event.test.js
@@ -0,0 +1,69 @@
+// Validate status 4xx
+pm.test("[POST]::/payments/:id/cancel - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/cancel - 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/:id/cancel - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/request.json
new file mode 100644
index 00000000000..f64e37a125a
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/request.json
@@ -0,0 +1,43 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "cancellation_reason": "requested_by_customer"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/cancel",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "cancel"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Cancel/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9885d5f5e70
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json
new file mode 100644
index 00000000000..3426ad7a087
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/.meta.json
new file mode 100644
index 00000000000..46f7f556951
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Refunds - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/event.test.js
new file mode 100644
index 00000000000..9885d5f5e70
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json
new file mode 100644
index 00000000000..3426ad7a087
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..4c3c3535efa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..776dbd70712
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/event.test.js
@@ -0,0 +1,48 @@
+// Validate status 4xx
+pm.test("[POST]::/refunds - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/request.json
new file mode 100644
index 00000000000..326319e8fdf
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 7000,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json
new file mode 100644
index 00000000000..46f7f556951
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Refunds - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/event.test.js
new file mode 100644
index 00000000000..1961240af6c
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_confirmation" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_confirmation");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
new file mode 100644
index 00000000000..9fa2aeb5cc8
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
@@ -0,0 +1,89 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..ca287ae17d6
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
@@ -0,0 +1,58 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_confirmation" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_confirmation");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js
new file mode 100644
index 00000000000..d3c4451760d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js
@@ -0,0 +1,48 @@
+// Validate status 4xx
+pm.test("[POST]::/refunds - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
+if (jsonData?.refund_id) {
+ pm.collectionVariables.set("refund_id", jsonData.refund_id);
+ console.log(
+ "- use {{refund_id}} as collection variable for value",
+ jsonData.refund_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "invalid_request" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json
new file mode 100644
index 00000000000..d18aaf8befd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json
@@ -0,0 +1,42 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "payment_id": "{{payment_id}}",
+ "amount": 540,
+ "reason": "Customer returned product",
+ "refund_type": "instant",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/.meta.json
new file mode 100644
index 00000000000..2ac05e6e39d
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve",
+ "Recurring Payments - Create"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js
new file mode 100644
index 00000000000..1b37dc2c7d1
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/event.test.js
@@ -0,0 +1,97 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
new file mode 100644
index 00000000000..4bf62f4f29f
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
@@ -0,0 +1,106 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "{{customer_id}}",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "setup_future_usage": "off_session",
+ "mandate_data": {
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
+ "mandate_type": {
+ "single_use": {
+ "amount": 7000,
+ "currency": "USD"
+ }
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "likhin",
+ "last_name": "bopanna"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "count_tickets": 1,
+ "transaction_number": "5590045"
+ }
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..58d2dfe66dd
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "Succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
+
+// Response body should have "mandate_id"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_id' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have "mandate_data"
+pm.test(
+ "[POST]::/payments - Content check if 'mandate_data' exists",
+ function () {
+ pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
+ },
+);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js
new file mode 100644
index 00000000000..e862404c2b2
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/event.test.js
@@ -0,0 +1,79 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "invalid_request" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
new file mode 100644
index 00000000000..12646e4c9ca
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
@@ -0,0 +1,75 @@
+{
+ "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": 8040,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "mandate_id": "{{mandate_id}}",
+ "off_session": true,
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "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/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/Health check/.meta.json b/postman/collection-dir/cybersource/Health check/.meta.json
new file mode 100644
index 00000000000..66ee7e50cab
--- /dev/null
+++ b/postman/collection-dir/cybersource/Health check/.meta.json
@@ -0,0 +1,5 @@
+{
+ "childrenOrder": [
+ "New Request"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Health check/New Request/.event.meta.json b/postman/collection-dir/cybersource/Health check/New Request/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/cybersource/Health check/New Request/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/cybersource/Health check/New Request/event.test.js b/postman/collection-dir/cybersource/Health check/New Request/event.test.js
new file mode 100644
index 00000000000..b490b8be090
--- /dev/null
+++ b/postman/collection-dir/cybersource/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/cybersource/Health check/New Request/request.json b/postman/collection-dir/cybersource/Health check/New Request/request.json
new file mode 100644
index 00000000000..4cc8d4b1a96
--- /dev/null
+++ b/postman/collection-dir/cybersource/Health check/New Request/request.json
@@ -0,0 +1,20 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/health",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "health"
+ ]
+ }
+}
diff --git a/postman/collection-dir/cybersource/Health check/New Request/response.json b/postman/collection-dir/cybersource/Health check/New Request/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/cybersource/Health check/New Request/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/cybersource/event.prerequest.js b/postman/collection-dir/cybersource/event.prerequest.js
new file mode 100644
index 00000000000..baeff37e44b
--- /dev/null
+++ b/postman/collection-dir/cybersource/event.prerequest.js
@@ -0,0 +1,4 @@
+pm.request.headers.add({
+ key: 'x-feature',
+ value: 'router_custom'
+});
diff --git a/postman/collection-dir/cybersource/event.test.js b/postman/collection-dir/cybersource/event.test.js
new file mode 100644
index 00000000000..fb52caec30f
--- /dev/null
+++ b/postman/collection-dir/cybersource/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"));
|
ci
|
Add Cybersource Collection (#3657)
|
e769abe501470185fcca29e0abede0654579da06
|
2024-05-07 12:50:59
|
Shankar Singh C
|
feat(router): add an api to enable `connector_agnostic_mit` feature (#4480)
| false
|
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index fde693a3700..75bd2a31d8e 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -1100,6 +1100,13 @@ pub struct ExtendedCardInfoChoice {
impl common_utils::events::ApiEventMetric for ExtendedCardInfoChoice {}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
+pub struct ConnectorAgnosticMitChoice {
+ pub enabled: bool,
+}
+
+impl common_utils::events::ApiEventMetric for ConnectorAgnosticMitChoice {}
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ExtendedCardInfoConfig {
/// Merchant public key
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 90a9dcbb7d8..1131e9ad674 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -37,6 +37,7 @@ pub struct BusinessProfile {
pub authentication_connector_details: Option<serde_json::Value>,
pub is_extended_card_info_enabled: Option<bool>,
pub extended_card_info_config: Option<pii::SecretSerdeValue>,
+ pub is_connector_agnostic_mit_enabled: Option<bool>,
}
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
@@ -65,6 +66,7 @@ pub struct BusinessProfileNew {
pub authentication_connector_details: Option<serde_json::Value>,
pub is_extended_card_info_enabled: Option<bool>,
pub extended_card_info_config: Option<pii::SecretSerdeValue>,
+ pub is_connector_agnostic_mit_enabled: Option<bool>,
}
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
@@ -90,6 +92,7 @@ pub struct BusinessProfileUpdateInternal {
pub authentication_connector_details: Option<serde_json::Value>,
pub is_extended_card_info_enabled: Option<bool>,
pub extended_card_info_config: Option<pii::SecretSerdeValue>,
+ pub is_connector_agnostic_mit_enabled: Option<bool>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
@@ -117,6 +120,9 @@ pub enum BusinessProfileUpdate {
ExtendedCardInfoUpdate {
is_extended_card_info_enabled: Option<bool>,
},
+ ConnectorAgnosticMitUpdate {
+ is_connector_agnostic_mit_enabled: Option<bool>,
+ },
}
impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
@@ -168,6 +174,12 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
is_extended_card_info_enabled,
..Default::default()
},
+ BusinessProfileUpdate::ConnectorAgnosticMitUpdate {
+ is_connector_agnostic_mit_enabled,
+ } => Self {
+ is_connector_agnostic_mit_enabled,
+ ..Default::default()
+ },
}
}
}
@@ -195,6 +207,7 @@ impl From<BusinessProfileNew> for BusinessProfile {
payment_link_config: new.payment_link_config,
session_expiry: new.session_expiry,
authentication_connector_details: new.authentication_connector_details,
+ is_connector_agnostic_mit_enabled: new.is_connector_agnostic_mit_enabled,
is_extended_card_info_enabled: new.is_extended_card_info_enabled,
extended_card_info_config: new.extended_card_info_config,
}
@@ -223,6 +236,7 @@ impl BusinessProfileUpdate {
authentication_connector_details,
is_extended_card_info_enabled,
extended_card_info_config,
+ is_connector_agnostic_mit_enabled,
} = self.into();
BusinessProfile {
profile_name: profile_name.unwrap_or(source.profile_name),
@@ -245,6 +259,7 @@ impl BusinessProfileUpdate {
session_expiry,
authentication_connector_details,
is_extended_card_info_enabled,
+ is_connector_agnostic_mit_enabled,
extended_card_info_config,
..source
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index f5dc5abe1e6..2e28bc5d30f 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -194,6 +194,7 @@ diesel::table! {
authentication_connector_details -> Nullable<Jsonb>,
is_extended_card_info_enabled -> Nullable<Bool>,
extended_card_info_config -> Nullable<Jsonb>,
+ is_connector_agnostic_mit_enabled -> Nullable<Bool>,
}
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 7d2fabc3f37..0b8d52332d9 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1739,6 +1739,47 @@ pub async fn extended_card_info_toggle(
Ok(service_api::ApplicationResponse::Json(ext_card_info_choice))
}
+pub async fn connector_agnostic_mit_toggle(
+ state: AppState,
+ merchant_id: &str,
+ profile_id: &str,
+ connector_agnostic_mit_choice: admin_types::ConnectorAgnosticMitChoice,
+) -> RouterResponse<admin_types::ConnectorAgnosticMitChoice> {
+ let db = state.store.as_ref();
+
+ let business_profile = db
+ .find_business_profile_by_profile_id(profile_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.to_string(),
+ })?;
+
+ if business_profile.merchant_id != merchant_id {
+ Err(errors::ApiErrorResponse::AccessForbidden {
+ resource: profile_id.to_string(),
+ })?
+ }
+
+ if business_profile.is_connector_agnostic_mit_enabled
+ != Some(connector_agnostic_mit_choice.enabled)
+ {
+ let business_profile_update =
+ storage::business_profile::BusinessProfileUpdate::ConnectorAgnosticMitUpdate {
+ is_connector_agnostic_mit_enabled: Some(connector_agnostic_mit_choice.enabled),
+ };
+
+ db.update_business_profile_by_profile_id(business_profile, business_profile_update)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.to_owned(),
+ })?;
+ }
+
+ Ok(service_api::ApplicationResponse::Json(
+ connector_agnostic_mit_choice,
+ ))
+}
+
pub(crate) fn validate_auth_and_metadata_type(
connector_name: api_models::enums::Connector,
val: &types::ConnectorAuthType,
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index 63d9f840a00..d9cadf002c1 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -589,6 +589,32 @@ pub async fn business_profiles_list(
)
.await
}
+
+#[instrument(skip_all, fields(flow = ?Flow::ToggleConnectorAgnosticMit))]
+pub async fn toggle_connector_agnostic_mit(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ path: web::Path<(String, String)>,
+ json_payload: web::Json<api_models::admin::ConnectorAgnosticMitChoice>,
+) -> HttpResponse {
+ let flow = Flow::ToggleConnectorAgnosticMit;
+ let (merchant_id, profile_id) = path.into_inner();
+
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, _, req, _| connector_agnostic_mit_toggle(state, &merchant_id, &profile_id, req),
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::RoutingWrite),
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
/// Merchant Account - KV Status
///
/// Toggle KV mode for the Merchant Account
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0f3673ee206..6a8a4ee5e03 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1131,6 +1131,10 @@ impl BusinessProfile {
.service(
web::resource("/toggle_extended_card_info")
.route(web::post().to(toggle_extended_card_info)),
+ )
+ .service(
+ web::resource("/toggle_connector_agnostic_mit")
+ .route(web::post().to(toggle_connector_agnostic_mit)),
),
)
}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 4d1121a8eab..bf91f8055d1 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -168,7 +168,8 @@ impl From<Flow> for ApiIdentifier {
| Flow::BusinessProfileRetrieve
| Flow::BusinessProfileDelete
| Flow::BusinessProfileList
- | Flow::ToggleExtendedCardInfo => Self::Business,
+ | Flow::ToggleExtendedCardInfo
+ | Flow::ToggleConnectorAgnosticMit => Self::Business,
Flow::PaymentLinkRetrieve
| Flow::PaymentLinkInitiate
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 77fe8371817..793d042ea49 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -175,6 +175,7 @@ impl ForeignTryFrom<(domain::MerchantAccount, BusinessProfileCreate)>
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "authentication_connector_details",
})?,
+ is_connector_agnostic_mit_enabled: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
})
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 78f570f647e..e8ffe0685b2 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -406,6 +406,8 @@ pub enum Flow {
RetrievePollStatus,
/// Toggles the extended card info feature in profile level
ToggleExtendedCardInfo,
+ /// Toggles the extended card info feature in profile level
+ ToggleConnectorAgnosticMit,
/// Get the extended card info associated to a payment_id
GetExtendedCardInfo,
}
diff --git a/migrations/2024-04-24-111807_add-is-connector_agnostic_mit/down.sql b/migrations/2024-04-24-111807_add-is-connector_agnostic_mit/down.sql
new file mode 100644
index 00000000000..80672e85a26
--- /dev/null
+++ b/migrations/2024-04-24-111807_add-is-connector_agnostic_mit/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+
+ALTER TABLE business_profile DROP COLUMN IF EXISTS is_connector_agnostic_mit_enabled;
\ No newline at end of file
diff --git a/migrations/2024-04-24-111807_add-is-connector_agnostic_mit/up.sql b/migrations/2024-04-24-111807_add-is-connector_agnostic_mit/up.sql
new file mode 100644
index 00000000000..beee3325617
--- /dev/null
+++ b/migrations/2024-04-24-111807_add-is-connector_agnostic_mit/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+
+ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_connector_agnostic_mit_enabled BOOLEAN DEFAULT FALSE;
\ No newline at end of file
|
feat
|
add an api to enable `connector_agnostic_mit` feature (#4480)
|
ab84f76e0426f3d125acb379f704d7602f96b06c
|
2023-12-12 13:45:26
|
Pa1NarK
|
ci(postman): update postman collection for stripe and trustpay (#3108)
| false
|
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
index 62945fedcfa..bfeee020b5d 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
@@ -2,14 +2,18 @@
"childrenOrder": [
"Scenario1-Create payment with confirm true",
"Scenario2-Create payment with confirm false",
+ "Scenario2a-Create payment with confirm false card holder name null",
+ "Scenario2b-Create payment with confirm false card holder name empty",
"Scenario3-Create payment without PMD",
"Scenario4-Create payment with Manual capture",
+ "Scenario4a-Create payment with manual_multiple capture",
"Scenario5-Void the payment",
"Scenario6-Create 3DS payment",
"Scenario7-Create 3DS payment with confrm false",
+ "Scenario8-Create a failure card payment with confirm true",
"Scenario9-Refund full payment",
- "Scenario10-Partial refund",
- "Scenario11-Create a mandate and recurring payment",
+ "Scenario9a-Partial refund",
+ "Scenario10-Create a mandate and recurring payment",
"Scenario11-Refund recurring payment",
"Scenario12-BNPL-klarna",
"Scenario13-BNPL-afterpay",
@@ -19,9 +23,13 @@
"Scenario17-Bank Redirect-eps",
"Scenario18-Bank Redirect-giropay",
"Scenario19-Bank Transfer-ach",
- "Scenario19-Bank Debit-ach",
- "Scenario22-Wallet-Wechatpay",
+ "Scenario20-Bank Debit-ach",
+ "Scenario21-Wallet-Wechatpay",
"Scenario22- Update address and List Payment method",
- "Scenario23- Update Amount"
+ "Scenario23- Update Amount",
+ "Scenario24-Add card flow",
+ "Scenario25-Don't Pass CVV for save card flow and verifysuccess payment",
+ "Scenario26-Save card payment with manual capture",
+ "Scenario27-Create payment without customer_id and with billing address and shipping address"
]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
similarity index 97%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
index a5c9391cf74..3ffbe03a605 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
@@ -98,8 +98,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/request.json
similarity index 96%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/request.json
index 01f47678bea..613e9148f78 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/request.json
@@ -61,8 +61,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/request.json
deleted file mode 100644
index caed7818578..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/request.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "payment_id": "{{payment_id}}",
- "amount": 1000,
- "reason": "Customer returned product",
- "refund_type": "instant",
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": ["{{baseUrl}}"],
- "path": ["refunds"]
- },
- "description": "To create a refund against an already processed payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/request.json
deleted file mode 100644
index c4271891fbf..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/request.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/refunds/:id",
- "host": ["{{baseUrl}}"],
- "path": ["refunds", ":id"],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
- ]
- },
- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
index 599c708ba73..9df18b5e886 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
@@ -86,8 +86,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve-copy/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json
index 304d0335058..fe8a73d4581 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json
@@ -61,8 +61,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/request.json
index 5f4c58816d5..5e306df7a55 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Create Copy/request.json
@@ -31,8 +31,12 @@
},
"url": {
"raw": "{{baseUrl}}/refunds",
- "host": ["{{baseUrl}}"],
- "path": ["refunds"]
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
},
"description": "To create a refund against an already processed payment"
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/request.json
index c4271891fbf..6c28619e856 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Refunds - Retrieve Copy/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/refunds/:id",
- "host": ["{{baseUrl}}"],
- "path": ["refunds", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/.meta.json
deleted file mode 100644
index 69b505c6d86..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "childrenOrder": ["Payments - Create", "Payments - Retrieve"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/.event.meta.json
deleted file mode 100644
index 220b1a6723d..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js", "event.prerequest.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
index 220b1a6723d..4ac527d834a 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
@@ -1,3 +1,6 @@
{
- "eventOrder": ["event.test.js", "event.prerequest.js"]
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
index dc69bd52a50..f92fba3d044 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.test.js
@@ -63,26 +63,6 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "6540" for "amount"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
- function () {
- pm.expect(jsonData.amount).to.eql(6540);
- },
- );
-}
-
-// Response body should have value "6540" for "amount_capturable"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
- function () {
- pm.expect(jsonData.amount_capturable).to.eql(0);
- },
- );
-}
-
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
@@ -92,12 +72,3 @@ if (jsonData?.status) {
},
);
}
-
-// Response body should have "connector_transaction_id"
-pm.test(
- "[POST]::/payments - Content check if 'connector_transaction_id' exists",
- function () {
- pm.expect(typeof jsonData.connector_transaction_id !== "undefined").to.be
- .true;
- },
-);
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
index ec45ef29bb6..540a2fa1946 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
@@ -38,13 +38,41 @@
}
},
"raw_json_formatted": {
- "client_secret": "{{client_secret}}"
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
}
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
index 0731450e6b2..4ac527d834a 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
@@ -1,3 +1,6 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/event.prerequest.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
index 55dc35b9128..0444324000a 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
@@ -60,12 +60,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "requires_confirmation" for "status"
+// Response body should have value "requires_payment_method" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'",
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
function () {
- pm.expect(jsonData.status).to.eql("requires_confirmation");
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
},
);
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
index 4105bd1a869..b28abd0c309 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
@@ -32,16 +32,6 @@
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
- "payment_method": "card",
- "payment_method_data": {
- "card": {
- "card_number": "4242424242424242",
- "card_exp_month": "10",
- "card_exp_year": "25",
- "card_holder_name": "joseph Doe",
- "card_cvc": "123"
- }
- },
"billing": {
"address": {
"line1": "1467",
@@ -51,7 +41,7 @@
"state": "California",
"zip": "94122",
"country": "US",
- "first_name": "sundari"
+ "first_name": "PiX"
}
},
"shipping": {
@@ -63,7 +53,7 @@
"state": "California",
"zip": "94122",
"country": "US",
- "first_name": "sundari"
+ "first_name": "PiX"
}
},
"statement_descriptor_name": "joseph",
@@ -72,17 +62,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
- },
- "routing": {
- "type": "single",
- "data": "stripe"
}
}
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
index 53f98b7f7f4..aced67dbfb7 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/event.test.js
@@ -69,23 +69,3 @@ if (jsonData?.status) {
},
);
}
-
-// Response body should have value "6540" for "amount"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
- function () {
- pm.expect(jsonData.amount).to.eql(6540);
- },
- );
-}
-
-// Response body should have value "6540" for "amount_capturable"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
- function () {
- pm.expect(jsonData.amount_capturable).to.eql(0);
- },
- );
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/.meta.json
new file mode 100644
index 00000000000..60051ecca22
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/event.prerequest.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
similarity index 95%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
index 9612b490987..eda0801c9cc 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
@@ -23,7 +23,9 @@
"confirm": true,
"business_label": "default",
"capture_method": "automatic",
- "connector": ["stripe"],
+ "connector": [
+ "stripe"
+ ],
"customer_id": "klarna",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "three_ds",
@@ -83,8 +85,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/request.json
similarity index 86%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/request.json
similarity index 92%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/request.json
index 9189e4dd852..42d3653ad96 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/request.json
@@ -50,8 +50,14 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Confirm/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/request.json
similarity index 95%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/request.json
index 731eeaf1400..daffd2ab9ec 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/request.json
@@ -49,8 +49,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/request.json
similarity index 86%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario21-Wallet-Wechatpay/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/request.json
index 060c693c7e1..fed600e09cd 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant-copy/request.json
@@ -32,15 +32,6 @@
"disabled": true
}
],
- "body": {
- "mode": "raw",
- "raw": "",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
"url": {
"raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
"host": [
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/request.json
index 060c693c7e1..fed600e09cd 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/List Payment Methods for a Merchant/request.json
@@ -32,15 +32,6 @@
"disabled": true
}
],
- "body": {
- "mode": "raw",
- "raw": "",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
"url": {
"raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
"host": [
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/.event.meta.json
deleted file mode 100644
index 220b1a6723d..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js", "event.prerequest.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/request.json
deleted file mode 100644
index 6cd4b7d96c5..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/.meta.json
deleted file mode 100644
index 69b505c6d86..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "childrenOrder": ["Payments - Create", "Payments - Retrieve"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/request.json
deleted file mode 100644
index 6cd4b7d96c5..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/.meta.json
deleted file mode 100644
index 6626732a3ca..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/.meta.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "childrenOrder": [
- "Payments - Create",
- "Payments - Capture",
- "Payments - Retrieve",
- "Refunds - Create",
- "Refunds - Create-copy",
- "Refunds - Retrieve Copy",
- "Refunds - Validation should throw",
- "Payments - Retrieve Copy"
- ]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/event.test.js
deleted file mode 100644
index b0a888ae70d..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/refunds - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have value "6540" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '6540'",
- function () {
- pm.expect(jsonData.amount).to.eql(2000);
- },
- );
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/event.test.js
deleted file mode 100644
index ccc9bf47022..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/refunds - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have value "6540" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '4000'",
- function () {
- pm.expect(jsonData.amount).to.eql(4000);
- },
- );
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/request.json
deleted file mode 100644
index 933f1a66eda..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/request.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "payment_id": "{{payment_id}}",
- "amount": 4000,
- "reason": "Customer returned product",
- "refund_type": "instant",
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds"
- ]
- },
- "description": "To create a refund against an already processed payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/event.test.js
deleted file mode 100644
index 072e259d834..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/event.test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/refunds/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/refunds/: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 refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have value "2000" for "amount"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'amount' matches '2000'",
- function () {
- pm.expect(jsonData.amount).to.eql(2000);
- },
- );
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/event.test.js
deleted file mode 100644
index 71324af2c81..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/event.test.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/refunds - Status code is 4xx", function () {
- pm.response.to.be.error;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/refunds - 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 refund_id as variable for jsonData.payment_id
-if (jsonData?.refund_id) {
- pm.collectionVariables.set("refund_id", jsonData.refund_id);
- console.log(
- "- use {{refund_id}} as collection variable for value",
- jsonData.refund_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.error.message) {
- pm.test(
- "[POST]::/refunds - Content check if value for 'message' matches 'Refund amount exceeds the payment amount'",
- function () {
- pm.expect(jsonData.error.message).to.eql("Refund amount exceeds the payment amount");
- },
- );
-}
-
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/.meta.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
similarity index 58%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
index 96d98780785..f92fba3d044 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
@@ -1,11 +1,11 @@
// Validate status 2xx
-pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
pm.response.to.be.success;
});
// Validate if response header has matching content-type
pm.test(
- "[POST]::/payments/:id/capture - Content-Type is application/json",
+ "[POST]::/payments/:id/confirm - Content-Type is application/json",
function () {
pm.expect(pm.response.headers.get("Content-Type")).to.include(
"application/json",
@@ -14,7 +14,7 @@ pm.test(
);
// Validate if response has JSON Body
-pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () {
+pm.test("[POST]::/payments/:id/confirm - Response has JSON Body", function () {
pm.response.to.have.jsonBody();
});
@@ -63,43 +63,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "partially_captured" for "status"
+// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("succeeded");
},
);
}
-
-// Response body should have value "6540" for "amount"
-if (jsonData?.amount) {
- pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
- function () {
- pm.expect(jsonData.amount).to.eql(6540);
- },
- );
-}
-
-// Response body should have value "6000" for "amount_received"
-if (jsonData?.amount_received) {
- pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
- function () {
- pm.expect(jsonData.amount_received).to.eql(6000);
- },
- );
-}
-
-// Response body should have value "0" for "amount_received"
-if (jsonData?.amount_capturable) {
- pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_capturable' matches '0'",
- function () {
- pm.expect(jsonData.amount_capturable).to.eql(0);
- },
- );
-}
-
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/request.json
new file mode 100644
index 00000000000..604ac54144d
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": null,
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Confirm/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/request.json
similarity index 78%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/request.json
index 0619498e38c..b28abd0c309 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/request.json
@@ -20,8 +20,8 @@
"raw_json_formatted": {
"amount": 6540,
"currency": "USD",
- "confirm": true,
- "capture_method": "manual",
+ "confirm": false,
+ "capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
"customer_id": "StripeCustomer",
@@ -32,16 +32,6 @@
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
- "payment_method": "card",
- "payment_method_data": {
- "card": {
- "card_number": "4242424242424242",
- "card_exp_month": "10",
- "card_exp_year": "25",
- "card_holder_name": "joseph Doe",
- "card_cvc": "123"
- }
- },
"billing": {
"address": {
"line1": "1467",
@@ -51,7 +41,7 @@
"state": "California",
"zip": "94122",
"country": "US",
- "first_name": "sundari"
+ "first_name": "PiX"
}
},
"shipping": {
@@ -63,7 +53,7 @@
"state": "California",
"zip": "94122",
"country": "US",
- "first_name": "sundari"
+ "first_name": "PiX"
}
},
"statement_descriptor_name": "joseph",
@@ -72,17 +62,17 @@
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
- },
- "routing": {
- "type": "single",
- "data": "stripe"
}
}
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/.event.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
similarity index 89%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
index 89b1355575a..aced67dbfb7 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
@@ -60,12 +60,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "partially_captured" for "status"
+// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("succeeded");
},
);
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
similarity index 86%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name null/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/.meta.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..e8d6b2216c5
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js
@@ -0,0 +1,82 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/request.json
new file mode 100644
index 00000000000..371ef616fe4
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "",
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Confirm/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..4ac527d834a
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json
@@ -0,0 +1,6 @@
+{
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/request.json
new file mode 100644
index 00000000000..b28abd0c309
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/request.json
@@ -0,0 +1,78 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Confirm/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
similarity index 77%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
index 3342e5b2530..44960e9a6a3 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
@@ -60,26 +60,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "partially_captured" for "status"
+// Response body should have value "requires_payment_method" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
+ "[POST]::/payments:id - Content check if value for 'status' matches 'requires_payment_method'",
function () {
- pm.expect(jsonData.status).to.eql("partially_captured");
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
},
);
}
-
-// Check if the "refunds" array exists
-pm.test("Check if 'refunds' array exists", function() {
- pm.expect(jsonData.refunds).to.be.an("array");
-});
-
-// Check if there are exactly 2 items in the "refunds" array
-pm.test("Check if there are 2 refunds", function() {
- pm.expect(jsonData.refunds.length).to.equal(2);
-});
-
-
-
-
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
similarity index 86%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Retrieve-copy/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/request.json
deleted file mode 100644
index 9fe257ed85e..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/request.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "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_to_capture": 6000,
- "statement_descriptor_name": "Joseph",
- "statement_descriptor_suffix": "JS"
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments/:id/capture",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "capture"],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To capture the funds for an uncaptured payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/request.json
deleted file mode 100644
index 6cd4b7d96c5..00000000000
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Capture/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4a-Create payment with manual_multiple capture/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/.meta.json
new file mode 100644
index 00000000000..60051ecca22
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/.meta.json
@@ -0,0 +1,6 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
similarity index 97%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
index 6542d21542d..731b249f2aa 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
@@ -87,8 +87,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Capture/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/.meta.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json
similarity index 96%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json
index 2363c62ff27..b5f464abc14 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json
@@ -81,8 +81,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve Copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Payments - Retrieve/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve-copy/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create-copy/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/request.json
similarity index 97%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/request.json
index ff371b247db..b56057fad5d 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/request.json
@@ -19,7 +19,7 @@
},
"raw_json_formatted": {
"payment_id": "{{payment_id}}",
- "amount": 2000,
+ "amount": 1000,
"reason": "Customer returned product",
"refund_type": "instant",
"metadata": {
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create-copy/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/request.json
similarity index 97%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/request.json
index ff371b247db..d18aaf8befd 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Create-copy/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/request.json
@@ -19,7 +19,7 @@
},
"raw_json_formatted": {
"payment_id": "{{payment_id}}",
- "amount": 2000,
+ "amount": 540,
"reason": "Customer returned product",
"refund_type": "instant",
"metadata": {
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Create/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve-copy/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Retrieve Copy/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/request.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create partially captured payment with refund/Refunds - Validation should throw/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve-copy/response.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/event.test.js
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/request.json
similarity index 84%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/request.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/request.json
index c4271891fbf..6c28619e856 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Retrieve/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/refunds/:id",
- "host": ["{{baseUrl}}"],
- "path": ["refunds", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/response.json
rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Refunds - Retrieve/response.json
diff --git a/postman/collection-dir/stripe/MerchantAccounts/Merchant Account - List/request.json b/postman/collection-dir/stripe/MerchantAccounts/Merchant Account - List/request.json
index 841485a0a04..ed2324e0308 100644
--- a/postman/collection-dir/stripe/MerchantAccounts/Merchant Account - List/request.json
+++ b/postman/collection-dir/stripe/MerchantAccounts/Merchant Account - List/request.json
@@ -27,14 +27,18 @@
}
],
"url": {
- "raw": "{{baseUrl}}/accounts/list",
- "host": ["{{baseUrl}}"],
- "path": ["accounts", "list"],
+ "raw": "{{baseUrl}}/accounts/list?organization_id={{organization_id}}",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "accounts",
+ "list"
+ ],
"query": [
{
"key": "organization_id",
- "value": "{{organization_id}}",
- "disabled": false
+ "value": "{{organization_id}}"
}
],
"variable": [
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json
index 6014e253b0a..949d82095ec 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json
@@ -2,11 +2,13 @@
"childrenOrder": [
"Scenario1-Create payment with confirm true",
"Scenario2-Create payment with confirm false",
- "Scenario3-Create payment without PMD",
- "Scenario4-Create 3DS payment",
- "Scenario5-Create 3DS payment with confrm false",
- "Scenario6-Refund full payment",
+ "Scenario3-Create payment with confirm false card holder name null",
+ "Scenario3-Create payment with confirm false card holder name empty",
+ "Scenario4-Create payment without PMD",
+ "Scenario5-Create 3DS payment",
+ "Scenario6-Create 3DS payment with confrm false",
+ "Scenario7-Refund full payment",
"Scenario8-Bank Redirect-Ideal",
- "Scenario11-Bank Redirect-giropay"
+ "Scenario9-Bank Redirect-giropay"
]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
index 0731450e6b2..4ac527d834a 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/.event.meta.json
@@ -1,3 +1,6 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
index d999cf2d649..540a2fa1946 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
@@ -38,6 +38,16 @@
}
},
"raw_json_formatted": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "Joseph Doe",
+ "card_cvc": "123"
+ }
+ },
"client_secret": "{{client_secret}}",
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
@@ -55,8 +65,14 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
index 0731450e6b2..4ac527d834a 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/.event.meta.json
@@ -1,3 +1,6 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
index 55dc35b9128..0444324000a 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/event.test.js
@@ -60,12 +60,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "requires_confirmation" for "status"
+// Response body should have value "requires_payment_method" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'",
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
function () {
- pm.expect(jsonData.status).to.eql("requires_confirmation");
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
},
);
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
index 119353069bd..b28abd0c309 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
@@ -32,16 +32,6 @@
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
- "payment_method": "card",
- "payment_method_data": {
- "card": {
- "card_number": "4242424242424242",
- "card_exp_month": "10",
- "card_exp_year": "25",
- "card_holder_name": "joseph Doe",
- "card_cvc": "123"
- }
- },
"billing": {
"address": {
"line1": "1467",
@@ -77,8 +67,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..e8d6b2216c5
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/event.test.js
@@ -0,0 +1,82 @@
+// Validate status 4xx
+pm.test("[POST]::/payments - Status code is 4xx", function () {
+ pm.response.to.be.error;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have "error"
+pm.test(
+ "[POST]::/payments/:id/confirm - Content check if 'error' exists",
+ function () {
+ pm.expect(typeof jsonData.error !== "undefined").to.be.true;
+ },
+);
+
+// Response body should have value "connector error" for "error type"
+if (jsonData?.error?.type) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'",
+ function () {
+ pm.expect(jsonData.error.type).to.eql("invalid_request");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/request.json
new file mode 100644
index 00000000000..371ef616fe4
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "",
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Confirm/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/event.test.js
similarity index 91%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/event.test.js
index d683186aa00..0444324000a 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/event.test.js
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/event.test.js
@@ -60,12 +60,12 @@ if (jsonData?.client_secret) {
);
}
-// Response body should have value "requires_capture" for "status"
+// Response body should have value "requires_payment_method" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
function () {
- pm.expect(jsonData.status).to.eql("requires_capture");
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
},
);
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/request.json
new file mode 100644
index 00000000000..b28abd0c309
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/request.json
@@ -0,0 +1,78 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Create/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..44960e9a6a3
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/event.test.js
@@ -0,0 +1,71 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2a-Create payment with confirm false card holder name empty/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..f92fba3d044
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/event.test.js
@@ -0,0 +1,74 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/confirm - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/confirm - 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/:id/confirm - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/request.json
new file mode 100644
index 00000000000..604ac54144d
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/request.json
@@ -0,0 +1,85 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_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": {
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": null,
+ "card_cvc": "123"
+ }
+ },
+ "client_secret": "{{client_secret}}",
+ "browser_info": {
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
+ "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
+ "language": "nl-NL",
+ "color_depth": 24,
+ "screen_height": 723,
+ "screen_width": 1536,
+ "time_zone": 0,
+ "java_enabled": true,
+ "java_script_enabled": true,
+ "ip_address": "125.0.0.1"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Confirm/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/event.test.js
new file mode 100644
index 00000000000..0444324000a
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/request.json
new file mode 100644
index 00000000000..b28abd0c309
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/request.json
@@ -0,0 +1,78 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Create/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..aced67dbfb7
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/event.test.js
@@ -0,0 +1,71 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - 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("[GET]::/payments/:id - 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..b9ebc1be4aa
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/request.json
@@ -0,0 +1,33 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2b-Create payment with confirm false card holder name null/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
index d30e00868a5..8ff62125d1a 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
@@ -65,8 +65,14 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
index e3b1e235042..b28abd0c309 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
@@ -67,8 +67,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/.meta.json
index 69b505c6d86..60051ecca22 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/.meta.json
@@ -1,3 +1,6 @@
{
- "childrenOrder": ["Payments - Create", "Payments - Retrieve"]
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Retrieve"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
index 7dd4aac02ce..80661beddf2 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
@@ -101,8 +101,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/request.json
index 61fcdaec2d2..6f4d51c5945 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json
index 0731450e6b2..4ac527d834a 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json
@@ -1,3 +1,6 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js",
+ "event.prerequest.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.prerequest.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json
index 9fef5309c3a..fb1c8124ca7 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json
@@ -46,7 +46,7 @@
"card_number": "5200000000000015",
"card_exp_month": "03",
"card_exp_year": "2030",
- "card_holder_name": "",
+ "card_holder_name": "John Doe",
"card_cvc": "737",
"card_issuer": "",
"card_network": "Visa"
@@ -68,8 +68,14 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json
index 3b4c8f74e7f..0eb2d9f30cf 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json
@@ -78,8 +78,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json
index 61fcdaec2d2..6f4d51c5945 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json
index 94473ddb1ec..c3dddef3a2d 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Create/request.json
@@ -100,8 +100,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json
index 6cd4b7d96c5..b9ebc1be4aa 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json
index 5f4c58816d5..5e306df7a55 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Create/request.json
@@ -31,8 +31,12 @@
},
"url": {
"raw": "{{baseUrl}}/refunds",
- "host": ["{{baseUrl}}"],
- "path": ["refunds"]
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
},
"description": "To create a refund against an already processed payment"
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json
index 0731450e6b2..688c85746ef 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/.event.meta.json
@@ -1,3 +1,5 @@
{
- "eventOrder": ["event.test.js"]
+ "eventOrder": [
+ "event.test.js"
+ ]
}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json
index c4271891fbf..6c28619e856 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario6-Refund full payment/Refunds - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/refunds/:id",
- "host": ["{{baseUrl}}"],
- "path": ["refunds", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/request.json
similarity index 93%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/request.json
index 10b88b51748..c4c248b3bdd 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/request.json
@@ -57,8 +57,14 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Confirm/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/event.test.js
new file mode 100644
index 00000000000..0444324000a
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/request.json
similarity index 97%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/request.json
index 0b0c56d2660..87d07a6016b 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/request.json
@@ -81,8 +81,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Create/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/request.json
similarity index 86%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/request.json
index 61fcdaec2d2..6f4d51c5945 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario7-Bank Redirect-Ideal/Payments - Retrieve/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Confirm/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/.meta.json
new file mode 100644
index 00000000000..57d3f8e2bc7
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/request.json
similarity index 93%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/request.json
index caf10ddd35d..3f8a95e59bb 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario11-Bank Redirect-giropay/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/request.json
@@ -57,8 +57,14 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id", "confirm"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Confirm/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/event.test.js
new file mode 100644
index 00000000000..0444324000a
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// 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.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_payment_method" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_payment_method");
+ },
+ );
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/request.json
similarity index 97%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/request.json
index 0b0c56d2660..87d07a6016b 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/request.json
@@ -81,8 +81,12 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": ["{{baseUrl}}"],
- "path": ["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/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/response.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/response.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Create/response.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..688c85746ef
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,5 @@
+{
+ "eventOrder": [
+ "event.test.js"
+ ]
+}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/request.json
similarity index 86%
rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/request.json
index 61fcdaec2d2..6f4d51c5945 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-Ideal/Payments - Retrieve/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/request.json
@@ -8,8 +8,13 @@
],
"url": {
"raw": "{{baseUrl}}/payments/:id",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
"query": [
{
"key": "force_sync",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario8-Bank Redirect-giropay/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/.meta.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/.meta.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/.meta.json
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/.event.meta.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/event.test.js
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/request.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/.event.meta.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/request.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve-copy/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/request.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/response.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/event.test.js
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/event.test.js
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/request.json
similarity index 100%
rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Refunds - Create/request.json
rename to postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/request.json
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario5-Refund for unsuccessful payment/Refunds - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json
deleted file mode 100644
index 6cd4b7d96c5..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": ["{{baseUrl}}"],
- "path": ["payments", ":id"],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
deleted file mode 100644
index 0731450e6b2..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/.event.meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "eventOrder": ["event.test.js"]
-}
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json
deleted file mode 100644
index 9fe125ce8ea..00000000000
--- a/postman/collection-dir/trustpay/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Refunds - Create/request.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "payment_id": "{{payment_id}}",
- "amount": 540,
- "reason": "Customer returned product",
- "refund_type": "instant",
- "metadata": {
- "udf1": "value1",
- "new_customer": "true",
- "login_date": "2019-09-10T10:11:12Z"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": ["{{baseUrl}}"],
- "path": ["refunds"]
- },
- "description": "To create a refund against an already processed payment"
-}
|
ci
|
update postman collection for stripe and trustpay (#3108)
|
b3c846d637dd32a2d6d7044c118abbb2616642f0
|
2023-11-02 12:47:25
|
AkshayaFoiger
|
feat(connector): [Multisafepay] add error handling (#2595)
| false
|
diff --git a/crates/router/src/connector/multisafepay.rs b/crates/router/src/connector/multisafepay.rs
index 1ea5029fd00..e09f242abc8 100644
--- a/crates/router/src/connector/multisafepay.rs
+++ b/crates/router/src/connector/multisafepay.rs
@@ -200,10 +200,11 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
data: &types::PaymentsSyncRouterData,
res: Response,
) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
- let response: multisafepay::MultisafepayPaymentsResponse = res
+ let response: multisafepay::MultisafepayAuthResponse = res
.response
.parse_struct("multisafepay PaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
@@ -301,10 +302,11 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
data: &types::PaymentsAuthorizeRouterData,
res: Response,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: multisafepay::MultisafepayPaymentsResponse = res
+ let response: multisafepay::MultisafepayAuthResponse = res
.response
.parse_struct("MultisafepayPaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
types::ResponseRouterData {
response,
data: data.clone(),
@@ -399,17 +401,17 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
data: &types::RefundsRouterData<api::Execute>,
res: Response,
) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
- let response: multisafepay::RefundResponse = res
+ let response: multisafepay::MultisafepayRefundResponse = res
.response
.parse_struct("multisafepay RefundResponse")
- .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
types::ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
}
.try_into()
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)
}
fn get_error_response(
@@ -472,7 +474,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
data: &types::RefundSyncRouterData,
res: Response,
) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
- let response: multisafepay::RefundResponse = res
+ let response: multisafepay::MultisafepayRefundResponse = res
.response
.parse_struct("multisafepay RefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -482,7 +484,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
http_code: res.status_code,
}
.try_into()
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)
}
fn get_error_response(
diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs
index 2fa53135be5..3eead97ad86 100644
--- a/crates/router/src/connector/multisafepay/transformers.rs
+++ b/crates/router/src/connector/multisafepay/transformers.rs
@@ -636,57 +636,76 @@ pub struct MultisafepayPaymentsResponse {
pub data: Data,
}
+#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
+#[serde(untagged)]
+pub enum MultisafepayAuthResponse {
+ ErrorResponse(MultisafepayErrorResponse),
+ PaymentResponse(MultisafepayPaymentsResponse),
+}
+
impl<F, T>
- TryFrom<
- types::ResponseRouterData<F, MultisafepayPaymentsResponse, T, types::PaymentsResponseData>,
- > for types::RouterData<F, T, types::PaymentsResponseData>
+ TryFrom<types::ResponseRouterData<F, MultisafepayAuthResponse, T, types::PaymentsResponseData>>
+ for types::RouterData<F, T, types::PaymentsResponseData>
{
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(
item: types::ResponseRouterData<
F,
- MultisafepayPaymentsResponse,
+ MultisafepayAuthResponse,
T,
types::PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let redirection_data = item
- .response
- .data
- .payment_url
- .clone()
- .map(|url| services::RedirectForm::from((url, services::Method::Get)));
-
- let default_status = if item.response.success {
- MultisafepayPaymentStatus::Initialized
- } else {
- MultisafepayPaymentStatus::Declined
- };
-
- let status = item.response.data.status.unwrap_or(default_status);
-
- Ok(Self {
- status: enums::AttemptStatus::from(status),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- item.response.data.order_id.clone(),
- ),
- redirection_data,
- mandate_reference: item
- .response
+ match item.response {
+ MultisafepayAuthResponse::PaymentResponse(payment_response) => {
+ let redirection_data = payment_response
.data
- .payment_details
- .and_then(|payment_details| payment_details.recurring_id)
- .map(|id| types::MandateReference {
- connector_mandate_id: Some(id),
- payment_method_id: None,
+ .payment_url
+ .clone()
+ .map(|url| services::RedirectForm::from((url, services::Method::Get)));
+
+ let default_status = if payment_response.success {
+ MultisafepayPaymentStatus::Initialized
+ } else {
+ MultisafepayPaymentStatus::Declined
+ };
+
+ let status = payment_response.data.status.unwrap_or(default_status);
+
+ Ok(Self {
+ status: enums::AttemptStatus::from(status),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ payment_response.data.order_id.clone(),
+ ),
+ redirection_data,
+ mandate_reference: payment_response
+ .data
+ .payment_details
+ .and_then(|payment_details| payment_details.recurring_id)
+ .map(|id| types::MandateReference {
+ connector_mandate_id: Some(id),
+ payment_method_id: None,
+ }),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(
+ payment_response.data.order_id.clone(),
+ ),
}),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: Some(item.response.data.order_id.clone()),
+ ..item.data
+ })
+ }
+ MultisafepayAuthResponse::ErrorResponse(error_response) => Ok(Self {
+ response: Err(types::ErrorResponse {
+ code: error_response.error_code.to_string(),
+ message: error_response.error_info.clone(),
+ reason: Some(error_response.error_info),
+ status_code: item.http_code,
+ }),
+ ..item.data
}),
- ..item.data
- })
+ }
}
}
@@ -747,61 +766,93 @@ pub struct RefundData {
pub error_code: Option<i32>,
pub error_info: Option<String>,
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
pub success: bool,
pub data: RefundData,
}
-impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum MultisafepayRefundResponse {
+ ErrorResponse(MultisafepayErrorResponse),
+ RefundResponse(RefundResponse),
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::Execute, MultisafepayRefundResponse>>
for types::RefundsRouterData<api::Execute>
{
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
+ item: types::RefundsResponseRouterData<api::Execute, MultisafepayRefundResponse>,
) -> Result<Self, Self::Error> {
- let refund_stat = if item.response.success {
- RefundStatus::Succeeded
- } else {
- RefundStatus::Failed
- };
-
- Ok(Self {
- response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.data.refund_id.to_string(),
- refund_status: enums::RefundStatus::from(refund_stat),
+ match item.response {
+ MultisafepayRefundResponse::RefundResponse(refund_data) => {
+ let refund_status = if refund_data.success {
+ RefundStatus::Succeeded
+ } else {
+ RefundStatus::Failed
+ };
+
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: refund_data.data.refund_id.to_string(),
+ refund_status: enums::RefundStatus::from(refund_status),
+ }),
+ ..item.data
+ })
+ }
+ MultisafepayRefundResponse::ErrorResponse(error_response) => Ok(Self {
+ response: Err(types::ErrorResponse {
+ code: error_response.error_code.to_string(),
+ message: error_response.error_info.clone(),
+ reason: Some(error_response.error_info),
+ status_code: item.http_code,
+ }),
+ ..item.data
}),
- ..item.data
- })
+ }
}
}
-impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
+impl TryFrom<types::RefundsResponseRouterData<api::RSync, MultisafepayRefundResponse>>
for types::RefundsRouterData<api::RSync>
{
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::RSync, RefundResponse>,
+ item: types::RefundsResponseRouterData<api::RSync, MultisafepayRefundResponse>,
) -> Result<Self, Self::Error> {
- let refund_status = if item.response.success {
- RefundStatus::Succeeded
- } else {
- RefundStatus::Failed
- };
-
- Ok(Self {
- response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.data.refund_id.to_string(),
- refund_status: enums::RefundStatus::from(refund_status),
+ match item.response {
+ MultisafepayRefundResponse::RefundResponse(refund_data) => {
+ let refund_status = if refund_data.success {
+ RefundStatus::Succeeded
+ } else {
+ RefundStatus::Failed
+ };
+
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: refund_data.data.refund_id.to_string(),
+ refund_status: enums::RefundStatus::from(refund_status),
+ }),
+ ..item.data
+ })
+ }
+ MultisafepayRefundResponse::ErrorResponse(error_response) => Ok(Self {
+ response: Err(types::ErrorResponse {
+ code: error_response.error_code.to_string(),
+ message: error_response.error_info.clone(),
+ reason: Some(error_response.error_info),
+ status_code: item.http_code,
+ }),
+ ..item.data
}),
- ..item.data
- })
+ }
}
}
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone)]
pub struct MultisafepayErrorResponse {
- pub success: bool,
pub error_code: i32,
pub error_info: String,
}
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json
index 289e780a72c..a4e816ad17d 100644
--- a/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json
+++ b/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -55,6 +55,10 @@
"last_name": "happy"
}
},
+ "routing": {
+ "type": "single",
+ "data": "multisafepay"
+ },
"shipping": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/.event.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/.event.meta.json
new file mode 100644
index 00000000000..0731450e6b2
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/event.test.js b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/event.test.js
new file mode 100644
index 00000000000..d7259b6a840
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/event.test.js
@@ -0,0 +1,39 @@
+// Validate status 2xx
+pm.test(
+ "[POST]::/account/:account_id/connectors/:connector_id - 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/:connector_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 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/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/request.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/request.json
new file mode 100644
index 00000000000..5328f86fbc9
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/request.json
@@ -0,0 +1,122 @@
+{
+ "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_account_details": {
+ "auth_type": "HeaderKey",
+ "api_key": "wrongAPIKey"
+ },
+ "test_mode": false,
+ "disabled": false,
+ "payment_methods_enabled": [
+ {
+ "payment_method": "card",
+ "payment_method_types": [
+ {
+ "payment_method_type": "credit",
+ "card_networks": ["Visa", "Mastercard"],
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ },
+ {
+ "payment_method_type": "debit",
+ "card_networks": ["Visa", "Mastercard"],
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]
+ },
+ {
+ "payment_method": "pay_later",
+ "payment_method_types": [
+ {
+ "payment_method_type": "klarna",
+ "payment_experience": "redirect_to_url",
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ },
+ {
+ "payment_method_type": "affirm",
+ "payment_experience": "redirect_to_url",
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ },
+ {
+ "payment_method_type": "afterpay_clearpay",
+ "payment_experience": "redirect_to_url",
+ "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/:connector_id",
+ "host": ["{{baseUrl}}"],
+ "path": ["account", ":account_id", "connectors", ":connector_id"],
+ "variable": [
+ {
+ "key": "account_id",
+ "value": "{{merchant_id}}"
+ },
+ {
+ "key": "connector_id",
+ "value": "{{merchant_connector_id}}"
+ }
+ ]
+ },
+ "description": "To update an existing Payment Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc"
+}
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/response.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payment Connector - Update/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/.event.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..0731450e6b2
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/event.test.js b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/event.test.js
new file mode 100644
index 00000000000..e75cb69a924
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/event.test.js
@@ -0,0 +1,56 @@
+// 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) {}
+
+// Validate error message in the JSON Body
+pm.test("[POST]::/payments - Validate error message", function () {
+ pm.expect(jsonData.error_message).to.not.be.null
+});
+
+// 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.",
+ );
+}
+
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json
new file mode 100644
index 00000000000..525eaa739e8
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json
@@ -0,0 +1,90 @@
+{
+ "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,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "automatic",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+1",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "routing": {
+ "type": "single",
+ "data": "multisafepay"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "someone",
+ "last_name": "happy"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "someone",
+ "last_name": "happy"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ }
+ }
+ },
+ "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/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/response.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
|
feat
|
[Multisafepay] add error handling (#2595)
|
892b04f805c219e2cf7cbe5736aef19909e986f7
|
2024-02-02 13:16:29
|
oscar2d2
|
refactor(connector): [Noon] change error message from not supported to not implemented (#2849)
| false
|
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index ee06cd064be..8bb3a96a3ca 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -275,10 +275,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
| api_models::payments::WalletData::WeChatPayQr(_)
| api_models::payments::WalletData::CashappQr(_)
| api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotSupported {
- message: conn_utils::SELECTED_PAYMENT_METHOD.to_string(),
- connector: "Noon",
- })
+ Err(errors::ConnectorError::NotImplemented(
+ conn_utils::get_unimplemented_payment_method_error_message("Noon"),
+ ))
}
},
api::PaymentMethodData::CardRedirect(_)
@@ -293,10 +292,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
| api::PaymentMethodData::Voucher(_)
| api::PaymentMethodData::GiftCard(_)
| api::PaymentMethodData::CardToken(_) => {
- Err(errors::ConnectorError::NotSupported {
- message: conn_utils::SELECTED_PAYMENT_METHOD.to_string(),
- connector: "Noon",
- })
+ Err(errors::ConnectorError::NotImplemented(
+ conn_utils::get_unimplemented_payment_method_error_message("Noon"),
+ ))
}
}?,
Some(item.request.currency),
|
refactor
|
[Noon] change error message from not supported to not implemented (#2849)
|
cf64862daca0ad05b7af27646430d12bac71a5ee
|
2023-06-15 13:20:48
|
Abhishek Marrivagu
|
refactor(payments): attempt to address unintended 5xx and 4xx in payments (#1376)
| false
|
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 508c4045ab0..cc51d9316dc 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -5,7 +5,6 @@ use common_utils::{
use error_stack::ResultExt;
use masking::ExposeInterface;
use router_env::{instrument, tracing};
-use storage_models::errors as storage_errors;
use crate::{
consts,
@@ -225,13 +224,15 @@ pub async fn delete_customer(
.to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?;
}
}
- Err(error) => match error.current_context() {
- errors::StorageError::DatabaseError(err) => match err.current_context() {
- storage_errors::DatabaseError::NotFound => Ok(()),
- _ => Err(errors::ApiErrorResponse::InternalServerError),
- },
- _ => Err(errors::ApiErrorResponse::InternalServerError),
- }?,
+ Err(error) => {
+ if error.current_context().is_db_not_found() {
+ Ok(())
+ } else {
+ Err(error)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("failed find_payment_method_by_customer_id_merchant_id_list")
+ }?
+ }
};
let key = types::get_merchant_enc_key(&**db, merchant_account.merchant_id.clone())
@@ -266,13 +267,15 @@ pub async fn delete_customer(
.await
{
Ok(_) => Ok(()),
- Err(error) => match error.current_context() {
- errors::StorageError::DatabaseError(err) => match err.current_context() {
- storage_errors::DatabaseError::NotFound => Ok(()),
- _ => Err(errors::ApiErrorResponse::InternalServerError),
- },
- _ => Err(errors::ApiErrorResponse::InternalServerError),
- },
+ Err(error) => {
+ if error.current_context().is_db_not_found() {
+ Ok(())
+ } else {
+ Err(error)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("failed update_address_by_merchant_id_customer_id")
+ }
+ }
}?;
let updated_customer = storage::CustomerUpdate::Update {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index f8643e23216..89f7333f43e 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -26,6 +26,7 @@ use self::{
helpers::authenticate_client_secret,
operations::{payment_complete_authorize, BoxedOperation, Operation},
};
+use super::errors::StorageErrorExt;
use crate::{
configs::settings::PaymentMethodTypeTokenFilter,
core::{
@@ -104,7 +105,7 @@ where
validate_result.merchant_id,
)
.await
- .change_context(errors::ApiErrorResponse::InternalServerError)
+ .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
.attach_printable("Failed while fetching/creating customer")?;
let connector = get_connector_choice(
@@ -1090,7 +1091,7 @@ pub async fn list_payments(
) -> RouterResponse<api::PaymentListResponse> {
use futures::stream::StreamExt;
- use crate::{core::errors::utils::StorageErrorExt, types::transformers::ForeignFrom};
+ use crate::types::transformers::ForeignFrom;
helpers::validate_payment_list_request(&constraints)?;
let merchant_id = &merchant.merchant_id;
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 80944c19704..11249c5b63e 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -935,7 +935,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
None => None,
Some(customer_id) => db
.find_customer_optional_by_customer_id_merchant_id(customer_id, merchant_id)
- .await?
+ .await? // if customer_id is present in payment_intent but not found in customer table then shouldn't an error be thrown ?
.map(Ok),
},
};
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index ff7f0220b20..88680aece5f 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -12,7 +12,7 @@ use crate::{
configs::settings,
core::{
api_keys,
- errors::{self, RouterResult},
+ errors::{self, utils::StorageErrorExt, RouterResult},
},
db::StorageInterface,
routes::app::AppStateInfo,
@@ -122,13 +122,7 @@ where
.store()
.find_merchant_account_by_merchant_id(&stored_api_key.merchant_id)
.await
- .map_err(|e| {
- if e.current_context().is_db_not_found() {
- e.change_context(errors::ApiErrorResponse::Unauthorized)
- } else {
- e.change_context(errors::ApiErrorResponse::InternalServerError)
- }
- })
+ .to_not_found_response(errors::ApiErrorResponse::Unauthorized)
}
}
|
refactor
|
attempt to address unintended 5xx and 4xx in payments (#1376)
|
986de77b4868e48d00161c9d30071d809360e9a6
|
2024-12-16 16:17:59
|
Riddhiagrawal001
|
fix(user_roles): migrations for backfilling user_roles entity_id (#6837)
| false
|
diff --git a/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql b/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql
index c7c9cbeb401..dff040ebc9e 100644
--- a/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql
+++ b/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql
@@ -1,2 +1,2 @@
-- This file should undo anything in `up.sql`
-SELECT 1;
\ No newline at end of file
+UPDATE user_roles SET entity_type = NULL WHERE version = 'v1';
\ No newline at end of file
diff --git a/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql b/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql
index f2759f030d5..b982a8b1373 100644
--- a/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql
+++ b/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql
@@ -1,4 +1,5 @@
-- Your SQL goes here
+-- Incomplete migration, also run migrations/2024-12-13-080558_entity-id-backfill-for-user-roles
UPDATE user_roles
SET
entity_type = CASE
diff --git a/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sql b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sql
new file mode 100644
index 00000000000..fb372f88a12
--- /dev/null
+++ b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+UPDATE user_roles SET entity_id = NULL WHERE version = 'v1';
\ No newline at end of file
diff --git a/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sql b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sql
new file mode 100644
index 00000000000..7de41d880db
--- /dev/null
+++ b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sql
@@ -0,0 +1,10 @@
+-- Your SQL goes here
+UPDATE user_roles
+SET
+ entity_id = CASE
+ WHEN role_id = 'org_admin' THEN org_id
+ ELSE merchant_id
+ END
+WHERE
+ version = 'v1'
+ AND entity_id IS NULL;
\ No newline at end of file
|
fix
|
migrations for backfilling user_roles entity_id (#6837)
|
d443a4cf1ee7bb9f5daa5147bd2854b3e4f4c76d
|
2025-02-05 19:10:48
|
Kashif
|
fix(connector): [worldpay] remove threeDS data from Authorize request for NTI flows (#7097)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
index 52ae2c4f16f..6e19c20edab 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
@@ -32,7 +32,7 @@ pub struct Instruction {
pub value: PaymentValue,
#[serde(skip_serializing_if = "Option::is_none")]
pub debt_repayment: Option<bool>,
- #[serde(rename = "threeDS")]
+ #[serde(rename = "threeDS", skip_serializing_if = "Option::is_none")]
pub three_ds: Option<ThreeDSRequest>,
/// For setting up mandates
pub token_creation: Option<TokenCreation>,
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index 6ae507790dd..e4656021a59 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -390,8 +390,14 @@ fn create_three_ds_request<T: WorldpayPaymentsRequestData>(
router_data: &T,
is_mandate_payment: bool,
) -> Result<Option<ThreeDSRequest>, error_stack::Report<errors::ConnectorError>> {
- match router_data.get_auth_type() {
- enums::AuthenticationType::ThreeDs => {
+ match (
+ router_data.get_auth_type(),
+ router_data.get_payment_method_data(),
+ ) {
+ // 3DS for NTI flow
+ (_, PaymentMethodData::CardDetailsForNetworkTransactionId(_)) => Ok(None),
+ // 3DS for regular payments
+ (enums::AuthenticationType::ThreeDs, _) => {
let browser_info = router_data.get_browser_info().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "browser_info",
@@ -439,6 +445,7 @@ fn create_three_ds_request<T: WorldpayPaymentsRequestData>(
},
}))
}
+ // Non 3DS
_ => Ok(None),
}
}
|
fix
|
[worldpay] remove threeDS data from Authorize request for NTI flows (#7097)
|
5b29c25210ed118dcd97dafd608170c41b1fba58
|
2023-09-11 12:55:22
|
Narayan Bhat
|
refactor(core): use profile id to find connector (#2020)
| false
|
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 5f00321ad8f..e0be641fe9a 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -488,7 +488,7 @@ impl From<StraightThroughAlgorithm> for StraightThroughAlgorithmSerde {
}
}
-#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
+#[derive(Clone, Debug, Deserialize, ToSchema, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct PrimaryBusinessDetails {
#[schema(value_type = CountryAlpha2)]
@@ -615,10 +615,10 @@ pub struct MerchantConnectorCreate {
#[schema(example = json!(common_utils::consts::FRM_CONFIGS_EG))]
pub frm_configs: Option<Vec<FrmConfigs>>,
- #[schema(value_type = CountryAlpha2, example = "US")]
- pub business_country: api_enums::CountryAlpha2,
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub business_country: Option<api_enums::CountryAlpha2>,
- pub business_label: String,
+ pub business_label: Option<String>,
/// Business Sub label of the merchant
#[schema(example = "chase")]
@@ -658,7 +658,7 @@ pub struct MerchantConnectorResponse {
// /// Connector label for specific country and Business
#[serde(skip_deserializing)]
#[schema(example = "stripe_US_travel")]
- pub connector_label: String,
+ pub connector_label: Option<String>,
/// Unique ID of the connector
#[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
@@ -708,12 +708,12 @@ pub struct MerchantConnectorResponse {
pub metadata: Option<pii::SecretSerdeValue>,
/// Business Country of the connector
- #[schema(value_type = CountryAlpha2, example = "US")]
- pub business_country: api_enums::CountryAlpha2,
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub business_country: Option<api_enums::CountryAlpha2>,
///Business Type of the merchant
#[schema(example = "travel")]
- pub business_label: String,
+ pub business_label: Option<String>,
/// Business Sub label of the merchant
#[schema(example = "chase")]
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 559682a43de..6b1c71f803c 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1866,11 +1866,11 @@ pub struct PaymentsResponse {
pub connector_label: Option<String>,
/// The business country of merchant for this payment
- #[schema(value_type = CountryAlpha2, example = "US")]
- pub business_country: api_enums::CountryAlpha2,
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub business_country: Option<api_enums::CountryAlpha2>,
/// The business label of merchant for this payment
- pub business_label: String,
+ pub business_label: Option<String>,
/// The business_sub_label for this payment
pub business_sub_label: Option<String>,
diff --git a/crates/data_models/src/payments/payment_intent.rs b/crates/data_models/src/payments/payment_intent.rs
index a34cb8bd0f8..26c244782a5 100644
--- a/crates/data_models/src/payments/payment_intent.rs
+++ b/crates/data_models/src/payments/payment_intent.rs
@@ -93,8 +93,8 @@ pub struct PaymentIntent {
pub off_session: Option<bool>,
pub client_secret: Option<String>,
pub active_attempt_id: String,
- pub business_country: storage_enums::CountryAlpha2,
- pub business_label: String,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<String>,
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub allowed_payment_method_types: Option<serde_json::Value>,
pub connector_metadata: Option<serde_json::Value>,
@@ -134,8 +134,8 @@ pub struct PaymentIntentNew {
pub off_session: Option<bool>,
pub client_secret: Option<String>,
pub active_attempt_id: String,
- pub business_country: storage_enums::CountryAlpha2,
- pub business_label: String,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<String>,
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub allowed_payment_method_types: Option<serde_json::Value>,
pub connector_metadata: Option<serde_json::Value>,
diff --git a/crates/diesel_models/src/file.rs b/crates/diesel_models/src/file.rs
index baa37507e99..d6efcbbc6a9 100644
--- a/crates/diesel_models/src/file.rs
+++ b/crates/diesel_models/src/file.rs
@@ -17,6 +17,7 @@ pub struct FileMetadataNew {
pub file_upload_provider: Option<common_enums::FileUploadProvider>,
pub available: bool,
pub connector_label: Option<String>,
+ pub profile_id: Option<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable)]
@@ -34,6 +35,7 @@ pub struct FileMetadata {
#[serde(with = "custom_serde::iso8601")]
pub created_at: time::PrimitiveDateTime,
pub connector_label: Option<String>,
+ pub profile_id: Option<String>,
}
#[derive(Debug)]
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index 29d47090504..5ccfea2bb03 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -28,9 +28,9 @@ pub struct MerchantConnectorAccount {
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
pub connector_type: storage_enums::ConnectorType,
pub metadata: Option<pii::SecretSerdeValue>,
- pub connector_label: String,
- pub business_country: storage_enums::CountryAlpha2,
- pub business_label: String,
+ pub connector_label: Option<String>,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<String>,
pub business_sub_label: Option<String>,
pub frm_configs: Option<Secret<serde_json::Value>>,
pub created_at: time::PrimitiveDateTime,
@@ -53,9 +53,9 @@ pub struct MerchantConnectorAccountNew {
pub merchant_connector_id: String,
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
pub metadata: Option<pii::SecretSerdeValue>,
- pub connector_label: String,
- pub business_country: storage_enums::CountryAlpha2,
- pub business_label: String,
+ pub connector_label: Option<String>,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<String>,
pub business_sub_label: Option<String>,
pub frm_configs: Option<Secret<serde_json::Value>>,
pub created_at: time::PrimitiveDateTime,
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 6468a8b1dfd..1212c9d5242 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -34,8 +34,8 @@ pub struct PaymentIntent {
pub off_session: Option<bool>,
pub client_secret: Option<String>,
pub active_attempt_id: String,
- pub business_country: storage_enums::CountryAlpha2,
- pub business_label: String,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<String>,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub allowed_payment_method_types: Option<serde_json::Value>,
@@ -87,8 +87,8 @@ pub struct PaymentIntentNew {
pub off_session: Option<bool>,
pub client_secret: Option<String>,
pub active_attempt_id: String,
- pub business_country: storage_enums::CountryAlpha2,
- pub business_label: String,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<String>,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub allowed_payment_method_types: Option<serde_json::Value>,
@@ -186,6 +186,7 @@ pub struct PaymentIntentUpdateInternal {
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub attempt_count: Option<i16>,
+ pub profile_id: Option<String>,
merchant_decision: Option<String>,
payment_confirm_source: Option<storage_enums::PaymentSource>,
}
diff --git a/crates/diesel_models/src/query/business_profile.rs b/crates/diesel_models/src/query/business_profile.rs
index 0c9737ef61b..fcdd97ca9db 100644
--- a/crates/diesel_models/src/query/business_profile.rs
+++ b/crates/diesel_models/src/query/business_profile.rs
@@ -47,6 +47,21 @@ impl BusinessProfile {
.await
}
+ #[instrument(skip(conn))]
+ pub async fn find_by_profile_name_merchant_id(
+ conn: &PgPooledConn,
+ profile_name: &str,
+ merchant_id: &str,
+ ) -> StorageResult<Self> {
+ generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
+ conn,
+ dsl::profile_name
+ .eq(profile_name.to_owned())
+ .and(dsl::merchant_id.eq(merchant_id.to_owned())),
+ )
+ .await
+ }
+
pub async fn list_business_profile_by_merchant_id(
conn: &PgPooledConn,
merchant_id: &str,
diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rs
index 4f11e3c13e2..17e34b2a866 100644
--- a/crates/diesel_models/src/query/merchant_connector_account.rs
+++ b/crates/diesel_models/src/query/merchant_connector_account.rs
@@ -70,6 +70,21 @@ impl MerchantConnectorAccount {
.await
}
+ #[instrument(skip(conn))]
+ pub async fn find_by_profile_id_connector_name(
+ conn: &PgPooledConn,
+ profile_id: &str,
+ connector_name: &str,
+ ) -> StorageResult<Self> {
+ generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
+ conn,
+ dsl::profile_id
+ .eq(profile_id.to_owned())
+ .and(dsl::connector_name.eq(connector_name.to_owned())),
+ )
+ .await
+ }
+
#[instrument(skip(conn))]
pub async fn find_by_merchant_id_connector_name(
conn: &PgPooledConn,
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index fe22efd7448..31aa03ff4a8 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -282,6 +282,8 @@ diesel::table! {
created_at -> Timestamp,
#[max_length = 255]
connector_label -> Nullable<Varchar>,
+ #[max_length = 64]
+ profile_id -> Nullable<Varchar>,
}
}
@@ -455,10 +457,10 @@ diesel::table! {
connector_type -> ConnectorType,
metadata -> Nullable<Jsonb>,
#[max_length = 255]
- connector_label -> Varchar,
- business_country -> CountryAlpha2,
+ connector_label -> Nullable<Varchar>,
+ business_country -> Nullable<CountryAlpha2>,
#[max_length = 255]
- business_label -> Varchar,
+ business_label -> Nullable<Varchar>,
#[max_length = 64]
business_sub_label -> Nullable<Varchar>,
frm_configs -> Nullable<Jsonb>,
@@ -585,9 +587,9 @@ diesel::table! {
client_secret -> Nullable<Varchar>,
#[max_length = 64]
active_attempt_id -> Varchar,
- business_country -> CountryAlpha2,
+ business_country -> Nullable<CountryAlpha2>,
#[max_length = 64]
- business_label -> Varchar,
+ business_label -> Nullable<Varchar>,
order_details -> Nullable<Array<Nullable<Jsonb>>>,
allowed_payment_method_types -> Nullable<Json>,
connector_metadata -> Nullable<Json>,
diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs
index 8c3c62b01fa..926482bf5ab 100644
--- a/crates/router/src/compatibility/stripe/errors.rs
+++ b/crates/router/src/compatibility/stripe/errors.rs
@@ -124,8 +124,11 @@ pub enum StripeErrorCode {
#[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "duplicate merchant account")]
DuplicateMerchantAccount,
- #[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "The merchant connector account with the specified connector_label '{connector_label}' already exists in our records")]
- DuplicateMerchantConnectorAccount { connector_label: String },
+ #[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "The merchant connector account with the specified profile_id '{profile_id}' and connector_name '{connector_name}' already exists in our records")]
+ DuplicateMerchantConnectorAccount {
+ profile_id: String,
+ connector_name: String,
+ },
#[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "duplicate payment method")]
DuplicatePaymentMethod,
@@ -391,7 +394,7 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
errors::ApiErrorResponse::Unauthorized
| errors::ApiErrorResponse::InvalidJwtToken
| errors::ApiErrorResponse::GenericUnauthorized { .. }
- | errors::ApiErrorResponse::AccessForbidden
+ | errors::ApiErrorResponse::AccessForbidden { .. }
| errors::ApiErrorResponse::InvalidEphemeralKey => Self::Unauthorized,
errors::ApiErrorResponse::InvalidRequestUrl
| errors::ApiErrorResponse::InvalidHttpMethod
@@ -495,9 +498,13 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
}
errors::ApiErrorResponse::ReturnUrlUnavailable => Self::ReturnUrlUnavailable,
errors::ApiErrorResponse::DuplicateMerchantAccount => Self::DuplicateMerchantAccount,
- errors::ApiErrorResponse::DuplicateMerchantConnectorAccount { connector_label } => {
- Self::DuplicateMerchantConnectorAccount { connector_label }
- }
+ errors::ApiErrorResponse::DuplicateMerchantConnectorAccount {
+ profile_id,
+ connector_name,
+ } => Self::DuplicateMerchantConnectorAccount {
+ profile_id,
+ connector_name,
+ },
errors::ApiErrorResponse::DuplicatePaymentMethod => Self::DuplicatePaymentMethod,
errors::ApiErrorResponse::ClientSecretInvalid => Self::PaymentIntentInvalidParameter {
param: "client_secret".to_owned(),
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 2de2c0725e0..e1464006851 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -2,7 +2,7 @@ use api_models::{admin as admin_types, enums as api_enums};
use common_utils::{
crypto::{generate_cryptographically_secure_random_string, OptionalSecretValue},
date_time,
- ext_traits::{ConfigExt, Encode, ValueExt},
+ ext_traits::{AsyncExt, ConfigExt, Encode, ValueExt},
};
use data_models::MerchantStorageScheme;
use error_stack::{report, FutureExt, ResultExt};
@@ -54,7 +54,7 @@ pub async fn create_merchant_account(
let primary_business_details =
utils::Encode::<Vec<admin_types::PrimaryBusinessDetails>>::encode_to_value(
- &req.primary_business_details.unwrap_or_default(),
+ &req.primary_business_details.clone().unwrap_or_default(),
)
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "primary_business_details",
@@ -173,15 +173,46 @@ pub async fn create_merchant_account(
.change_context(errors::ApiErrorResponse::InternalServerError)?;
// Create a default business profile
- let business_profile = create_and_insert_business_profile(
- db,
- api_models::admin::BusinessProfileCreate::default(),
- merchant_account.clone(),
- )
- .await?;
+ // If business_labels are passed, then use it as the profile_name
+ // else use `default` as the profile_name
+ if let Some(business_details) = req.primary_business_details.as_ref() {
+ for business_profile in business_details {
+ let profile_name =
+ format!("{}_{}", business_profile.country, business_profile.business);
+
+ let business_profile_create_request = api_models::admin::BusinessProfileCreate {
+ profile_name: Some(profile_name),
+ ..Default::default()
+ };
+
+ let _ = create_and_insert_business_profile(
+ db,
+ business_profile_create_request,
+ merchant_account.clone(),
+ )
+ .await
+ .map_err(|business_profile_insert_error| {
+ crate::logger::warn!(
+ "Business profile already exists {business_profile_insert_error:?}"
+ );
+ })
+ .map(|business_profile| {
+ if business_details.len() == 1 && merchant_account.default_profile.is_none() {
+ merchant_account.default_profile = Some(business_profile.profile_id);
+ }
+ });
+ }
+ } else {
+ let business_profile = create_and_insert_business_profile(
+ db,
+ api_models::admin::BusinessProfileCreate::default(),
+ merchant_account.clone(),
+ )
+ .await?;
- // Update merchant account with the business profile id
- merchant_account.default_profile = Some(business_profile.profile_id);
+ // Update merchant account with the business profile id
+ merchant_account.default_profile = Some(business_profile.profile_id);
+ };
let merchant_account = db
.insert_merchant(merchant_account, &key_store)
@@ -219,6 +250,67 @@ pub async fn get_merchant_account(
.attach_printable("Failed to construct response")?,
))
}
+
+/// For backwards compatibility, whenever new business labels are passed in
+/// primary_business_details, create a business profile
+pub async fn create_business_profile_from_business_labels(
+ db: &dyn StorageInterface,
+ key_store: &domain::MerchantKeyStore,
+ merchant_id: &str,
+ new_business_details: Vec<admin_types::PrimaryBusinessDetails>,
+) -> RouterResult<()> {
+ let merchant_account = db
+ .find_merchant_account_by_merchant_id(merchant_id, key_store)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+
+ let old_business_details = merchant_account
+ .primary_business_details
+ .clone()
+ .parse_value::<Vec<admin_types::PrimaryBusinessDetails>>("PrimaryBusinessDetails")
+ .change_context(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "routing_algorithm",
+ })
+ .attach_printable("Invalid routing algorithm given")?;
+
+ // find the diff between two vectors
+ let business_profiles_to_create = new_business_details
+ .into_iter()
+ .filter(|business_details| !old_business_details.contains(business_details))
+ .collect::<Vec<_>>();
+
+ for business_profile in business_profiles_to_create {
+ let profile_name = format!("{}_{}", business_profile.country, business_profile.business);
+
+ let business_profile_create_request = admin_types::BusinessProfileCreate {
+ profile_name: Some(profile_name),
+ ..Default::default()
+ };
+
+ let business_profile_create_result = create_and_insert_business_profile(
+ db,
+ business_profile_create_request,
+ merchant_account.clone(),
+ )
+ .await
+ .map_err(|business_profile_insert_error| {
+ // If there is any duplicate error, we need not take any action
+ crate::logger::warn!(
+ "Business profile already exists {business_profile_insert_error:?}"
+ );
+ });
+
+ // If a business_profile is created, then unset the default profile
+ if business_profile_create_result.is_ok() && merchant_account.default_profile.is_some() {
+ let unset_default_profile = domain::MerchantAccountUpdate::UnsetDefaultProfile;
+ db.update_merchant(merchant_account.clone(), unset_default_profile, key_store)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ }
+ }
+
+ Ok(())
+}
pub async fn merchant_account_update(
db: &dyn StorageInterface,
merchant_id: &String,
@@ -267,6 +359,20 @@ pub async fn merchant_account_update(
})
.transpose()?;
+ // In order to support backwards compatibility, if a business_labels are passed in the update
+ // call, then create new business_profiles with the profile_name as business_label
+ req.primary_business_details
+ .async_map(|primary_business_details| async {
+ let _ = create_business_profile_from_business_labels(
+ db,
+ &key_store,
+ merchant_id,
+ primary_business_details,
+ )
+ .await;
+ })
+ .await;
+
let key = key_store.key.get_inner().peek();
let business_profile_id_update = if let Some(profile_id) = req.default_profile {
@@ -342,6 +448,8 @@ pub async fn merchant_account_update(
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ // If there are any new business labels generated, create business profile
+
Ok(service_api::ApplicationResponse::Json(
response
.try_into()
@@ -460,13 +568,13 @@ pub async fn create_payment_connector(
helpers::validate_business_details(
req.business_country,
- &req.business_label,
+ req.business_label.as_ref(),
&merchant_account,
)?;
- let connector_label = helpers::get_connector_label(
+ let connector_label = core_utils::get_connector_label(
req.business_country,
- &req.business_label,
+ req.business_label.as_ref(),
req.business_sub_label.as_ref(),
&req.connector_name.to_string(),
);
@@ -511,14 +619,14 @@ pub async fn create_payment_connector(
let frm_configs = get_frm_config_as_secret(req.frm_configs);
- // Validate whether profile_id passed in request is valid and is linked to the merchant
- let business_profile_from_request =
- core_utils::validate_and_get_business_profile(store, req.profile_id.as_ref(), merchant_id)
- .await?;
-
- let profile_id = business_profile_from_request
- .map(|business_profile| business_profile.profile_id)
- .or(merchant_account.default_profile.clone());
+ let profile_id = core_utils::get_profile_id_from_business_details(
+ req.business_country,
+ req.business_label.as_ref(),
+ &merchant_account,
+ req.profile_id.as_ref(),
+ store,
+ )
+ .await?;
let merchant_connector_account = domain::MerchantConnectorAccount {
merchant_id: merchant_id.to_string(),
@@ -560,7 +668,7 @@ pub async fn create_payment_connector(
}
None => None,
},
- profile_id,
+ profile_id: Some(profile_id.clone()),
};
let mca = store
@@ -568,7 +676,8 @@ pub async fn create_payment_connector(
.await
.to_duplicate_response(
errors::ApiErrorResponse::DuplicateMerchantConnectorAccount {
- connector_label: connector_label.clone(),
+ profile_id,
+ connector_name: req.connector_name.to_string(),
},
)?;
@@ -896,9 +1005,15 @@ pub async fn create_and_insert_business_profile(
request,
))?;
+ let profile_name = business_profile_new.profile_name.clone();
+
db.insert_business_profile(business_profile_new)
.await
- .to_duplicate_response(errors::ApiErrorResponse::InternalServerError)
+ .to_duplicate_response(errors::ApiErrorResponse::GenericDuplicateError {
+ message: format!(
+ "Business Profile with the profile_name {profile_name} already exists"
+ ),
+ })
.attach_printable("Failed to insert Business profile because of duplication error")
}
@@ -906,25 +1021,18 @@ pub async fn create_business_profile(
db: &dyn StorageInterface,
request: api::BusinessProfileCreate,
merchant_id: &str,
- merchant_account: Option<domain::MerchantAccount>,
) -> RouterResponse<api_models::admin::BusinessProfileResponse> {
- let merchant_account = if let Some(merchant_account) = merchant_account {
- merchant_account
- } else {
- let key_store = db
- .get_merchant_key_store_by_merchant_id(
- merchant_id,
- &db.get_master_key().to_vec().into(),
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ let key_store = db
+ .get_merchant_key_store_by_merchant_id(merchant_id, &db.get_master_key().to_vec().into())
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
- // Get the merchant account, if few fields are not passed, then they will be inherited from
- // merchant account
- db.find_merchant_account_by_merchant_id(merchant_id, &key_store)
- .await
- .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?
- };
+ // Get the merchant account, if few fields are not passed, then they will be inherited from
+ // merchant account
+ let merchant_account = db
+ .find_merchant_account_by_merchant_id(merchant_id, &key_store)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
if let Some(ref routing_algorithm) = request.routing_algorithm {
let _: api::RoutingAlgorithm = routing_algorithm
@@ -937,7 +1045,14 @@ pub async fn create_business_profile(
}
let business_profile =
- create_and_insert_business_profile(db, request, merchant_account).await?;
+ create_and_insert_business_profile(db, request, merchant_account.clone()).await?;
+
+ if merchant_account.default_profile.is_some() {
+ let unset_default_profile = domain::MerchantAccountUpdate::UnsetDefaultProfile;
+ db.update_merchant(merchant_account, unset_default_profile, &key_store)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
+ }
Ok(service_api::ApplicationResponse::Json(
api_models::admin::BusinessProfileResponse::foreign_try_from(business_profile)
@@ -1010,7 +1125,9 @@ pub async fn update_business_profile(
})?;
if business_profile.merchant_id != merchant_id {
- Err(errors::ApiErrorResponse::AccessForbidden)?
+ Err(errors::ApiErrorResponse::AccessForbidden {
+ resource: profile_id.to_string(),
+ })?
}
let webhook_details = request
diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs
index bae5d0e00d8..f38891931f9 100644
--- a/crates/router/src/core/errors/api_error_response.rs
+++ b/crates/router/src/core/errors/api_error_response.rs
@@ -89,8 +89,8 @@ pub enum ApiErrorResponse {
FlowNotSupported { flow: String, connector: String },
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_21", message = "Missing required params")]
MissingRequiredFields { field_names: Vec<&'static str> },
- #[error(error_type = ErrorType::InvalidRequestError, code = "IR_22", message = "Access forbidden. Not authorized to access this resource")]
- AccessForbidden,
+ #[error(error_type = ErrorType::InvalidRequestError, code = "IR_22", message = "Access forbidden. Not authorized to access this resource {resource}")]
+ AccessForbidden { resource: String },
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_23", message = "{message}")]
FileProviderNotSupported { message: String },
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_23", message = "{message}")]
@@ -130,8 +130,11 @@ pub enum ApiErrorResponse {
DuplicateMandate,
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The merchant account with the specified details already exists in our records")]
DuplicateMerchantAccount,
- #[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The merchant connector account with the specified connector_label '{connector_label}' already exists in our records")]
- DuplicateMerchantConnectorAccount { connector_label: String },
+ #[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The merchant connector account with the specified profile_id '{profile_id}' and connector_name '{connector_name}' already exists in our records")]
+ DuplicateMerchantConnectorAccount {
+ profile_id: String,
+ connector_name: String,
+ },
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The payment method with the specified details already exists in our records")]
DuplicatePaymentMethod,
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The payment with the specified payment_id '{payment_id}' already exists in our records")]
diff --git a/crates/router/src/core/errors/transformers.rs b/crates/router/src/core/errors/transformers.rs
index 208aad56ee1..7ffcd6bdf49 100644
--- a/crates/router/src/core/errors/transformers.rs
+++ b/crates/router/src/core/errors/transformers.rs
@@ -89,7 +89,9 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
Self::MissingRequiredFields { field_names } => AER::BadRequest(
ApiError::new("IR", 21, "Missing required params".to_string(), Some(Extra {data: Some(serde_json::json!(field_names)), ..Default::default() })),
),
- Self::AccessForbidden => AER::ForbiddenCommonResource(ApiError::new("IR", 22, "Access forbidden. Not authorized to access this resource", None)),
+ Self::AccessForbidden {resource} => {
+ AER::ForbiddenCommonResource(ApiError::new("IR", 22, format!("Access forbidden. Not authorized to access this resource {resource}"), None))
+ },
Self::FileProviderNotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 23, message.to_string(), None))
},
@@ -128,8 +130,8 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
Self::DuplicateRefundRequest => AER::BadRequest(ApiError::new("HE", 1, "Duplicate refund request. Refund already attempted with the refund ID", None)),
Self::DuplicateMandate => AER::BadRequest(ApiError::new("HE", 1, "Duplicate mandate request. Mandate already attempted with the Mandate ID", None)),
Self::DuplicateMerchantAccount => AER::BadRequest(ApiError::new("HE", 1, "The merchant account with the specified details already exists in our records", None)),
- Self::DuplicateMerchantConnectorAccount { connector_label } => {
- AER::BadRequest(ApiError::new("HE", 1, format!("The merchant connector account with the specified connector_label '{connector_label}' already exists in our records"), None))
+ Self::DuplicateMerchantConnectorAccount { profile_id, connector_name } => {
+ AER::BadRequest(ApiError::new("HE", 1, format!("The merchant connector account with the specified profile_id '{profile_id}' and connector_name '{connector_name}' already exists in our records"), None))
}
Self::DuplicatePaymentMethod => AER::BadRequest(ApiError::new("HE", 1, "The payment method with the specified details already exists in our records", None)),
Self::DuplicatePayment { payment_id } => {
diff --git a/crates/router/src/core/files.rs b/crates/router/src/core/files.rs
index c16b915bb9b..e6a0d3122da 100644
--- a/crates/router/src/core/files.rs
+++ b/crates/router/src/core/files.rs
@@ -39,6 +39,7 @@ pub async fn files_create_core(
file_upload_provider: None,
available: false,
connector_label: None,
+ profile_id: None,
};
let file_metadata_object = state
.store
@@ -47,7 +48,7 @@ pub async fn files_create_core(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to insert file_metadata")?;
let (provider_file_id, file_upload_provider, connector_label) =
- helpers::upload_and_get_provider_provider_file_id_connector_label(
+ helpers::upload_and_get_provider_provider_file_id_profile_id(
state,
&merchant_account,
&key_store,
diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rs
index b9d5c6afc1a..7d7e694b42b 100644
--- a/crates/router/src/core/files/helpers.rs
+++ b/crates/router/src/core/files/helpers.rs
@@ -6,9 +6,7 @@ use futures::TryStreamExt;
use crate::{
core::{
errors::{self, StorageErrorExt},
- files,
- payments::{self, helpers as payments_helpers},
- utils,
+ files, payments, utils,
},
routes::AppState,
services,
@@ -262,7 +260,7 @@ pub async fn retrieve_file_and_provider_file_id_from_file_id(
}
//Upload file to connector if it supports / store it in S3 and return file_upload_provider, provider_file_id accordingly
-pub async fn upload_and_get_provider_provider_file_id_connector_label(
+pub async fn upload_and_get_provider_provider_file_id_profile_id(
state: &AppState,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
@@ -311,12 +309,7 @@ pub async fn upload_and_get_provider_provider_file_id_connector_label(
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
- let connector_label = payments_helpers::get_connector_label(
- payment_intent.business_country,
- &payment_intent.business_label,
- payment_attempt.business_sub_label.as_ref(),
- &dispute.connector,
- );
+
let connector_integration: services::BoxedConnectorIntegration<
'_,
api::Upload,
@@ -332,7 +325,6 @@ pub async fn upload_and_get_provider_provider_file_id_connector_label(
create_file_request,
&dispute.connector,
file_key,
- connector_label.clone(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -361,7 +353,7 @@ pub async fn upload_and_get_provider_provider_file_id_connector_label(
api_models::enums::FileUploadProvider::foreign_try_from(
&connector_data.connector_name,
)?,
- Some(connector_label),
+ payment_intent.profile_id,
))
} else {
upload_file(
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 7396edc0cbd..fffd127937f 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -856,7 +856,7 @@ pub async fn list_payment_methods(
// filter out connectors based on the business country
let filtered_mcas =
- helpers::filter_mca_based_on_business_details(all_mcas, payment_intent.as_ref());
+ helpers::filter_mca_based_on_business_profile(all_mcas, payment_intent.as_ref());
logger::debug!(mca_before_filtering=?filtered_mcas);
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 1dcfd09b1df..b5f8f22363a 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -33,7 +33,10 @@ use self::{
use super::errors::StorageErrorExt;
use crate::{
configs::settings::PaymentMethodTypeTokenFilter,
- core::errors::{self, CustomResult, RouterResponse, RouterResult},
+ core::{
+ errors::{self, CustomResult, RouterResponse, RouterResult},
+ utils,
+ },
db::StorageInterface,
logger,
routes::{metrics, payment_methods::ParentPaymentMethodToken, AppState},
@@ -589,7 +592,7 @@ where
.as_ref()
.get_required_value("connector")?;
- let merchant_connector_account = construct_connector_label_and_get_mca(
+ let merchant_connector_account = construct_profile_id_and_get_mca(
state,
merchant_account,
payment_data,
@@ -787,7 +790,7 @@ where
for session_connector_data in connectors.iter() {
let connector_id = session_connector_data.connector.connector.id();
- let merchant_connector_account = construct_connector_label_and_get_mca(
+ let merchant_connector_account = construct_profile_id_and_get_mca(
state,
merchant_account,
&mut payment_data,
@@ -885,7 +888,7 @@ where
match connector_name {
Some(connector_name) => {
- let merchant_connector_account = construct_connector_label_and_get_mca(
+ let merchant_connector_account = construct_profile_id_and_get_mca(
state,
merchant_account,
payment_data,
@@ -900,13 +903,29 @@ where
api::GetToken::Connector,
)?;
- let connector_label = helpers::get_connector_label(
+ let connector_label = super::utils::get_connector_label(
payment_data.payment_intent.business_country,
- &payment_data.payment_intent.business_label,
+ payment_data.payment_intent.business_label.as_ref(),
payment_data.payment_attempt.business_sub_label.as_ref(),
&connector_name,
);
+ let connector_label = if let Some(connector_label) = connector_label {
+ connector_label
+ } else {
+ let profile_id = utils::get_profile_id_from_business_details(
+ payment_data.payment_intent.business_country,
+ payment_data.payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_data.payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .attach_printable("Could not find profile id from business details")?;
+
+ format!("{connector_name}_{profile_id}")
+ };
+
let (should_call_connector, existing_connector_customer_id) =
customers::should_call_connector_create_customer(
state,
@@ -1021,7 +1040,7 @@ pub fn is_preprocessing_required_for_wallets(connector_name: String) -> bool {
connector_name == *"trustpay" || connector_name == *"payme"
}
-pub async fn construct_connector_label_and_get_mca<'a, F>(
+pub async fn construct_profile_id_and_get_mca<'a, F>(
state: &'a AppState,
merchant_account: &domain::MerchantAccount,
payment_data: &mut PaymentData<F>,
@@ -1031,19 +1050,24 @@ pub async fn construct_connector_label_and_get_mca<'a, F>(
where
F: Clone,
{
- let connector_label = helpers::get_connector_label(
+ let profile_id = utils::get_profile_id_from_business_details(
payment_data.payment_intent.business_country,
- &payment_data.payment_intent.business_label,
- payment_data.payment_attempt.business_sub_label.as_ref(),
- connector_id,
- );
+ payment_data.payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_data.payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
payment_data.creds_identifier.to_owned(),
key_store,
+ &profile_id,
+ connector_id,
)
.await?;
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 055e7f8f61b..ed94e2a3d64 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -86,17 +86,14 @@ pub fn create_identity_from_certificate_and_key(
.change_context(errors::ApiClientError::CertificateDecodeFailed)
}
-pub fn filter_mca_based_on_business_details(
+pub fn filter_mca_based_on_business_profile(
merchant_connector_accounts: Vec<domain::MerchantConnectorAccount>,
payment_intent: Option<&PaymentIntent>,
) -> Vec<domain::MerchantConnectorAccount> {
if let Some(payment_intent) = payment_intent {
merchant_connector_accounts
.into_iter()
- .filter(|mca| {
- mca.business_country == payment_intent.business_country
- && mca.business_label == payment_intent.business_label
- })
+ .filter(|mca| mca.profile_id == payment_intent.profile_id)
.collect::<Vec<_>>()
} else {
merchant_connector_accounts
@@ -2102,43 +2099,10 @@ pub async fn verify_payment_intent_time_and_client_secret(
.transpose()
}
-fn connector_needs_business_sub_label(connector_name: &str) -> bool {
- let connectors_list = [api_models::enums::Connector::Cybersource];
- connectors_list
- .map(|connector| connector.to_string())
- .contains(&connector_name.to_string())
-}
-
-/// Create the connector label
-/// {connector_name}_{country}_{business_label}
-pub fn get_connector_label(
- business_country: api_models::enums::CountryAlpha2,
- business_label: &str,
- business_sub_label: Option<&String>,
- connector_name: &str,
-) -> String {
- let mut connector_label = format!("{connector_name}_{business_country}_{business_label}");
-
- // Business sub label is currently being used only for cybersource
- // To ensure backwards compatibality, cybersource mca's created before this change
- // will have the business_sub_label value as default.
- //
- // Even when creating the connector account, if no sub label is provided, default will be used
- if connector_needs_business_sub_label(connector_name) {
- if let Some(sub_label) = business_sub_label {
- connector_label.push_str(&format!("_{sub_label}"));
- } else {
- connector_label.push_str("_default"); // For backwards compatibality
- }
- }
-
- connector_label
-}
-
/// Check whether the business details are configured in the merchant account
pub fn validate_business_details(
- business_country: api_enums::CountryAlpha2,
- business_label: &String,
+ business_country: Option<api_enums::CountryAlpha2>,
+ business_label: Option<&String>,
merchant_account: &domain::MerchantAccount,
) -> RouterResult<()> {
let primary_business_details = merchant_account
@@ -2148,15 +2112,21 @@ pub fn validate_business_details(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse primary business details")?;
- primary_business_details
- .iter()
- .find(|business_details| {
- &business_details.business == business_label
- && business_details.country == business_country
+ business_country
+ .zip(business_label)
+ .map(|(business_country, business_label)| {
+ primary_business_details
+ .iter()
+ .find(|business_details| {
+ &business_details.business == business_label
+ && business_details.country == business_country
+ })
+ .ok_or(errors::ApiErrorResponse::PreconditionFailed {
+ message: "business_details are not configured in the merchant account"
+ .to_string(),
+ })
})
- .ok_or(errors::ApiErrorResponse::PreconditionFailed {
- message: "business_details are not configured in the merchant account".to_string(),
- })?;
+ .transpose()?;
Ok(())
}
@@ -2236,8 +2206,8 @@ mod tests {
off_session: None,
client_secret: Some("1".to_string()),
active_attempt_id: "nopes".to_string(),
- business_country: storage_enums::CountryAlpha2::AG,
- business_label: "no".to_string(),
+ business_country: None,
+ business_label: None,
order_details: None,
allowed_payment_method_types: None,
connector_metadata: None,
@@ -2283,8 +2253,8 @@ mod tests {
off_session: None,
client_secret: Some("1".to_string()),
active_attempt_id: "nopes".to_string(),
- business_country: storage_enums::CountryAlpha2::AG,
- business_label: "no".to_string(),
+ business_country: None,
+ business_label: None,
order_details: None,
allowed_payment_method_types: None,
connector_metadata: None,
@@ -2330,8 +2300,8 @@ mod tests {
off_session: None,
client_secret: None,
active_attempt_id: "nopes".to_string(),
- business_country: storage_enums::CountryAlpha2::AG,
- business_label: "no".to_string(),
+ business_country: None,
+ business_label: None,
order_details: None,
allowed_payment_method_types: None,
connector_metadata: None,
@@ -2423,12 +2393,15 @@ impl MerchantConnectorAccountType {
}
}
+/// Query for merchant connector account either by business label or profile id
+/// If profile_id is passed use it, or use connector_label to query merchant connector account
pub async fn get_merchant_connector_account(
state: &AppState,
merchant_id: &str,
- connector_label: &str,
creds_identifier: Option<String>,
key_store: &domain::MerchantKeyStore,
+ profile_id: &String,
+ connector_name: &str,
) -> RouterResult<MerchantConnectorAccountType> {
let db = &*state.store;
match creds_identifier {
@@ -2438,7 +2411,7 @@ pub async fn get_merchant_connector_account(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: connector_label.to_string(),
+ id: format!("mcd_{merchant_id}_{creds_identifier}"),
},
)?;
@@ -2470,17 +2443,20 @@ pub async fn get_merchant_connector_account(
Ok(MerchantConnectorAccountType::CacheVal(res))
}
- None => db
- .find_merchant_connector_account_by_merchant_id_connector_label(
- merchant_id,
- connector_label,
+ None => {
+ db.find_merchant_connector_account_by_profile_id_connector_name(
+ profile_id,
+ connector_name,
key_store,
)
.await
- .map(MerchantConnectorAccountType::DbVal)
- .change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: connector_label.to_string(),
- }),
+ .to_not_found_response(
+ errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+ id: format!("profile id {profile_id} and connector name {connector_name}"),
+ },
+ )
+ }
+ .map(MerchantConnectorAccountType::DbVal),
}
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 796ce874883..bccfbd81c3b 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -511,8 +511,8 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
let customer_id = customer.clone().map(|c| c.customer_id);
let return_url = payment_data.payment_intent.return_url.take();
let setup_future_usage = payment_data.payment_intent.setup_future_usage;
- let business_label = Some(payment_data.payment_intent.business_label.clone());
- let business_country = Some(payment_data.payment_intent.business_country);
+ let business_label = payment_data.payment_intent.business_label.clone();
+ let business_country = payment_data.payment_intent.business_country;
let description = payment_data.payment_intent.description.take();
let statement_descriptor_name =
payment_data.payment_intent.statement_descriptor_name.take();
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index ba4a6eb5b37..68f37eaa574 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -65,17 +65,15 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
- // Validate whether profile_id passed in request is valid and is linked to the merchant
- let business_profile_from_request = core_utils::validate_and_get_business_profile(
- db,
- request.profile_id.as_ref(),
- merchant_id,
- )
- .await?;
+ helpers::validate_business_details(
+ request.business_country,
+ request.business_label.as_ref(),
+ merchant_account,
+ )?;
- let profile_id = business_profile_from_request
- .map(|business_profile| business_profile.profile_id)
- .or(merchant_account.default_profile.clone());
+ // Validate whether profile_id passed in request is valid and is linked to the merchant
+ core_utils::validate_and_get_business_profile(db, request.profile_id.as_ref(), merchant_id)
+ .await?;
let (
token,
@@ -155,8 +153,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
shipping_address.clone().map(|x| x.address_id),
billing_address.clone().map(|x| x.address_id),
payment_attempt.attempt_id.to_owned(),
- profile_id,
- )?,
+ state,
+ )
+ .await?,
storage_scheme,
)
.await
@@ -584,7 +583,7 @@ impl PaymentCreate {
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
- fn make_payment_intent(
+ async fn make_payment_intent(
payment_id: &str,
merchant_account: &types::domain::MerchantAccount,
money: (api::Amount, enums::Currency),
@@ -592,7 +591,7 @@ impl PaymentCreate {
shipping_address_id: Option<String>,
billing_address_id: Option<String>,
active_attempt_id: String,
- profile_id: Option<String>,
+ state: &AppState,
) -> RouterResult<storage::PaymentIntentNew> {
let created_at @ modified_at @ last_synced = Some(common_utils::date_time::now());
let status =
@@ -606,29 +605,15 @@ impl PaymentCreate {
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to convert order details to value")?;
- let (business_country, business_label) =
- match (request.business_country, request.business_label.as_ref()) {
- (Some(business_country), Some(business_label)) => {
- helpers::validate_business_details(
- business_country,
- business_label,
- merchant_account,
- )?;
-
- Ok((business_country, business_label.clone()))
- }
- (None, Some(_)) => Err(errors::ApiErrorResponse::MissingRequiredField {
- field_name: "business_country",
- }),
- (Some(_), None) => Err(errors::ApiErrorResponse::MissingRequiredField {
- field_name: "business_label",
- }),
- (None, None) => Ok(helpers::get_business_details(
- request.business_country,
- request.business_label.as_ref(),
- merchant_account,
- )?),
- }?;
+ // If profile id is not passed, get it from the business_country and business_label
+ let profile_id = core_utils::get_profile_id_from_business_details(
+ request.business_country,
+ request.business_label.as_ref(),
+ merchant_account,
+ request.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await?;
let allowed_payment_method_types = request
.get_allowed_payment_method_types_as_value()
@@ -664,8 +649,8 @@ impl PaymentCreate {
statement_descriptor_name: request.statement_descriptor_name.clone(),
statement_descriptor_suffix: request.statement_descriptor_suffix.clone(),
metadata: request.metadata.clone(),
- business_country,
- business_label,
+ business_country: request.business_country,
+ business_label: request.business_label.clone(),
active_attempt_id,
order_details,
amount_captured: None,
@@ -675,7 +660,7 @@ impl PaymentCreate {
connector_metadata,
feature_metadata,
attempt_count: 1,
- profile_id,
+ profile_id: Some(profile_id),
merchant_decision: None,
payment_confirm_source: None,
})
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index e432e0cdb6a..a37dbfcf2ec 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -330,7 +330,7 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Database error when querying for merchant connector accounts")?;
- let filtered_connector_accounts = helpers::filter_mca_based_on_business_details(
+ let filtered_connector_accounts = helpers::filter_mca_based_on_business_profile(
all_connector_accounts,
Some(payment_intent),
);
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index ec0c33e29e9..dbd61d274d5 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -510,8 +510,8 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
let return_url = payment_data.payment_intent.return_url.clone();
let setup_future_usage = payment_data.payment_intent.setup_future_usage;
- let business_label = Some(payment_data.payment_intent.business_label.clone());
- let business_country = Some(payment_data.payment_intent.business_country);
+ let business_label = payment_data.payment_intent.business_label.clone();
+ let business_country = payment_data.payment_intent.business_country;
let description = payment_data.payment_intent.description.clone();
let statement_descriptor_name = payment_data
.payment_intent
@@ -647,13 +647,10 @@ impl PaymentUpdate {
.clone()
.map(|i| payment_intent.return_url.replace(i.to_string()));
- payment_intent.business_country = request
- .business_country
- .unwrap_or(payment_intent.business_country);
- payment_intent.business_label = request
- .business_label
- .clone()
- .unwrap_or(payment_intent.business_label.clone());
+ payment_intent.business_country = request.business_country;
+
+ payment_intent.business_label = request.business_label.clone();
+
request
.description
.clone()
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 2362c6a2975..596c2ff7255 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -510,10 +510,10 @@ where
let mut response: api::PaymentsResponse = Default::default();
let routed_through = payment_attempt.connector.clone();
- let connector_label = routed_through.as_ref().map(|connector_name| {
- helpers::get_connector_label(
+ let connector_label = routed_through.as_ref().and_then(|connector_name| {
+ core_utils::get_connector_label(
payment_intent.business_country,
- &payment_intent.business_label,
+ payment_intent.business_label.as_ref(),
payment_attempt.business_sub_label.as_ref(),
connector_name,
)
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index ab60989fa6a..60fa889dc48 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -559,19 +559,17 @@ pub async fn create_recipient(
let customer_details = payout_data.customer_details.to_owned();
let connector_name = connector_data.connector_name.to_string();
- let connector_label = payment_helpers::get_connector_label(
- payout_data
- .payout_attempt
- .business_country
- .unwrap_or_default(),
- &payout_data
- .payout_attempt
- .business_label
- .to_owned()
- .unwrap_or_default(),
- None,
- &connector_name,
- );
+ let profile_id = core_utils::get_profile_id_from_business_details(
+ payout_data.payout_attempt.business_country,
+ payout_data.payout_attempt.business_label.as_ref(),
+ merchant_account,
+ payout_data.payout_attempt.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await?;
+
+ // Create the connector label using {profile_id}_{connector_name}
+ let connector_label = format!("{profile_id}_{}", connector_name);
let (should_call_connector, _connector_customer_id) =
helpers::should_call_payout_connector_create_customer(
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index f933f76a634..eab55f458ec 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -4,7 +4,7 @@ use api_models::enums::{DisputeStage, DisputeStatus};
#[cfg(feature = "payouts")]
use common_utils::{crypto::Encryptable, pii::Email};
use common_utils::{errors::CustomResult, ext_traits::AsyncExt};
-use error_stack::{IntoReport, ResultExt};
+use error_stack::{report, IntoReport, ResultExt};
use router_env::{instrument, tracing};
use uuid::Uuid;
@@ -45,21 +45,23 @@ pub async fn get_mca_for_payout<'a>(
match payout_data.merchant_connector_account.to_owned() {
Some(mca) => Ok(mca),
None => {
- let (business_country, business_label) = helpers::get_business_details(
- payout_attempt.business_country,
- payout_attempt.business_label.as_ref(),
- merchant_account,
- )?;
-
- let connector_label =
- helpers::get_connector_label(business_country, &business_label, None, connector_id);
+ let profile_id = payout_attempt
+ .profile_id
+ .as_ref()
+ .ok_or(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "business_profile",
+ })
+ .into_report()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
None,
key_store,
+ profile_id,
+ connector_id,
)
.await?;
Ok(merchant_connector_account)
@@ -203,19 +205,24 @@ pub async fn construct_refund_router_data<'a, F>(
refund: &'a storage::Refund,
creds_identifier: Option<String>,
) -> RouterResult<types::RefundsRouterData<F>> {
- let connector_label = helpers::get_connector_label(
+ let profile_id = get_profile_id_from_business_details(
payment_intent.business_country,
- &payment_intent.business_label,
- None,
- connector_id,
- );
+ payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
creds_identifier,
key_store,
+ &profile_id,
+ connector_id,
)
.await?;
@@ -471,21 +478,27 @@ pub async fn construct_accept_dispute_router_data<'a>(
key_store: &domain::MerchantKeyStore,
dispute: &storage::Dispute,
) -> RouterResult<types::AcceptDisputeRouterData> {
- let connector_id = &dispute.connector;
- let connector_label = helpers::get_connector_label(
+ let profile_id = get_profile_id_from_business_details(
payment_intent.business_country,
- &payment_intent.business_label,
- payment_attempt.business_sub_label.as_ref(),
- connector_id,
- );
+ payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
+
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
None,
key_store,
+ &profile_id,
+ &dispute.connector,
)
.await?;
+
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
@@ -497,7 +510,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
let router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_account.merchant_id.clone(),
- connector: connector_id.to_string(),
+ connector: dispute.connector.to_string(),
payment_id: payment_attempt.payment_id.clone(),
attempt_id: payment_attempt.attempt_id.clone(),
status: payment_attempt.status,
@@ -551,20 +564,27 @@ pub async fn construct_submit_evidence_router_data<'a>(
submit_evidence_request_data: types::SubmitEvidenceRequestData,
) -> RouterResult<types::SubmitEvidenceRouterData> {
let connector_id = &dispute.connector;
- let connector_label = helpers::get_connector_label(
+ let profile_id = get_profile_id_from_business_details(
payment_intent.business_country,
- &payment_intent.business_label,
- payment_attempt.business_sub_label.as_ref(),
- connector_id,
- );
+ payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
+
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
None,
key_store,
+ &profile_id,
+ connector_id,
)
.await?;
+
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
@@ -627,14 +647,25 @@ pub async fn construct_upload_file_router_data<'a>(
create_file_request: &types::api::CreateFileRequest,
connector_id: &str,
file_key: String,
- connector_label: String,
) -> RouterResult<types::UploadFileRouterData> {
+ let profile_id = get_profile_id_from_business_details(
+ payment_intent.business_country,
+ payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
+
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
None,
key_store,
+ &profile_id,
+ connector_id,
)
.await?;
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
@@ -704,20 +735,27 @@ pub async fn construct_defend_dispute_router_data<'a>(
) -> RouterResult<types::DefendDisputeRouterData> {
let _db = &*state.store;
let connector_id = &dispute.connector;
- let connector_label = helpers::get_connector_label(
+ let profile_id = get_profile_id_from_business_details(
payment_intent.business_country,
- &payment_intent.business_label,
- payment_attempt.business_sub_label.as_ref(),
- connector_id,
- );
+ payment_intent.business_label.as_ref(),
+ merchant_account,
+ payment_intent.profile_id.as_ref(),
+ &*state.store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
+
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
None,
key_store,
+ &profile_id,
+ connector_id,
)
.await?;
+
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
@@ -780,20 +818,26 @@ pub async fn construct_retrieve_file_router_data<'a>(
file_metadata: &diesel_models::file::FileMetadata,
connector_id: &str,
) -> RouterResult<types::RetrieveFileRouterData> {
- let connector_label = file_metadata
- .connector_label
- .clone()
- .ok_or(errors::ApiErrorResponse::InternalServerError)
+ let profile_id = file_metadata
+ .profile_id
+ .as_ref()
+ .ok_or(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "profile_id",
+ })
.into_report()
- .attach_printable("Missing connector label")?;
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in file_metadata")?;
+
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
merchant_account.merchant_id.as_str(),
- &connector_label,
None,
key_store,
+ profile_id,
+ connector_id,
)
.await?;
+
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
@@ -890,7 +934,9 @@ pub async fn validate_and_get_business_profile(
.map(|business_profile| {
// Check if the merchant_id of business profile is same as the current merchant_id
if business_profile.merchant_id.ne(merchant_id) {
- Err(errors::ApiErrorResponse::AccessForbidden)
+ Err(errors::ApiErrorResponse::AccessForbidden {
+ resource: business_profile.profile_id,
+ })
} else {
Ok(business_profile)
}
@@ -898,3 +944,84 @@ pub async fn validate_and_get_business_profile(
.transpose()
.into_report()
}
+
+fn connector_needs_business_sub_label(connector_name: &str) -> bool {
+ let connectors_list = [api_models::enums::Connector::Cybersource];
+ connectors_list
+ .map(|connector| connector.to_string())
+ .contains(&connector_name.to_string())
+}
+
+/// Create the connector label
+/// {connector_name}_{country}_{business_label}
+pub fn get_connector_label(
+ business_country: Option<api_models::enums::CountryAlpha2>,
+ business_label: Option<&String>,
+ business_sub_label: Option<&String>,
+ connector_name: &str,
+) -> Option<String> {
+ business_country
+ .zip(business_label)
+ .map(|(business_country, business_label)| {
+ let mut connector_label =
+ format!("{connector_name}_{business_country}_{business_label}");
+
+ // Business sub label is currently being used only for cybersource
+ // To ensure backwards compatibality, cybersource mca's created before this change
+ // will have the business_sub_label value as default.
+ //
+ // Even when creating the connector account, if no sub label is provided, default will be used
+ if connector_needs_business_sub_label(connector_name) {
+ if let Some(sub_label) = business_sub_label {
+ connector_label.push_str(&format!("_{sub_label}"));
+ } else {
+ connector_label.push_str("_default"); // For backwards compatibality
+ }
+ }
+
+ connector_label
+ })
+}
+
+/// If profile_id is not passed, use default profile if available, or
+/// If business_details (business_country and business_label) are passed, get the business_profile
+/// or return a `MissingRequiredField` error
+pub async fn get_profile_id_from_business_details(
+ business_country: Option<api_models::enums::CountryAlpha2>,
+ business_label: Option<&String>,
+ merchant_account: &domain::MerchantAccount,
+ request_profile_id: Option<&String>,
+ db: &dyn StorageInterface,
+) -> RouterResult<String> {
+ match request_profile_id.or(merchant_account.default_profile.as_ref()) {
+ Some(profile_id) => {
+ // Check whether this business profile belongs to the merchant
+ let _ = validate_and_get_business_profile(
+ db,
+ Some(profile_id),
+ &merchant_account.merchant_id,
+ )
+ .await?;
+ Ok(profile_id.clone())
+ }
+ None => match business_country.zip(business_label) {
+ Some((business_country, business_label)) => {
+ let profile_name = format!("{business_country}_{business_label}");
+ let business_profile = db
+ .find_business_profile_by_profile_name_merchant_id(
+ &profile_name,
+ &merchant_account.merchant_id,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_name,
+ })?;
+
+ Ok(business_profile.profile_id)
+ }
+ _ => Err(report!(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "profile_id or business_country, business_label"
+ })),
+ },
+ }
+}
diff --git a/crates/router/src/db/business_profile.rs b/crates/router/src/db/business_profile.rs
index dff3bac792e..f29e0e9cecc 100644
--- a/crates/router/src/db/business_profile.rs
+++ b/crates/router/src/db/business_profile.rs
@@ -20,6 +20,12 @@ pub trait BusinessProfileInterface {
profile_id: &str,
) -> CustomResult<business_profile::BusinessProfile, errors::StorageError>;
+ async fn find_business_profile_by_profile_name_merchant_id(
+ &self,
+ profile_name: &str,
+ merchant_id: &str,
+ ) -> CustomResult<business_profile::BusinessProfile, errors::StorageError>;
+
async fn update_business_profile_by_profile_id(
&self,
current_state: business_profile::BusinessProfile,
@@ -63,6 +69,22 @@ impl BusinessProfileInterface for Store {
.into_report()
}
+ async fn find_business_profile_by_profile_name_merchant_id(
+ &self,
+ profile_name: &str,
+ merchant_id: &str,
+ ) -> CustomResult<business_profile::BusinessProfile, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+ storage::business_profile::BusinessProfile::find_by_profile_name_merchant_id(
+ &conn,
+ profile_name,
+ merchant_id,
+ )
+ .await
+ .map_err(Into::into)
+ .into_report()
+ }
+
async fn update_business_profile_by_profile_id(
&self,
current_state: business_profile::BusinessProfile,
@@ -200,4 +222,12 @@ impl BusinessProfileInterface for MockDb {
Ok(business_profile_by_merchant_id)
}
+
+ async fn find_business_profile_by_profile_name_merchant_id(
+ &self,
+ _profile_name: &str,
+ _merchant_id: &str,
+ ) -> CustomResult<business_profile::BusinessProfile, errors::StorageError> {
+ Err(errors::StorageError::MockDbError)?
+ }
}
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 36c2e7c4984..501a71bb9fe 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -118,6 +118,13 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
+ async fn find_merchant_connector_account_by_profile_id_connector_name(
+ &self,
+ profile_id: &str,
+ connector_name: &str,
+ key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
+
async fn find_merchant_connector_account_by_merchant_id_connector_name(
&self,
merchant_id: &str,
@@ -206,6 +213,51 @@ impl MerchantConnectorAccountInterface for Store {
}
}
+ async fn find_merchant_connector_account_by_profile_id_connector_name(
+ &self,
+ profile_id: &str,
+ connector_name: &str,
+ key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
+ let find_call = || async {
+ let conn = connection::pg_connection_read(self).await?;
+ storage::MerchantConnectorAccount::find_by_profile_id_connector_name(
+ &conn,
+ profile_id,
+ connector_name,
+ )
+ .await
+ .map_err(Into::into)
+ .into_report()
+ };
+
+ #[cfg(not(feature = "accounts_cache"))]
+ {
+ find_call()
+ .await?
+ .convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DeserializationFailed)
+ }
+
+ #[cfg(feature = "accounts_cache")]
+ {
+ super::cache::get_or_populate_in_memory(
+ self,
+ &format!("{}_{}", profile_id, connector_name),
+ find_call,
+ &cache::ACCOUNTS_CACHE,
+ )
+ .await
+ .async_and_then(|item| async {
+ item.convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await
+ }
+ }
+
async fn find_merchant_connector_account_by_merchant_id_connector_name(
&self,
merchant_id: &str,
@@ -329,7 +381,12 @@ impl MerchantConnectorAccountInterface for Store {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
let _merchant_id = this.merchant_id.clone();
- let _merchant_connector_label = this.connector_label.clone();
+ let _profile_id = this
+ .profile_id
+ .clone()
+ .ok_or(errors::StorageError::ValueNotFound(
+ "profile_id".to_string(),
+ ))?;
let update_call = || async {
let conn = connection::pg_connection_write(self).await?;
@@ -352,9 +409,7 @@ impl MerchantConnectorAccountInterface for Store {
{
super::cache::publish_and_redact(
self,
- cache::CacheKind::Accounts(
- format!("{}_{}", _merchant_id, _merchant_connector_label).into(),
- ),
+ cache::CacheKind::Accounts(format!("{}_{}", _merchant_id, _profile_id).into()),
update_call,
)
.await
@@ -399,11 +454,13 @@ impl MerchantConnectorAccountInterface for Store {
.map_err(Into::into)
.into_report()?;
+ let _profile_id = mca.profile_id.ok_or(errors::StorageError::ValueNotFound(
+ "profile_id".to_string(),
+ ))?;
+
super::cache::publish_and_redact(
self,
- cache::CacheKind::Accounts(
- format!("{}_{}", mca.merchant_id, mca.connector_label).into(),
- ),
+ cache::CacheKind::Accounts(format!("{}_{}", mca.merchant_id, _profile_id).into()),
delete_call,
)
.await
@@ -430,7 +487,8 @@ impl MerchantConnectorAccountInterface for MockDb {
.await
.iter()
.find(|account| {
- account.merchant_id == merchant_id && account.connector_label == connector
+ account.merchant_id == merchant_id
+ && account.connector_label == Some(connector.to_string())
})
.cloned()
.async_map(|account| async {
@@ -496,6 +554,36 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
+ async fn find_merchant_connector_account_by_profile_id_connector_name(
+ &self,
+ profile_id: &str,
+ connector_name: &str,
+ key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
+ let maybe_mca = self
+ .merchant_connector_accounts
+ .lock()
+ .await
+ .iter()
+ .find(|account| {
+ account.profile_id.eq(&Some(profile_id.to_owned()))
+ && account.connector_name == connector_name
+ })
+ .cloned();
+
+ match maybe_mca {
+ Some(mca) => mca
+ .to_owned()
+ .convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError),
+ None => Err(errors::StorageError::ValueNotFound(
+ "cannot find merchant connector account".to_string(),
+ )
+ .into()),
+ }
+ }
+
async fn find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&self,
merchant_id: &str,
@@ -691,7 +779,7 @@ mod merchant_connector_account_cache_tests {
#[allow(clippy::unwrap_used)]
#[tokio::test]
- async fn test_connector_label_cache() {
+ async fn test_connector_profile_id_cache() {
let db = MockDb::new().await;
let redis_conn = db.get_redis_conn().unwrap();
@@ -704,6 +792,7 @@ mod merchant_connector_account_cache_tests {
let merchant_id = "test_merchant";
let connector_label = "stripe_USA";
let merchant_connector_id = "simple_merchant_connector_id";
+ let profile_id = "pro_max_ultra";
db.insert_merchant_key_store(
domain::MerchantKeyStore {
@@ -743,23 +832,24 @@ mod merchant_connector_account_cache_tests {
connector_type: ConnectorType::FinOperations,
metadata: None,
frm_configs: None,
- connector_label: connector_label.to_string(),
- business_country: CountryAlpha2::US,
- business_label: "cloth".to_string(),
+ connector_label: Some(connector_label.to_string()),
+ business_country: Some(CountryAlpha2::US),
+ business_label: Some("cloth".to_string()),
business_sub_label: None,
created_at: date_time::now(),
modified_at: date_time::now(),
connector_webhook_details: None,
- profile_id: None,
+ profile_id: Some(profile_id.to_string()),
};
- db.insert_merchant_connector_account(mca, &merchant_key)
+ db.insert_merchant_connector_account(mca.clone(), &merchant_key)
.await
.unwrap();
+
let find_call = || async {
- db.find_merchant_connector_account_by_merchant_id_connector_label(
- merchant_id,
- connector_label,
+ db.find_merchant_connector_account_by_profile_id_connector_name(
+ profile_id,
+ &mca.connector_name,
&merchant_key,
)
.await
@@ -770,7 +860,7 @@ mod merchant_connector_account_cache_tests {
};
let _: storage::MerchantConnectorAccount = cache::get_or_populate_in_memory(
&db,
- &format!("{}_{}", merchant_id, connector_label),
+ &format!("{}_{}", merchant_id, profile_id),
find_call,
&ACCOUNTS_CACHE,
)
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index a0892abfcde..225b9bad82b 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -402,7 +402,7 @@ pub async fn business_profile_create(
state.get_ref(),
&req,
payload,
- |state, _, req| create_business_profile(&*state.store, req, &merchant_id, None),
+ |state, _, req| create_business_profile(&*state.store, req, &merchant_id),
&auth::AdminApiAuth,
)
.await
diff --git a/crates/router/src/types/api/webhooks.rs b/crates/router/src/types/api/webhooks.rs
index 698353893fe..d849f1f82ef 100644
--- a/crates/router/src/types/api/webhooks.rs
+++ b/crates/router/src/types/api/webhooks.rs
@@ -90,7 +90,7 @@ pub trait IncomingWebhook: ConnectorCommon + Sync {
merchant_id, connector_name
);
let default_secret = "default_secret".to_string();
- let connector_label = utils::get_connector_label_using_object_reference_id(
+ let profile_id = utils::get_profile_id_using_object_reference_id(
db,
object_reference_id,
merchant_account,
@@ -98,11 +98,12 @@ pub trait IncomingWebhook: ConnectorCommon + Sync {
)
.await
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
- .attach_printable("Error while fetching connector_label")?;
+ .attach_printable("Error while fetching business_profile")?;
+
let merchant_connector_account_result = db
- .find_merchant_connector_account_by_merchant_id_connector_label(
- merchant_id,
- &connector_label,
+ .find_merchant_connector_account_by_profile_id_connector_name(
+ &profile_id,
+ &merchant_account.merchant_id,
key_store,
)
.await;
diff --git a/crates/router/src/types/domain/merchant_account.rs b/crates/router/src/types/domain/merchant_account.rs
index a5620724ac7..30950f8c9c9 100644
--- a/crates/router/src/types/domain/merchant_account.rs
+++ b/crates/router/src/types/domain/merchant_account.rs
@@ -75,6 +75,7 @@ pub enum MerchantAccountUpdate {
ReconUpdate {
recon_status: diesel_models::enums::ReconStatus,
},
+ UnsetDefaultProfile,
}
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
@@ -130,6 +131,10 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
recon_status,
..Default::default()
},
+ MerchantAccountUpdate::UnsetDefaultProfile => Self {
+ default_profile: Some(None),
+ ..Default::default()
+ },
}
}
}
diff --git a/crates/router/src/types/domain/merchant_connector_account.rs b/crates/router/src/types/domain/merchant_connector_account.rs
index a013534926f..8be60f6cb24 100644
--- a/crates/router/src/types/domain/merchant_connector_account.rs
+++ b/crates/router/src/types/domain/merchant_connector_account.rs
@@ -25,9 +25,9 @@ pub struct MerchantConnectorAccount {
pub connector_type: enums::ConnectorType,
pub metadata: Option<pii::SecretSerdeValue>,
pub frm_configs: Option<Vec<Secret<serde_json::Value>>>,
- pub connector_label: String,
- pub business_country: enums::CountryAlpha2,
- pub business_label: String,
+ pub connector_label: Option<String>,
+ pub business_country: Option<enums::CountryAlpha2>,
+ pub business_label: Option<String>,
pub business_sub_label: Option<String>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index a5aa35b35b4..2452676378f 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -283,37 +283,14 @@ pub async fn find_payment_intent_from_refund_id_type(
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
}
-pub async fn get_connector_label_using_object_reference_id(
+pub async fn get_profile_id_using_object_reference_id(
db: &dyn StorageInterface,
object_reference_id: webhooks::ObjectReferenceId,
merchant_account: &domain::MerchantAccount,
connector_name: &str,
) -> CustomResult<String, errors::ApiErrorResponse> {
- let mut primary_business_details = merchant_account
- .primary_business_details
- .clone()
- .parse_value::<Vec<api_models::admin::PrimaryBusinessDetails>>("PrimaryBusinessDetails")
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("failed to parse primary business details")?;
- //check if there is only one primary business details and get those details
- let (option_business_country, option_business_label) = match primary_business_details.pop() {
- Some(business_details) => {
- if primary_business_details.is_empty() {
- (
- Some(business_details.country),
- Some(business_details.business),
- )
- } else {
- (None, None)
- }
- }
- None => (None, None),
- };
- match (option_business_country, option_business_label) {
- (Some(business_country), Some(business_label)) => Ok(format!(
- "{connector_name}_{}_{}",
- business_country, business_label
- )),
+ match merchant_account.default_profile.as_ref() {
+ Some(profile_id) => Ok(profile_id.clone()),
_ => {
let payment_intent = match object_reference_id {
webhooks::ObjectReferenceId::PaymentId(payment_id_type) => {
@@ -330,10 +307,15 @@ pub async fn get_connector_label_using_object_reference_id(
.await?
}
};
- Ok(format!(
- "{connector_name}_{}_{}",
- payment_intent.business_country, payment_intent.business_label
- ))
+ let profile_id = payment_intent
+ .profile_id
+ .ok_or(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "business_profile",
+ })
+ .into_report()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("profile_id is not set in payment_intent")?;
+ Ok(profile_id)
}
}
}
diff --git a/migrations/2023-08-24-095037_add_profile_id_in_file_metadata/down.sql b/migrations/2023-08-24-095037_add_profile_id_in_file_metadata/down.sql
new file mode 100644
index 00000000000..93f8946110a
--- /dev/null
+++ b/migrations/2023-08-24-095037_add_profile_id_in_file_metadata/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE file_metadata DROP COLUMN IF EXISTS profile_id;
diff --git a/migrations/2023-08-24-095037_add_profile_id_in_file_metadata/up.sql b/migrations/2023-08-24-095037_add_profile_id_in_file_metadata/up.sql
new file mode 100644
index 00000000000..1785f5b938c
--- /dev/null
+++ b/migrations/2023-08-24-095037_add_profile_id_in_file_metadata/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE file_metadata
+ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64);
diff --git a/migrations/2023-08-28-131238_make_business_details_optional/down.sql b/migrations/2023-08-28-131238_make_business_details_optional/down.sql
new file mode 100644
index 00000000000..092d7c5700b
--- /dev/null
+++ b/migrations/2023-08-28-131238_make_business_details_optional/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+-- The changes cannot be reversed, once we move to business profiles, cannot revert back to business_labels
+SELECT 1;
diff --git a/migrations/2023-08-28-131238_make_business_details_optional/up.sql b/migrations/2023-08-28-131238_make_business_details_optional/up.sql
new file mode 100644
index 00000000000..6fd7b514326
--- /dev/null
+++ b/migrations/2023-08-28-131238_make_business_details_optional/up.sql
@@ -0,0 +1,21 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent
+ALTER COLUMN business_country DROP NOT NULL;
+
+ALTER TABLE payment_intent
+ALTER COLUMN business_label DROP NOT NULL;
+
+ALTER TABLE merchant_connector_account
+ALTER COLUMN business_country DROP NOT NULL;
+
+ALTER TABLE merchant_connector_account
+ALTER COLUMN business_label DROP NOT NULL;
+
+ALTER TABLE merchant_connector_account
+ALTER COLUMN connector_label DROP NOT NULL;
+
+DROP INDEX IF EXISTS merchant_connector_account_merchant_id_connector_label_index;
+
+CREATE UNIQUE INDEX IF NOT EXISTS merchant_connector_account_profile_id_connector_id_index ON merchant_connector_account(profile_id, connector_name);
+
+CREATE UNIQUE INDEX IF NOT EXISTS business_profile_merchant_id_profile_name_index ON business_profile(merchant_id, profile_name);
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index b389c686f65..3f7ecae8001 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -6383,9 +6383,7 @@
"required": [
"connector_type",
"connector_name",
- "connector_label",
- "business_country",
- "business_label"
+ "connector_label"
],
"properties": {
"connector_type": {
@@ -6482,10 +6480,16 @@
"nullable": true
},
"business_country": {
- "$ref": "#/components/schemas/CountryAlpha2"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
},
"business_label": {
- "type": "string"
+ "type": "string",
+ "nullable": true
},
"business_sub_label": {
"type": "string",
@@ -6590,10 +6594,7 @@
"required": [
"connector_type",
"connector_name",
- "connector_label",
- "merchant_connector_id",
- "business_country",
- "business_label"
+ "merchant_connector_id"
],
"properties": {
"connector_type": {
@@ -6606,7 +6607,8 @@
},
"connector_label": {
"type": "string",
- "example": "stripe_US_travel"
+ "example": "stripe_US_travel",
+ "nullable": true
},
"merchant_connector_id": {
"type": "string",
@@ -6682,12 +6684,18 @@
"nullable": true
},
"business_country": {
- "$ref": "#/components/schemas/CountryAlpha2"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
},
"business_label": {
"type": "string",
"description": "Business Type of the merchant",
- "example": "travel"
+ "example": "travel",
+ "nullable": true
},
"business_sub_label": {
"type": "string",
@@ -9041,8 +9049,6 @@
"amount",
"currency",
"payment_method",
- "business_country",
- "business_label",
"attempt_count"
],
"properties": {
@@ -9336,11 +9342,17 @@
"nullable": true
},
"business_country": {
- "$ref": "#/components/schemas/CountryAlpha2"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
},
"business_label": {
"type": "string",
- "description": "The business label of merchant for this payment"
+ "description": "The business label of merchant for this payment",
+ "nullable": true
},
"business_sub_label": {
"type": "string",
|
refactor
|
use profile id to find connector (#2020)
|
adcddd643c002a5fe3e7c50c0f78fa5a46f210e7
|
2024-12-22 23:13:11
|
Sayak Bhattacharya
|
feat(connector): [JPMORGAN] add Payment flows for cards (#6668)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 14e624233c3..20ec4157f56 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -6557,6 +6557,7 @@
"helcim",
"iatapay",
"itaubank",
+ "jpmorgan",
"klarna",
"mifinity",
"mollie",
@@ -19423,6 +19424,7 @@
"helcim",
"iatapay",
"itaubank",
+ "jpmorgan",
"klarna",
"mifinity",
"mollie",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index c7527405a5f..2aa19e4e223 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -9276,6 +9276,7 @@
"helcim",
"iatapay",
"itaubank",
+ "jpmorgan",
"klarna",
"mifinity",
"mollie",
@@ -23842,6 +23843,7 @@
"helcim",
"iatapay",
"itaubank",
+ "jpmorgan",
"klarna",
"mifinity",
"mollie",
diff --git a/config/config.example.toml b/config/config.example.toml
index 4d995022645..11e8bed7dac 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -223,6 +223,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url= "https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 56dd0ef7451..7fdc0c6d5e8 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -65,6 +65,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url="https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
@@ -298,6 +299,10 @@ debit.currency = "USD"
ali_pay.currency = "GBP,CNY"
we_chat_pay.currency = "GBP,CNY"
+[pm.filters.jpmorgan]
+debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+
[pm_filters.klarna]
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 464f9bcba32..9c91c12f3b4 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -69,6 +69,7 @@ iatapay.base_url = "https://iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://secure.api.itau/"
jpmorgan.base_url = "https://api-ms.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url="https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.klarna.com/"
mifinity.base_url = "https://secure.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
@@ -332,6 +333,10 @@ debit.currency = "USD"
ali_pay.currency = "GBP,CNY"
we_chat_pay.currency = "GBP,CNY"
+[pm.filters.jpmorgan]
+debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+
[pm_filters.klarna]
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index fb210a28862..152f4f04cd8 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -69,6 +69,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url="https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
@@ -333,6 +334,10 @@ debit.currency = "USD"
ali_pay.currency = "GBP,CNY"
we_chat_pay.currency = "GBP,CNY"
+[pm.filters.jpmorgan]
+debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+
[pm_filters.klarna]
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
diff --git a/config/development.toml b/config/development.toml
index 7008af1f28a..133823d6cb3 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -241,6 +241,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url= "https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
@@ -491,6 +492,10 @@ paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,N
credit = { currency = "USD" }
debit = { currency = "USD" }
+[pm.filters.jpmorgan]
+debit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+credit = { country = "CA, EU, UK, US", currency = "CAD, EUR, GBP, USD" }
+
[pm_filters.klarna]
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,EUR,EUR,CAD,CZK,DKK,EUR,EUR,EUR,EUR,EUR,EUR,EUR,NZD,NOK,PLN,EUR,EUR,SEK,CHF,GBP,USD" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index b861e47e594..1ad2ef91336 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -154,6 +154,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url="https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
diff --git a/crates/api_models/src/connector_enums.rs b/crates/api_models/src/connector_enums.rs
index 0989614c8a0..3a3fe5e8f42 100644
--- a/crates/api_models/src/connector_enums.rs
+++ b/crates/api_models/src/connector_enums.rs
@@ -88,7 +88,7 @@ pub enum Connector {
// Inespay,
Iatapay,
Itaubank,
- //Jpmorgan,
+ Jpmorgan,
Klarna,
Mifinity,
Mollie,
@@ -175,6 +175,7 @@ impl Connector {
(Self::Airwallex, _)
| (Self::Deutschebank, _)
| (Self::Globalpay, _)
+ | (Self::Jpmorgan, _)
| (Self::Paypal, _)
| (Self::Payu, _)
| (Self::Trustpay, PaymentMethod::BankRedirect)
@@ -234,7 +235,7 @@ impl Connector {
| Self::Iatapay
// | Self::Inespay
| Self::Itaubank
- //| Self::Jpmorgan
+ | Self::Jpmorgan
| Self::Klarna
| Self::Mifinity
| Self::Mollie
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 1776ade3666..127d5a9901c 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -83,7 +83,7 @@ pub enum RoutableConnectors {
Iatapay,
// Inespay,
Itaubank,
- //Jpmorgan,
+ Jpmorgan,
Klarna,
Mifinity,
Mollie,
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 1af99f11020..985a6d7b547 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -198,6 +198,7 @@ pub struct ConnectorConfig {
pub gpayments: Option<ConnectorTomlConfig>,
pub helcim: Option<ConnectorTomlConfig>,
// pub inespay: Option<ConnectorTomlConfig>,
+ pub jpmorgan: Option<ConnectorTomlConfig>,
pub klarna: Option<ConnectorTomlConfig>,
pub mifinity: Option<ConnectorTomlConfig>,
pub mollie: Option<ConnectorTomlConfig>,
@@ -370,6 +371,7 @@ impl ConnectorConfig {
Connector::Gpayments => Ok(connector_data.gpayments),
Connector::Helcim => Ok(connector_data.helcim),
// Connector::Inespay => Ok(connector_data.inespay),
+ Connector::Jpmorgan => Ok(connector_data.jpmorgan),
Connector::Klarna => Ok(connector_data.klarna),
Connector::Mifinity => Ok(connector_data.mifinity),
Connector::Mollie => Ok(connector_data.mollie),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index fcf0dca100c..f49f6b311f6 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1731,6 +1731,47 @@ api_key="Client Secret"
api_secret="Certificates"
key2="Certificate Key"
+[jpmorgan]
+[[jpmorgan.credit]]
+ payment_method_type = "American Express"
+[[jpmorgan.credit]]
+ payment_method_type = "ChaseNet"
+[[jpmorgan.credit]]
+ payment_method_type = "Diners Club"
+[[jpmorgan.credit]]
+ payment_method_type = "Discover"
+[[jpmorgan.credit]]
+ payment_method_type = "JCB"
+[[jpmorgan.credit]]
+ payment_method_type = "Mastercard"
+[[jpmorgan.credit]]
+ payment_method_type = "Discover"
+[[jpmorgan.credit]]
+ payment_method_type = "UnionPay"
+[[jpmorgan.credit]]
+ payment_method_type = "Visa"
+ [[jpmorgan.debit]]
+ payment_method_type = "American Express"
+[[jpmorgan.debit]]
+ payment_method_type = "ChaseNet"
+[[jpmorgan.debit]]
+ payment_method_type = "Diners Club"
+[[jpmorgan.debit]]
+ payment_method_type = "Discover"
+[[jpmorgan.debit]]
+ payment_method_type = "JCB"
+[[jpmorgan.debit]]
+ payment_method_type = "Mastercard"
+[[jpmorgan.debit]]
+ payment_method_type = "Discover"
+[[jpmorgan.debit]]
+ payment_method_type = "UnionPay"
+[[jpmorgan.debit]]
+ payment_method_type = "Visa"
+[jpmorgan.connector_auth.BodyKey]
+api_key="Client ID"
+key1="Client Secret"
+
[klarna]
[[klarna.pay_later]]
payment_method_type = "klarna"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 443d3fd72ac..7216d4f7890 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1443,6 +1443,46 @@ api_key="Client Secret"
api_secret="Certificates"
key2="Certificate Key"
+[jpmorgan]
+[[jpmorgan.credit]]
+ payment_method_type = "American Express"
+[[jpmorgan.credit]]
+ payment_method_type = "ChaseNet"
+[[jpmorgan.credit]]
+ payment_method_type = "Diners Club"
+[[jpmorgan.credit]]
+ payment_method_type = "Discover"
+[[jpmorgan.credit]]
+ payment_method_type = "JCB"
+[[jpmorgan.credit]]
+ payment_method_type = "Mastercard"
+[[jpmorgan.credit]]
+ payment_method_type = "Discover"
+[[jpmorgan.credit]]
+ payment_method_type = "UnionPay"
+[[jpmorgan.credit]]
+ payment_method_type = "Visa"
+ [[jpmorgan.debit]]
+ payment_method_type = "American Express"
+[[jpmorgan.debit]]
+ payment_method_type = "ChaseNet"
+[[jpmorgan.debit]]
+ payment_method_type = "Diners Club"
+[[jpmorgan.debit]]
+ payment_method_type = "Discover"
+[[jpmorgan.debit]]
+ payment_method_type = "JCB"
+[[jpmorgan.debit]]
+ payment_method_type = "Mastercard"
+[[jpmorgan.debit]]
+ payment_method_type = "Discover"
+[[jpmorgan.debit]]
+ payment_method_type = "UnionPay"
+[[jpmorgan.debit]]
+ payment_method_type = "Visa"
+[jpmorgan.connector_auth.BodyKey]
+api_key="Access Token"
+
[klarna]
[[klarna.pay_later]]
payment_method_type = "klarna"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 4d3f6ede140..4c6ee7566f3 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1681,6 +1681,46 @@ api_key="Client Secret"
api_secret="Certificates"
key2="Certificate Key"
+[jpmorgan]
+[[jpmorgan.credit]]
+ payment_method_type = "American Express"
+[[jpmorgan.credit]]
+ payment_method_type = "ChaseNet"
+[[jpmorgan.credit]]
+ payment_method_type = "Diners Club"
+[[jpmorgan.credit]]
+ payment_method_type = "Discover"
+[[jpmorgan.credit]]
+ payment_method_type = "JCB"
+[[jpmorgan.credit]]
+ payment_method_type = "Mastercard"
+[[jpmorgan.credit]]
+ payment_method_type = "Discover"
+[[jpmorgan.credit]]
+ payment_method_type = "UnionPay"
+[[jpmorgan.credit]]
+ payment_method_type = "Visa"
+ [[jpmorgan.debit]]
+ payment_method_type = "American Express"
+[[jpmorgan.debit]]
+ payment_method_type = "ChaseNet"
+[[jpmorgan.debit]]
+ payment_method_type = "Diners Club"
+[[jpmorgan.debit]]
+ payment_method_type = "Discover"
+[[jpmorgan.debit]]
+ payment_method_type = "JCB"
+[[jpmorgan.debit]]
+ payment_method_type = "Mastercard"
+[[jpmorgan.debit]]
+ payment_method_type = "Discover"
+[[jpmorgan.debit]]
+ payment_method_type = "UnionPay"
+[[jpmorgan.debit]]
+ payment_method_type = "Visa"
+[jpmorgan.connector_auth.BodyKey]
+api_key="Access Token"
+
[klarna]
[[klarna.pay_later]]
payment_method_type = "klarna"
diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
index 6095a53ad00..9e5a24faab5 100644
--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
@@ -1,14 +1,15 @@
pub mod transformers;
-
+use base64::Engine;
+use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+ types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
- router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_data::{AccessToken, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
@@ -21,33 +22,36 @@ use hyperswitch_domain_models::{
},
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{
- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
- RefundSyncRouterData, RefundsRouterData,
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
-//
use hyperswitch_interfaces::{
api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},
configs::Connectors,
- errors,
+ consts, errors,
events::connector_api_logs::ConnectorEvent,
- types::{self, Response},
+ types::{self, RefreshTokenType, Response},
webhooks,
};
-use masking::{ExposeInterface, Mask};
-use transformers as jpmorgan;
+use masking::{Mask, Maskable, PeekInterface};
+use transformers::{self as jpmorgan, JpmorganErrorResponse};
-use crate::{constants::headers, types::ResponseRouterData, utils};
+use crate::{
+ constants::headers,
+ types::{RefreshTokenRouterData, ResponseRouterData},
+ utils,
+};
#[derive(Clone)]
pub struct Jpmorgan {
- amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+ amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
}
impl Jpmorgan {
pub fn new() -> &'static Self {
&Self {
- amount_converter: &StringMinorUnitForConnector,
+ amount_converter: &MinorUnitForConnector,
}
}
}
@@ -79,14 +83,38 @@ where
&self,
req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
- let mut header = vec![(
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+ let mut headers = 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)
+ let auth_header = (
+ headers::AUTHORIZATION.to_string(),
+ format!(
+ "Bearer {}",
+ req.access_token
+ .clone()
+ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?
+ .token
+ .peek()
+ )
+ .into_masked(),
+ );
+ let request_id = (
+ headers::REQUEST_ID.to_string(),
+ req.connector_request_reference_id
+ .clone()
+ .to_string()
+ .into_masked(),
+ );
+ let merchant_id = (
+ headers::MERCHANT_ID.to_string(),
+ req.merchant_id.get_string_repr().to_string().into_masked(),
+ );
+ headers.push(auth_header);
+ headers.push(request_id);
+ headers.push(merchant_id);
+ Ok(headers)
}
}
@@ -96,11 +124,7 @@ impl ConnectorCommon for Jpmorgan {
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
- api::CurrencyUnit::Base
- //todo!()
- // TODO! Check connector documentation, on which unit they are processing the currency.
- // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
- // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
+ api::CurrencyUnit::Minor
}
fn common_get_content_type(&self) -> &'static str {
@@ -111,36 +135,29 @@ impl ConnectorCommon for Jpmorgan {
connectors.jpmorgan.base_url.as_ref()
}
- fn get_auth_header(
- &self,
- auth_type: &ConnectorAuthType,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
- let auth = jpmorgan::JpmorganAuthType::try_from(auth_type)
- .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
- )])
- }
-
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: jpmorgan::JpmorganErrorResponse = res
+ let response: JpmorganErrorResponse = res
.response
.parse_struct("JpmorganErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+ event_builder.map(|i| i.set_response_body(&response));
+
+ let response_message = response
+ .response_message
+ .as_ref()
+ .map_or_else(|| consts::NO_ERROR_MESSAGE.to_string(), ToString::to_string);
Ok(ErrorResponse {
status_code: res.status_code,
- code: response.code,
- message: response.message,
- reason: response.reason,
+ code: response.response_code,
+ message: response_message.clone(),
+ reason: Some(response_message),
attempt_status: None,
connector_transaction_id: None,
})
@@ -148,14 +165,150 @@ impl ConnectorCommon for Jpmorgan {
}
impl ConnectorValidation for Jpmorgan {
- //TODO: implement functions when support enabled
+ 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 | enums::CaptureMethod::Manual => Ok(()),
+ enums::CaptureMethod::ManualMultiple
+ | enums::CaptureMethod::Scheduled
+ | enums::CaptureMethod::SequentialAutomatic => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Jpmorgan"),
+ ))?
+ }
+ }
+ }
+
+ fn validate_psync_reference_id(
+ &self,
+ data: &PaymentsSyncData,
+ _is_three_ds: bool,
+ _status: enums::AttemptStatus,
+ _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ if data.encoded_data.is_some()
+ || data
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .is_ok()
+ {
+ return Ok(());
+ }
+ Err(errors::ConnectorError::MissingConnectorTransactionID.into())
+ }
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Jpmorgan {
//TODO: implement sessions flow
}
-impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Jpmorgan {}
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Jpmorgan {
+ fn get_headers(
+ &self,
+ req: &RefreshTokenRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+ let client_id = req.request.app_id.clone();
+
+ let client_secret = req.request.id.clone();
+
+ let creds = format!(
+ "{}:{}",
+ client_id.peek(),
+ client_secret.unwrap_or_default().peek()
+ );
+ let encoded_creds = common_utils::consts::BASE64_ENGINE.encode(creds);
+
+ let auth_string = format!("Basic {}", encoded_creds);
+ Ok(vec![
+ (
+ headers::CONTENT_TYPE.to_string(),
+ RefreshTokenType::get_content_type(self).to_string().into(),
+ ),
+ (
+ headers::AUTHORIZATION.to_string(),
+ auth_string.into_masked(),
+ ),
+ ])
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ "application/x-www-form-urlencoded"
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefreshTokenRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!(
+ "{}/am/oauth2/alpha/access_token",
+ connectors
+ .jpmorgan
+ .secondary_base_url
+ .as_ref()
+ .ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?
+ ))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefreshTokenRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = jpmorgan::JpmorganAuthUpdateRequest::try_from(req)?;
+ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefreshTokenRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .attach_default_headers()
+ .headers(RefreshTokenType::get_headers(self, req, connectors)?)
+ .url(&RefreshTokenType::get_url(self, req, connectors)?)
+ .set_body(RefreshTokenType::get_request_body(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefreshTokenRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefreshTokenRouterData, errors::ConnectorError> {
+ let response: jpmorgan::JpmorganAuthUpdateResponse = res
+ .response
+ .parse_struct("jpmorgan JpmorganAuthUpdateResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
for Jpmorgan
@@ -167,7 +320,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -178,9 +331,9 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
- _connectors: &Connectors,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Ok(format!("{}/payments", self.base_url(connectors)))
}
fn get_request_body(
@@ -188,7 +341,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let amount = utils::convert_amount(
+ let amount: MinorUnit = utils::convert_amount(
self.amount_converter,
req.request.minor_amount,
req.request.currency,
@@ -249,12 +402,102 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
}
}
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Jpmorgan {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let tid = req.request.connector_transaction_id.clone();
+ Ok(format!(
+ "{}/payments/{}/captures",
+ self.base_url(connectors),
+ tid
+ ))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount: MinorUnit = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount_to_capture,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = jpmorgan::JpmorganRouterData::from((amount, req));
+ let connector_req = jpmorgan::JpmorganCaptureRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: jpmorgan::JpmorganPaymentsResponse = res
+ .response
+ .parse_struct("Jpmorgan PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Jpmorgan {
fn get_headers(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -264,10 +507,15 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Jpm
fn get_url(
&self,
- _req: &PaymentsSyncRouterData,
- _connectors: &Connectors,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let tid = req
+ .request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
+ Ok(format!("{}/payments/{}", self.base_url(connectors), tid))
}
fn build_request(
@@ -313,12 +561,12 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Jpm
}
}
-impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Jpmorgan {
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Jpmorgan {
fn get_headers(
&self,
- req: &PaymentsCaptureRouterData,
+ req: &PaymentsCancelRouterData,
connectors: &Connectors,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -328,34 +576,41 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
fn get_url(
&self,
- _req: &PaymentsCaptureRouterData,
- _connectors: &Connectors,
+ req: &PaymentsCancelRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let tid = req.request.connector_transaction_id.clone();
+ Ok(format!("{}/payments/{}", self.base_url(connectors), tid))
}
fn get_request_body(
&self,
- _req: &PaymentsCaptureRouterData,
+ req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ let amount: MinorUnit = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount.unwrap_or_default(),
+ req.request.currency.unwrap_or_default(),
+ )?;
+
+ let connector_router_data = jpmorgan::JpmorganRouterData::from((amount, req));
+ let connector_req = jpmorgan::JpmorganCancelRequest::try_from(connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
- req: &PaymentsCaptureRouterData,
+ req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
- .method(Method::Post)
- .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .method(Method::Patch)
+ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
- .headers(types::PaymentsCaptureType::get_headers(
- self, req, connectors,
- )?)
- .set_body(types::PaymentsCaptureType::get_request_body(
+ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+ .set_body(types::PaymentsVoidType::get_request_body(
self, req, connectors,
)?)
.build(),
@@ -364,14 +619,15 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
fn handle_response(
&self,
- data: &PaymentsCaptureRouterData,
+ data: &PaymentsCancelRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
- ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
- let response: jpmorgan::JpmorganPaymentsResponse = res
+ ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
+ let response: jpmorgan::JpmorganCancelResponse = res
.response
- .parse_struct("Jpmorgan PaymentsCaptureResponse")
+ .parse_struct("JpmrorganPaymentsVoidResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
@@ -390,14 +646,12 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
}
}
-impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Jpmorgan {}
-
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Jpmorgan {
fn get_headers(
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
@@ -410,7 +664,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Jpmorga
_req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ Err(errors::ConnectorError::NotImplemented("Refunds".to_string()).into())
}
fn get_request_body(
@@ -434,18 +688,19 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Jpmorga
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- let request = RequestBuilder::new()
- .method(Method::Post)
- .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
- .attach_default_headers()
- .headers(types::RefundExecuteType::get_headers(
- self, req, connectors,
- )?)
- .set_body(types::RefundExecuteType::get_request_body(
- self, req, connectors,
- )?)
- .build();
- Ok(Some(request))
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
}
fn handle_response(
@@ -454,9 +709,9 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Jpmorga
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
- let response: jpmorgan::RefundResponse = res
+ let response: jpmorgan::JpmorganRefundResponse = res
.response
- .parse_struct("jpmorgan RefundResponse")
+ .parse_struct("JpmorganRefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
@@ -481,22 +736,21 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Jpmorgan
&self,
req: &RefundSyncRouterData,
connectors: &Connectors,
- ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
-
fn get_url(
&self,
- _req: &RefundSyncRouterData,
- _connectors: &Connectors,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ let tid = req.request.connector_transaction_id.clone();
+ Ok(format!("{}/refunds/{}", self.base_url(connectors), tid))
}
-
fn build_request(
&self,
req: &RefundSyncRouterData,
@@ -521,7 +775,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Jpmorgan
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
- let response: jpmorgan::RefundResponse = res
+ let response: jpmorgan::JpmorganRefundSyncResponse = res
.response
.parse_struct("jpmorgan RefundSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
index 90b05869705..78c1b5eefb5 100644
--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
@@ -1,12 +1,15 @@
-use common_enums::enums;
-use common_utils::types::StringMinorUnit;
+use common_enums::enums::CaptureMethod;
+use common_utils::types::MinorUnit;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
- router_data::{ConnectorAuthType, RouterData},
+ router_data::{AccessToken, ConnectorAuthType, RouterData},
router_flow_types::refunds::{Execute, RSync},
- router_request_types::ResponseId,
+ router_request_types::{PaymentsCancelData, ResponseId},
router_response_types::{PaymentsResponseData, RefundsResponseData},
- types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+ RefreshTokenRouterData, RefundsRouterData,
+ },
};
use hyperswitch_interfaces::errors;
use masking::Secret;
@@ -14,18 +17,17 @@ use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
- utils::PaymentsAuthorizeRequestData,
+ utils::{
+ get_unimplemented_payment_method_error_message, CardData, RouterData as OtherRouterData,
+ },
};
-
-//TODO: Fill the struct with respective fields
pub struct JpmorganRouterData<T> {
- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: MinorUnit,
pub router_data: T,
}
-impl<T> From<(StringMinorUnit, T)> for JpmorganRouterData<T> {
- fn from((amount, item): (StringMinorUnit, T)) -> Self {
- //Todo : use utils to convert the amount to the type of amount that a connector accepts
+impl<T> From<(MinorUnit, T)> for JpmorganRouterData<T> {
+ fn from((amount, item): (MinorUnit, T)) -> Self {
Self {
amount,
router_data: item,
@@ -33,20 +35,102 @@ impl<T> From<(StringMinorUnit, T)> for JpmorganRouterData<T> {
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, PartialEq)]
+#[derive(Debug, Clone, Serialize)]
+pub struct JpmorganAuthUpdateRequest {
+ pub grant_type: String,
+ pub scope: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct JpmorganAuthUpdateResponse {
+ pub access_token: Secret<String>,
+ pub scope: String,
+ pub token_type: String,
+ pub expires_in: i64,
+}
+
+impl TryFrom<&RefreshTokenRouterData> for JpmorganAuthUpdateRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(_item: &RefreshTokenRouterData) -> Result<Self, Self::Error> {
+ Ok(Self {
+ grant_type: String::from("client_credentials"),
+ scope: String::from("jpm:payments:sandbox"),
+ })
+ }
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, JpmorganAuthUpdateResponse, T, AccessToken>>
+ for RouterData<F, T, AccessToken>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, JpmorganAuthUpdateResponse, T, AccessToken>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(AccessToken {
+ token: item.response.access_token,
+ expires: item.response.expires_in,
+ }),
+ ..item.data
+ })
+ }
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct JpmorganPaymentsRequest {
- amount: StringMinorUnit,
- card: JpmorganCard,
+ capture_method: CapMethod,
+ amount: MinorUnit,
+ currency: common_enums::Currency,
+ merchant: JpmorganMerchant,
+ payment_method_type: JpmorganPaymentMethodType,
}
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct JpmorganCard {
- number: cards::CardNumber,
- expiry_month: Secret<String>,
- expiry_year: Secret<String>,
- cvc: Secret<String>,
- complete: bool,
+ account_number: Secret<String>,
+ expiry: Expiry,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganPaymentMethodType {
+ card: JpmorganCard,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Expiry {
+ month: Secret<String>,
+ year: Secret<String>,
+}
+
+#[derive(Serialize, Debug, Default, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganMerchantSoftware {
+ company_name: Secret<String>,
+ product_name: Secret<String>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganMerchant {
+ merchant_software: JpmorganMerchantSoftware,
+}
+
+fn map_capture_method(
+ capture_method: CaptureMethod,
+) -> Result<CapMethod, error_stack::Report<errors::ConnectorError>> {
+ match capture_method {
+ CaptureMethod::Automatic => Ok(CapMethod::Now),
+ CaptureMethod::Manual => Ok(CapMethod::Manual),
+ CaptureMethod::Scheduled
+ | CaptureMethod::ManualMultiple
+ | CaptureMethod::SequentialAutomatic => {
+ Err(errors::ConnectorError::NotImplemented("Capture Method".to_string()).into())
+ }
+ }
}
impl TryFrom<&JpmorganRouterData<&PaymentsAuthorizeRouterData>> for JpmorganPaymentsRequest {
@@ -56,84 +140,226 @@ impl TryFrom<&JpmorganRouterData<&PaymentsAuthorizeRouterData>> for JpmorganPaym
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::Card(req_card) => {
+ if item.router_data.is_three_ds() {
+ return Err(errors::ConnectorError::NotSupported {
+ message: "3DS payments".to_string(),
+ connector: "Jpmorgan",
+ }
+ .into());
+ }
+
+ let capture_method =
+ map_capture_method(item.router_data.request.capture_method.unwrap_or_default());
+
+ let merchant_software = JpmorganMerchantSoftware {
+ company_name: String::from("JPMC").into(),
+ product_name: String::from("Hyperswitch").into(),
+ };
+
+ let merchant = JpmorganMerchant { merchant_software };
+
+ let expiry: Expiry = Expiry {
+ month: req_card.card_exp_month.clone(),
+ year: req_card.get_expiry_year_4_digit(),
+ };
+
+ let account_number = Secret::new(req_card.card_number.to_string());
+
let card = JpmorganCard {
- 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()?,
+ account_number,
+ expiry,
};
+
+ let payment_method_type = JpmorganPaymentMethodType { card };
+
Ok(Self {
- amount: item.amount.clone(),
- card,
+ capture_method: capture_method?,
+ currency: item.router_data.request.currency,
+ amount: item.amount,
+ merchant,
+ payment_method_type,
})
}
- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ PaymentMethodData::CardDetailsForNetworkTransactionId(_)
+ | PaymentMethodData::CardRedirect(_)
+ | PaymentMethodData::Wallet(_)
+ | PaymentMethodData::PayLater(_)
+ | PaymentMethodData::BankRedirect(_)
+ | PaymentMethodData::BankDebit(_)
+ | PaymentMethodData::BankTransfer(_)
+ | PaymentMethodData::Crypto(_)
+ | PaymentMethodData::MandatePayment
+ | PaymentMethodData::Reward
+ | PaymentMethodData::RealTimePayment(_)
+ | PaymentMethodData::MobilePayment(_)
+ | PaymentMethodData::Upi(_)
+ | PaymentMethodData::Voucher(_)
+ | PaymentMethodData::GiftCard(_)
+ | PaymentMethodData::OpenBanking(_)
+ | PaymentMethodData::CardToken(_)
+ | PaymentMethodData::NetworkToken(_) => Err(errors::ConnectorError::NotImplemented(
+ get_unimplemented_payment_method_error_message("jpmorgan"),
+ )
+ .into()),
}
}
}
-//TODO: Fill the struct with respective fields
-// Auth Struct
+//JP Morgan uses access token only due to which we aren't reading the fields in this struct
+#[derive(Debug)]
pub struct JpmorganAuthType {
- pub(super) api_key: Secret<String>,
+ pub(super) _api_key: Secret<String>,
+ pub(super) _key1: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for JpmorganAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
- ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
- api_key: api_key.to_owned(),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+ _api_key: api_key.to_owned(),
+ _key1: key1.to_owned(),
}),
_ => 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 JpmorganPaymentStatus {
- Succeeded,
- Failed,
- #[default]
- Processing,
+
+#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum JpmorganTransactionStatus {
+ Success,
+ Denied,
+ Error,
}
-impl From<JpmorganPaymentStatus> for common_enums::AttemptStatus {
- fn from(item: JpmorganPaymentStatus) -> Self {
- match item {
- JpmorganPaymentStatus::Succeeded => Self::Charged,
- JpmorganPaymentStatus::Failed => Self::Failure,
- JpmorganPaymentStatus::Processing => Self::Authorizing,
- }
- }
+#[derive(Default, Debug, Serialize, Deserialize, Clone)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum JpmorganTransactionState {
+ Closed,
+ Authorized,
+ Voided,
+ #[default]
+ Pending,
+ Declined,
+ Error,
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[derive(Default, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
pub struct JpmorganPaymentsResponse {
- status: JpmorganPaymentStatus,
- id: String,
+ transaction_id: String,
+ request_id: String,
+ transaction_state: JpmorganTransactionState,
+ response_status: String,
+ response_code: String,
+ response_message: String,
+ payment_method_type: PaymentMethodType,
+ capture_method: Option<CapMethod>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Merchant {
+ merchant_id: Option<String>,
+ merchant_software: MerchantSoftware,
+ merchant_category_code: Option<String>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MerchantSoftware {
+ company_name: Secret<String>,
+ product_name: Secret<String>,
+ version: Option<Secret<String>>,
+}
+
+#[derive(Default, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentMethodType {
+ card: Option<Card>,
+}
+
+#[derive(Default, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Card {
+ expiry: Option<ExpiryResponse>,
+ card_type: Option<Secret<String>>,
+ card_type_name: Option<Secret<String>>,
+ masked_account_number: Option<Secret<String>>,
+ card_type_indicators: Option<CardTypeIndicators>,
+ network_response: Option<NetworkResponse>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NetworkResponse {
+ address_verification_result: Option<Secret<String>>,
+ address_verification_result_code: Option<Secret<String>>,
+ card_verification_result_code: Option<Secret<String>>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ExpiryResponse {
+ month: Option<Secret<i32>>,
+ year: Option<Secret<i32>>,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardTypeIndicators {
+ issuance_country_code: Option<Secret<String>>,
+ is_durbin_regulated: Option<bool>,
+ card_product_types: Secret<Vec<String>>,
+}
+
+pub fn attempt_status_from_transaction_state(
+ transaction_state: JpmorganTransactionState,
+) -> common_enums::AttemptStatus {
+ match transaction_state {
+ JpmorganTransactionState::Authorized => common_enums::AttemptStatus::Authorized,
+ JpmorganTransactionState::Closed => common_enums::AttemptStatus::Charged,
+ JpmorganTransactionState::Declined | JpmorganTransactionState::Error => {
+ common_enums::AttemptStatus::Failure
+ }
+ JpmorganTransactionState::Pending => common_enums::AttemptStatus::Pending,
+ JpmorganTransactionState::Voided => common_enums::AttemptStatus::Voided,
+ }
}
impl<F, T> TryFrom<ResponseRouterData<F, JpmorganPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
+
fn try_from(
item: ResponseRouterData<F, JpmorganPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
+ let transaction_state = match item.response.transaction_state {
+ JpmorganTransactionState::Closed => match item.response.capture_method {
+ Some(CapMethod::Now) => JpmorganTransactionState::Closed,
+ _ => JpmorganTransactionState::Authorized,
+ },
+ JpmorganTransactionState::Authorized => JpmorganTransactionState::Authorized,
+ JpmorganTransactionState::Voided => JpmorganTransactionState::Voided,
+ JpmorganTransactionState::Pending => JpmorganTransactionState::Pending,
+ JpmorganTransactionState::Declined => JpmorganTransactionState::Declined,
+ JpmorganTransactionState::Error => JpmorganTransactionState::Error,
+ };
+ let status = attempt_status_from_transaction_state(transaction_state);
+
Ok(Self {
- status: common_enums::AttemptStatus::from(item.response.status),
+ status,
response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.transaction_id.clone(),
+ ),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(item.response.transaction_id.clone()),
incremental_authorization_allowed: None,
charge_id: None,
}),
@@ -142,24 +368,179 @@ impl<F, T> TryFrom<ResponseRouterData<F, JpmorganPaymentsResponse, T, PaymentsRe
}
}
-//TODO: Fill the struct with respective fields
-// REFUND :
-// Type definition for RefundRequest
-#[derive(Default, Debug, Serialize)]
-pub struct JpmorganRefundRequest {
- pub amount: StringMinorUnit,
+#[derive(Default, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganCaptureRequest {
+ capture_method: Option<CapMethod>,
+ amount: MinorUnit,
+ currency: Option<common_enums::Currency>,
}
-impl<F> TryFrom<&JpmorganRouterData<&RefundsRouterData<F>>> for JpmorganRefundRequest {
+#[derive(Debug, Default, Copy, Serialize, Deserialize, Clone)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum CapMethod {
+ #[default]
+ Now,
+ Delayed,
+ Manual,
+}
+
+impl TryFrom<&JpmorganRouterData<&PaymentsCaptureRouterData>> for JpmorganCaptureRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &JpmorganRouterData<&PaymentsCaptureRouterData>,
+ ) -> Result<Self, Self::Error> {
+ let capture_method = Some(map_capture_method(
+ item.router_data.request.capture_method.unwrap_or_default(),
+ )?);
+ Ok(Self {
+ capture_method,
+ amount: item.amount,
+ currency: Some(item.router_data.request.currency),
+ })
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganCaptureResponse {
+ pub transaction_id: String,
+ pub request_id: String,
+ pub transaction_state: JpmorganTransactionState,
+ pub response_status: JpmorganTransactionStatus,
+ pub response_code: String,
+ pub response_message: String,
+ pub payment_method_type: PaymentMethodTypeCapRes,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PaymentMethodTypeCapRes {
+ pub card: Option<CardCapRes>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardCapRes {
+ pub card_type: Option<Secret<String>>,
+ pub card_type_name: Option<Secret<String>>,
+ unmasked_account_number: Option<Secret<String>>,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, JpmorganCaptureResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, JpmorganCaptureResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let status = attempt_status_from_transaction_state(item.response.transaction_state);
+ Ok(Self {
+ status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.transaction_id.clone()),
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganPSyncResponse {
+ transaction_id: String,
+ transaction_state: JpmorganTransactionState,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "UPPERCASE")]
+pub enum JpmorganResponseStatus {
+ Success,
+ Denied,
+ Error,
+}
+
+impl<F, PaymentsSyncData>
+ TryFrom<ResponseRouterData<F, JpmorganPSyncResponse, PaymentsSyncData, PaymentsResponseData>>
+ for RouterData<F, PaymentsSyncData, PaymentsResponseData>
+{
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &JpmorganRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: ResponseRouterData<F, JpmorganPSyncResponse, PaymentsSyncData, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ let status = attempt_status_from_transaction_state(item.response.transaction_state);
Ok(Self {
- amount: item.amount.to_owned(),
+ status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.transaction_id.clone()),
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
})
}
}
-// Type definition for Refund Response
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct TransactionData {
+ payment_type: Option<Secret<String>>,
+ status_code: Secret<i32>,
+ txn_secret: Option<Secret<String>>,
+ tid: Option<Secret<i64>>,
+ test_mode: Option<Secret<i8>>,
+ status: Option<JpmorganTransactionStatus>,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganRefundRequest {
+ pub merchant: MerchantRefundReq,
+ pub amount: MinorUnit,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MerchantRefundReq {
+ pub merchant_software: MerchantSoftware,
+}
+
+impl<F> TryFrom<&JpmorganRouterData<&RefundsRouterData<F>>> for JpmorganRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(_item: &JpmorganRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Err(errors::ConnectorError::NotImplemented("Refunds".to_string()).into())
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganRefundResponse {
+ pub transaction_id: Option<String>,
+ pub request_id: String,
+ pub transaction_state: JpmorganTransactionState,
+ pub amount: MinorUnit,
+ pub currency: common_enums::Currency,
+ pub response_status: JpmorganResponseStatus,
+ pub response_code: String,
+ pub response_message: String,
+ pub transaction_reference_id: Option<String>,
+ pub remaining_refundable_amount: Option<i64>,
+}
#[allow(dead_code)]
#[derive(Debug, Serialize, Default, Deserialize, Clone)]
@@ -170,59 +551,192 @@ pub enum RefundStatus {
Processing,
}
-impl From<RefundStatus> for enums::RefundStatus {
+impl From<RefundStatus> for common_enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
RefundStatus::Processing => Self::Pending,
- //TODO: Review mapping
}
}
}
-//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
id: String,
status: RefundStatus,
}
-impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+pub fn refund_status_from_transaction_state(
+ transaction_state: JpmorganTransactionState,
+) -> common_enums::RefundStatus {
+ match transaction_state {
+ JpmorganTransactionState::Voided | JpmorganTransactionState::Closed => {
+ common_enums::RefundStatus::Success
+ }
+ JpmorganTransactionState::Declined | JpmorganTransactionState::Error => {
+ common_enums::RefundStatus::Failure
+ }
+ JpmorganTransactionState::Pending | JpmorganTransactionState::Authorized => {
+ common_enums::RefundStatus::Pending
+ }
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, JpmorganRefundResponse>>
+ for RefundsRouterData<Execute>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<Execute, RefundResponse>,
+ item: RefundsResponseRouterData<Execute, JpmorganRefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item
+ .response
+ .transaction_id
+ .clone()
+ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?,
+ refund_status: refund_status_from_transaction_state(
+ item.response.transaction_state,
+ ),
}),
..item.data
})
}
}
-impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganRefundSyncResponse {
+ transaction_id: String,
+ request_id: String,
+ transaction_state: JpmorganTransactionState,
+ amount: MinorUnit,
+ currency: common_enums::Currency,
+ response_status: JpmorganResponseStatus,
+ response_code: String,
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, JpmorganRefundSyncResponse>>
+ for RefundsRouterData<RSync>
+{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: RefundsResponseRouterData<RSync, RefundResponse>,
+ item: RefundsResponseRouterData<RSync, JpmorganRefundSyncResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
- connector_refund_id: item.response.id.to_string(),
- refund_status: enums::RefundStatus::from(item.response.status),
+ connector_refund_id: item.response.transaction_id.clone(),
+ refund_status: refund_status_from_transaction_state(
+ item.response.transaction_state,
+ ),
+ }),
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganCancelRequest {
+ pub amount: Option<i64>,
+ pub is_void: Option<bool>,
+ pub reversal_reason: Option<String>,
+}
+
+impl TryFrom<JpmorganRouterData<&PaymentsCancelRouterData>> for JpmorganCancelRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: JpmorganRouterData<&PaymentsCancelRouterData>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.router_data.request.amount,
+ is_void: Some(true),
+ reversal_reason: item.router_data.request.cancellation_reason.clone(),
+ })
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganCancelResponse {
+ transaction_id: String,
+ request_id: String,
+ response_status: JpmorganResponseStatus,
+ response_code: String,
+ response_message: String,
+ payment_method_type: JpmorganPaymentMethodTypeCancelResponse,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganPaymentMethodTypeCancelResponse {
+ pub card: CardCancelResponse,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CardCancelResponse {
+ pub card_type: Secret<String>,
+ pub card_type_name: Secret<String>,
+}
+
+impl<F>
+ TryFrom<ResponseRouterData<F, JpmorganCancelResponse, PaymentsCancelData, PaymentsResponseData>>
+ for RouterData<F, PaymentsCancelData, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<
+ F,
+ JpmorganCancelResponse,
+ PaymentsCancelData,
+ PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let status = match item.response.response_status {
+ JpmorganResponseStatus::Success => common_enums::AttemptStatus::Voided,
+ JpmorganResponseStatus::Denied | JpmorganResponseStatus::Error => {
+ common_enums::AttemptStatus::Failure
+ }
+ };
+ Ok(Self {
+ status,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(
+ item.response.transaction_id.clone(),
+ ),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.transaction_id.clone()),
+ incremental_authorization_allowed: None,
+ charge_id: None,
}),
..item.data
})
}
}
-//TODO: Fill the struct with respective fields
-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+#[derive(Debug, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganValidationErrors {
+ pub code: Option<String>,
+ pub message: Option<String>,
+ pub entity: Option<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct JpmorganErrorInformation {
+ pub code: Option<String>,
+ pub message: Option<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
pub struct JpmorganErrorResponse {
- pub status_code: u16,
- pub code: String,
- pub message: String,
- pub reason: Option<String>,
+ pub response_status: JpmorganTransactionStatus,
+ pub response_code: String,
+ pub response_message: Option<String>,
}
diff --git a/crates/hyperswitch_connectors/src/constants.rs b/crates/hyperswitch_connectors/src/constants.rs
index 9ca4ee9591f..3d99f8d167f 100644
--- a/crates/hyperswitch_connectors/src/constants.rs
+++ b/crates/hyperswitch_connectors/src/constants.rs
@@ -10,6 +10,7 @@ pub(crate) mod headers {
pub(crate) const IDEMPOTENCY_KEY: &str = "Idempotency-Key";
pub(crate) const MESSAGE_SIGNATURE: &str = "Message-Signature";
pub(crate) const MERCHANT_ID: &str = "Merchant-ID";
+ pub(crate) const REQUEST_ID: &str = "request-id";
pub(crate) const NONCE: &str = "nonce";
pub(crate) const TIMESTAMP: &str = "Timestamp";
pub(crate) const TOKEN: &str = "token";
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 8e6d74c8375..ccb563b0610 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1401,6 +1401,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
itaubank::transformers::ItaubankAuthType::try_from(self.auth_type)?;
Ok(())
}
+ api_enums::Connector::Jpmorgan => {
+ jpmorgan::transformers::JpmorganAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Klarna => {
klarna::transformers::KlarnaAuthType::try_from(self.auth_type)?;
klarna::transformers::KlarnaConnectorMetadataObject::try_from(
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index c39ead5fbce..df5d497ea8f 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -446,9 +446,11 @@ impl ConnectorData {
// Ok(ConnectorEnum::Old(Box::new(connector::Inespay::new())))
// }
enums::Connector::Itaubank => {
- //enums::Connector::Jpmorgan => Ok(ConnectorEnum::Old(Box::new(connector::Jpmorgan))),
Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new())))
}
+ enums::Connector::Jpmorgan => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Jpmorgan::new())))
+ }
enums::Connector::Klarna => {
Ok(ConnectorEnum::Old(Box::new(connector::Klarna::new())))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 1947a2a2dee..1d9a86f0aff 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -256,7 +256,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Iatapay => Self::Iatapay,
// api_enums::Connector::Inespay => Self::Inespay,
api_enums::Connector::Itaubank => Self::Itaubank,
- //api_enums::Connector::Jpmorgan => Self::Jpmorgan,
+ api_enums::Connector::Jpmorgan => Self::Jpmorgan,
api_enums::Connector::Klarna => Self::Klarna,
api_enums::Connector::Mifinity => Self::Mifinity,
api_enums::Connector::Mollie => Self::Mollie,
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index f2f849731d5..10db11bb3b0 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -294,7 +294,8 @@ api_key="API Key"
api_key="API Key"
[jpmorgan]
-api_key="API Key"
+api_key="Client ID"
+key1 ="Client Secret"
[elavon]
api_key="API Key"
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 37cc341c454..7b6a1ba6b7a 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -51,7 +51,7 @@ pub struct ConnectorAuthentication {
pub iatapay: Option<SignatureKey>,
pub inespay: Option<HeaderKey>,
pub itaubank: Option<MultiAuthKey>,
- pub jpmorgan: Option<HeaderKey>,
+ pub jpmorgan: Option<BodyKey>,
pub mifinity: Option<HeaderKey>,
pub mollie: Option<BodyKey>,
pub multisafepay: Option<HeaderKey>,
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js b/cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js
new file mode 100644
index 00000000000..36e53ffd995
--- /dev/null
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js
@@ -0,0 +1,225 @@
+const successfulNo3DSCardDetails = {
+ card_number: "6011016011016011",
+ card_exp_month: "10",
+ card_exp_year: "2027",
+ card_holder_name: "John Doe",
+ card_cvc: "123",
+};
+
+export const connectorDetails = {
+ card_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ "3DSManualCapture": {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS payments is not supported by Jpmorgan",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+
+ "3DSAutoCapture": {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Three_ds payments is not supported by Jpmorgan",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ No3DSManualCapture: {
+ Request: {
+ currency: "USD",
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ No3DSAutoCapture: {
+ Request: {
+ currency: "USD",
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ Capture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ amount: 6500,
+ amount_capturable: 0,
+ amount_received: 6500,
+ },
+ },
+ },
+ PartialCapture: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "partially_captured",
+ amount: 6500,
+ amount_capturable: 0,
+ amount_received: 100,
+ },
+ },
+ },
+ Refund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 501,
+ body: {
+ type: "invalid_request",
+ message: "Refunds is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ manualPaymentRefund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 501,
+ body: {
+ type: "invalid_request",
+ message: "Refunds is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ manualPaymentPartialRefund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 501,
+ body: {
+ type: "invalid_request",
+ message: "Refunds is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ PartialRefund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 501,
+ body: {
+ type: "invalid_request",
+ message: "Refunds is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ SyncRefund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Response: {
+ status: 404,
+ body: {
+ type: "invalid_request",
+ message: "Refund does not exist in our records.",
+ code: "HE_02",
+ },
+ },
+ },
+ },
+};
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js b/cypress-tests/cypress/e2e/PaymentUtils/Utils.js
index e432c37717b..3b4c9e5decf 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Utils.js
@@ -15,6 +15,7 @@ import { connectorDetails as fiservemeaConnectorDetails } from "./Fiservemea.js"
import { connectorDetails as fiuuConnectorDetails } from "./Fiuu.js";
import { connectorDetails as iatapayConnectorDetails } from "./Iatapay.js";
import { connectorDetails as itaubankConnectorDetails } from "./ItauBank.js";
+import { connectorDetails as jpmorganConnectorDetails } from "./Jpmorgan.js";
import { connectorDetails as nexixpayConnectorDetails } from "./Nexixpay.js";
import { connectorDetails as nmiConnectorDetails } from "./Nmi.js";
import { connectorDetails as noonConnectorDetails } from "./Noon.js";
@@ -36,6 +37,7 @@ const connectorDetails = {
fiservemea: fiservemeaConnectorDetails,
iatapay: iatapayConnectorDetails,
itaubank: itaubankConnectorDetails,
+ jpmorgan: jpmorganConnectorDetails,
nexixpay: nexixpayConnectorDetails,
nmi: nmiConnectorDetails,
novalnet: novalnetConnectorDetails,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index f33ab82aa0d..3320a5516d0 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -120,6 +120,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
+jpmorgan.secondary_base_url="https://id.payments.jpmorgan.com"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
mifinity.base_url = "https://demo.mifinity.com/"
mollie.base_url = "https://api.mollie.com/v2/"
|
feat
|
[JPMORGAN] add Payment flows for cards (#6668)
|
7d05b74b950d9e078b063e17d046cbeb501d006a
|
2023-11-17 12:13:59
|
github-actions
|
test(postman): update postman collection files
| false
|
diff --git a/postman/collection-json/checkout.postman_collection.json b/postman/collection-json/checkout.postman_collection.json
index b6532038742..2bd0ac0f26e 100644
--- a/postman/collection-json/checkout.postman_collection.json
+++ b/postman/collection-json/checkout.postman_collection.json
@@ -3802,9 +3802,9 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
@@ -3839,7 +3839,7 @@
" pm.test(",
" \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
" function () {",
- " pm.expect(jsonData.amount_capturable).to.eql(6540);",
+ " pm.expect(jsonData.amount_capturable).to.eql(540);",
" },",
" );",
"}",
@@ -3964,9 +3964,9 @@
"// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
@@ -5929,9 +5929,9 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
@@ -6091,9 +6091,9 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
@@ -6883,9 +6883,9 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
@@ -7045,9 +7045,9 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
@@ -9061,6 +9061,16 @@
" },",
" );",
"}",
+ "",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured_and_capturable\");",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -9195,6 +9205,16 @@
" },",
" );",
"}",
+ "",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured_and_capturable\");",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -9329,6 +9349,16 @@
" },",
" );",
"}",
+ "",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -9916,6 +9946,16 @@
" \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
" );",
"}",
+ "",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'requires_capture'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -10042,7 +10082,16 @@
" },",
" );",
"}",
- ""
+ "",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured_and_capturable\");",
+ " },",
+ " );",
+ "}"
],
"type": "text/javascript"
}
@@ -10142,6 +10191,16 @@
" \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
+ "",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured_and_capturable\");",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -10503,6 +10562,16 @@
" );",
"}",
"",
+ "// Response body should have value \"cancellation succeeded\" for \"payment status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured_and_capturable\");",
+ " },",
+ " );",
+ "}",
+ "",
"// Response body should have value \"connector error\" for \"error type\"",
"if (jsonData?.error?.type) {",
" pm.test(",
@@ -10632,9 +10701,9 @@
"// Response body should have value \"cancellation succeeded\" for \"payment status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
"}",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 5d308dd0fe5..06ccae91b2c 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -7954,9 +7954,9 @@
"// Response body should have value \"6000\" for \"amount_received\"",
"if (jsonData?.amount_received) {",
" pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(6000);",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
" },",
" );",
"}",
@@ -7995,7 +7995,7 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":6000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "raw": "{\"amount_to_capture\":6540,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/capture",
@@ -8116,9 +8116,9 @@
"// Response body should have value \"6000\" for \"amount_received\"",
"if (jsonData?.amount_received) {",
" pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(6000);",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
" },",
" );",
"}",
@@ -8929,6 +8929,398 @@
}
]
},
+ {
+ "name": "Scenario4-Create payment with manual_multiple capture",
+ "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.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_capture\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "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": "Payments - Capture",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/capture - 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/:id/capture - 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.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6000\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(6000);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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_to_capture\":6000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - 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(\"[GET]::/payments/:id - 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.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'partially_captured'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
{
"name": "Scenario1-Create payment with confirm true",
"item": [
@@ -10255,9 +10647,9 @@
"// Response body should have value \"6000\" for \"amount_received\"",
"if (jsonData?.amount_received) {",
" pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(6000);",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
" },",
" );",
"}",
@@ -10286,7 +10678,7 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":6000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "raw": "{\"amount_to_capture\":6540,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/capture",
|
test
|
update postman collection files
|
ca2c399dc903f84468580e90f71129f5fcfc2cd3
|
2023-12-12 15:22:17
|
github-actions
|
chore(version): v1.99.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62ed03591ea..d8d604bc800 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,34 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.99.0 (2023-12-12)
+
+### Features
+
+- **connector:** [Placetopay] Add Connector Template Code ([#3084](https://github.com/juspay/hyperswitch/pull/3084)) ([`a7b688a`](https://github.com/juspay/hyperswitch/commit/a7b688aac72e15f782046b9d108aca12f43a9994))
+- Add utility to convert TOML configuration file to list of environment variables ([#3096](https://github.com/juspay/hyperswitch/pull/3096)) ([`2c4599a`](https://github.com/juspay/hyperswitch/commit/2c4599a1cd7e244b6fb11948c88c55c5b8faad76))
+
+### Bug Fixes
+
+- **router:** Make `request_incremental_authorization` optional in payment_intent ([#3086](https://github.com/juspay/hyperswitch/pull/3086)) ([`f7da59d`](https://github.com/juspay/hyperswitch/commit/f7da59d06af11707e210b58a875c013d31c3ee17))
+
+### Refactors
+
+- **email:** Create client every time of sending email ([#3105](https://github.com/juspay/hyperswitch/pull/3105)) ([`fc2f163`](https://github.com/juspay/hyperswitch/commit/fc2f16392148cd66b3c3e67e3e0c782910e37e1f))
+
+### Testing
+
+- **postman:** Update postman collection files ([`aa97821`](https://github.com/juspay/hyperswitch/commit/aa9782164fb7846fe533c5057a17756dc82ede54))
+
+### Miscellaneous Tasks
+
+- **deps:** Update fred and moka ([#3088](https://github.com/juspay/hyperswitch/pull/3088)) ([`129b1e5`](https://github.com/juspay/hyperswitch/commit/129b1e55bd1cbad0243030fd25379f1400eb170c))
+
+**Full Changelog:** [`v1.98.0...v1.99.0`](https://github.com/juspay/hyperswitch/compare/v1.98.0...v1.99.0)
+
+- - -
+
+
## 1.98.0 (2023-12-11)
### Features
|
chore
|
v1.99.0
|
62c9ccae6ab0d128c54962675b88739ad7797fe6
|
2023-11-16 18:48:42
|
Sai Harsha Vardhan
|
refactor(router): add openapi spec support for gsm apis (#2871)
| false
|
diff --git a/crates/api_models/src/events/gsm.rs b/crates/api_models/src/events/gsm.rs
index d984ae1ff69..a653cc291d6 100644
--- a/crates/api_models/src/events/gsm.rs
+++ b/crates/api_models/src/events/gsm.rs
@@ -31,3 +31,9 @@ impl ApiEventMetric for gsm::GsmDeleteResponse {
Some(ApiEventsType::Gsm)
}
}
+
+impl ApiEventMetric for gsm::GsmResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Gsm)
+ }
+}
diff --git a/crates/api_models/src/gsm.rs b/crates/api_models/src/gsm.rs
index 6bd8fd99dd9..254981b1f8f 100644
--- a/crates/api_models/src/gsm.rs
+++ b/crates/api_models/src/gsm.rs
@@ -1,8 +1,10 @@
-use crate::enums;
+use utoipa::ToSchema;
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
+use crate::enums::Connector;
+
+#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GsmCreateRequest {
- pub connector: enums::Connector,
+ pub connector: Connector,
pub flow: String,
pub sub_flow: String,
pub code: String,
@@ -13,9 +15,9 @@ pub struct GsmCreateRequest {
pub step_up_possible: bool,
}
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GsmRetrieveRequest {
- pub connector: enums::Connector,
+ pub connector: Connector,
pub flow: String,
pub sub_flow: String,
pub code: String,
@@ -33,6 +35,7 @@ pub struct GsmRetrieveRequest {
serde::Serialize,
serde::Deserialize,
strum::EnumString,
+ ToSchema,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -43,7 +46,7 @@ pub enum GsmDecision {
DoDefault,
}
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GsmUpdateRequest {
pub connector: String,
pub flow: String,
@@ -56,7 +59,7 @@ pub struct GsmUpdateRequest {
pub step_up_possible: Option<bool>,
}
-#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GsmDeleteRequest {
pub connector: String,
pub flow: String,
@@ -65,7 +68,7 @@ pub struct GsmDeleteRequest {
pub message: String,
}
-#[derive(Debug, serde::Serialize)]
+#[derive(Debug, serde::Serialize, ToSchema)]
pub struct GsmDeleteResponse {
pub gsm_rule_delete: bool,
pub connector: String,
@@ -73,3 +76,16 @@ pub struct GsmDeleteResponse {
pub sub_flow: String,
pub code: String,
}
+
+#[derive(serde::Serialize, Debug, ToSchema)]
+pub struct GsmResponse {
+ pub connector: String,
+ pub flow: String,
+ pub sub_flow: String,
+ pub code: String,
+ pub message: String,
+ pub status: String,
+ pub router_error: Option<String>,
+ pub decision: String,
+ pub step_up_possible: bool,
+}
diff --git a/crates/router/src/core/gsm.rs b/crates/router/src/core/gsm.rs
index d2586067457..ed72275a73a 100644
--- a/crates/router/src/core/gsm.rs
+++ b/crates/router/src/core/gsm.rs
@@ -10,7 +10,7 @@ use crate::{
},
db::gsm::GsmInterface,
services,
- types::{self, transformers::ForeignInto},
+ types::transformers::ForeignInto,
AppState,
};
@@ -18,21 +18,21 @@ use crate::{
pub async fn create_gsm_rule(
state: AppState,
gsm_rule: gsm_api_types::GsmCreateRequest,
-) -> RouterResponse<types::GsmResponse> {
+) -> RouterResponse<gsm_api_types::GsmResponse> {
let db = state.store.as_ref();
GsmInterface::add_gsm_rule(db, gsm_rule.foreign_into())
.await
.to_duplicate_response(errors::ApiErrorResponse::GenericDuplicateError {
message: "GSM with given key already exists in our records".to_string(),
})
- .map(services::ApplicationResponse::Json)
+ .map(|gsm| services::ApplicationResponse::Json(gsm.foreign_into()))
}
#[instrument(skip_all)]
pub async fn retrieve_gsm_rule(
state: AppState,
gsm_request: gsm_api_types::GsmRetrieveRequest,
-) -> RouterResponse<types::GsmResponse> {
+) -> RouterResponse<gsm_api_types::GsmResponse> {
let db = state.store.as_ref();
let gsm_api_types::GsmRetrieveRequest {
connector,
@@ -46,14 +46,14 @@ pub async fn retrieve_gsm_rule(
.to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
message: "GSM with given key does not exist in our records".to_string(),
})
- .map(services::ApplicationResponse::Json)
+ .map(|gsm| services::ApplicationResponse::Json(gsm.foreign_into()))
}
#[instrument(skip_all)]
pub async fn update_gsm_rule(
state: AppState,
gsm_request: gsm_api_types::GsmUpdateRequest,
-) -> RouterResponse<types::GsmResponse> {
+) -> RouterResponse<gsm_api_types::GsmResponse> {
let db = state.store.as_ref();
let gsm_api_types::GsmUpdateRequest {
connector,
@@ -85,7 +85,7 @@ pub async fn update_gsm_rule(
message: "GSM with given key does not exist in our records".to_string(),
})
.attach_printable("Failed while updating Gsm rule")
- .map(services::ApplicationResponse::Json)
+ .map(|gsm| services::ApplicationResponse::Json(gsm.foreign_into()))
}
#[instrument(skip_all)]
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index dbcd8cbe4ce..095e1f45f93 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -114,7 +114,11 @@ Never share your secret api keys. Keep them guarded and secure.
crate::routes::payouts::payouts_fulfill,
crate::routes::payouts::payouts_retrieve,
crate::routes::payouts::payouts_update,
- crate::routes::payment_link::payment_link_retrieve
+ crate::routes::payment_link::payment_link_retrieve,
+ crate::routes::gsm::create_gsm_rule,
+ crate::routes::gsm::get_gsm_rule,
+ crate::routes::gsm::update_gsm_rule,
+ crate::routes::gsm::delete_gsm_rule,
),
components(schemas(
crate::types::api::refunds::RefundRequest,
@@ -184,6 +188,13 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::PaymentLinkColorSchema,
api_models::disputes::DisputeResponse,
api_models::disputes::DisputeResponsePaymentsRetrieve,
+ api_models::gsm::GsmCreateRequest,
+ api_models::gsm::GsmRetrieveRequest,
+ api_models::gsm::GsmUpdateRequest,
+ api_models::gsm::GsmDeleteRequest,
+ api_models::gsm::GsmDeleteResponse,
+ api_models::gsm::GsmResponse,
+ api_models::gsm::GsmDecision,
api_models::payments::AddressDetails,
api_models::payments::BankDebitData,
api_models::payments::AliPayQr,
diff --git a/crates/router/src/routes/gsm.rs b/crates/router/src/routes/gsm.rs
index 02d943792db..ff70635959f 100644
--- a/crates/router/src/routes/gsm.rs
+++ b/crates/router/src/routes/gsm.rs
@@ -8,6 +8,23 @@ use crate::{
services::{api, authentication as auth},
};
+/// Gsm - Create
+///
+/// To create a Gsm Rule
+#[utoipa::path(
+ post,
+ path = "/gsm",
+ request_body(
+ content = GsmCreateRequest,
+ ),
+ responses(
+ (status = 200, description = "Gsm created", body = GsmResponse),
+ (status = 400, description = "Missing Mandatory fields")
+ ),
+ tag = "Gsm",
+ operation_id = "Create Gsm Rule",
+ security(("admin_api_key" = [])),
+)]
#[instrument(skip_all, fields(flow = ?Flow::GsmRuleCreate))]
pub async fn create_gsm_rule(
state: web::Data<AppState>,
@@ -29,6 +46,23 @@ pub async fn create_gsm_rule(
.await
}
+/// Gsm - Get
+///
+/// To get a Gsm Rule
+#[utoipa::path(
+ post,
+ path = "/gsm/get",
+ request_body(
+ content = GsmRetrieveRequest,
+ ),
+ responses(
+ (status = 200, description = "Gsm retrieved", body = GsmResponse),
+ (status = 400, description = "Missing Mandatory fields")
+ ),
+ tag = "Gsm",
+ operation_id = "Retrieve Gsm Rule",
+ security(("admin_api_key" = [])),
+)]
#[instrument(skip_all, fields(flow = ?Flow::GsmRuleRetrieve))]
pub async fn get_gsm_rule(
state: web::Data<AppState>,
@@ -49,6 +83,23 @@ pub async fn get_gsm_rule(
.await
}
+/// Gsm - Update
+///
+/// To update a Gsm Rule
+#[utoipa::path(
+ post,
+ path = "/gsm/update",
+ request_body(
+ content = GsmUpdateRequest,
+ ),
+ responses(
+ (status = 200, description = "Gsm updated", body = GsmResponse),
+ (status = 400, description = "Missing Mandatory fields")
+ ),
+ tag = "Gsm",
+ operation_id = "Update Gsm Rule",
+ security(("admin_api_key" = [])),
+)]
#[instrument(skip_all, fields(flow = ?Flow::GsmRuleUpdate))]
pub async fn update_gsm_rule(
state: web::Data<AppState>,
@@ -70,6 +121,23 @@ pub async fn update_gsm_rule(
.await
}
+/// Gsm - Delete
+///
+/// To delete a Gsm Rule
+#[utoipa::path(
+ post,
+ path = "/gsm/delete",
+ request_body(
+ content = GsmDeleteRequest,
+ ),
+ responses(
+ (status = 200, description = "Gsm deleted", body = GsmDeleteResponse),
+ (status = 400, description = "Missing Mandatory fields")
+ ),
+ tag = "Gsm",
+ operation_id = "Delete Gsm Rule",
+ security(("admin_api_key" = [])),
+)]
#[instrument(skip_all, fields(flow = ?Flow::GsmRuleDelete))]
pub async fn delete_gsm_rule(
state: web::Data<AppState>,
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 7e9725d1a3b..7cf8f6b71fa 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -1213,5 +1213,3 @@ impl<F1, F2>
}
}
}
-
-pub type GsmResponse = storage::GatewayStatusMap;
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 1cd016de18e..69ce2df974f 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1047,3 +1047,19 @@ impl ForeignFrom<gsm_api_types::GsmCreateRequest> for storage::GatewayStatusMapp
}
}
}
+
+impl ForeignFrom<storage::GatewayStatusMap> for gsm_api_types::GsmResponse {
+ fn foreign_from(value: storage::GatewayStatusMap) -> Self {
+ Self {
+ connector: value.connector.to_string(),
+ flow: value.flow,
+ sub_flow: value.sub_flow,
+ code: value.code,
+ message: value.message,
+ decision: value.decision.to_string(),
+ status: value.status,
+ router_error: value.router_error,
+ step_up_possible: value.step_up_possible,
+ }
+ }
+}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 23f8f1b3628..c576c6c8a99 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -745,6 +745,166 @@
]
}
},
+ "/gsm": {
+ "post": {
+ "tags": [
+ "Gsm"
+ ],
+ "summary": "Gsm - Create",
+ "description": "Gsm - Create\n\nTo create a Gsm Rule",
+ "operationId": "Create Gsm Rule",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmCreateRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Gsm created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Missing Mandatory fields"
+ }
+ },
+ "security": [
+ {
+ "admin_api_key": []
+ }
+ ]
+ }
+ },
+ "/gsm/delete": {
+ "post": {
+ "tags": [
+ "Gsm"
+ ],
+ "summary": "Gsm - Delete",
+ "description": "Gsm - Delete\n\nTo delete a Gsm Rule",
+ "operationId": "Delete Gsm Rule",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmDeleteRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Gsm deleted",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmDeleteResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Missing Mandatory fields"
+ }
+ },
+ "security": [
+ {
+ "admin_api_key": []
+ }
+ ]
+ }
+ },
+ "/gsm/get": {
+ "post": {
+ "tags": [
+ "Gsm"
+ ],
+ "summary": "Gsm - Get",
+ "description": "Gsm - Get\n\nTo get a Gsm Rule",
+ "operationId": "Retrieve Gsm Rule",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmRetrieveRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Gsm retrieved",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Missing Mandatory fields"
+ }
+ },
+ "security": [
+ {
+ "admin_api_key": []
+ }
+ ]
+ }
+ },
+ "/gsm/update": {
+ "post": {
+ "tags": [
+ "Gsm"
+ ],
+ "summary": "Gsm - Update",
+ "description": "Gsm - Update\n\nTo update a Gsm Rule",
+ "operationId": "Update Gsm Rule",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmUpdateRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Gsm updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GsmResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Missing Mandatory fields"
+ }
+ },
+ "security": [
+ {
+ "admin_api_key": []
+ }
+ ]
+ }
+ },
"/mandates/revoke/{mandate_id}": {
"post": {
"tags": [
@@ -5713,6 +5873,228 @@
}
}
},
+ "GsmCreateRequest": {
+ "type": "object",
+ "required": [
+ "connector",
+ "flow",
+ "sub_flow",
+ "code",
+ "message",
+ "status",
+ "decision",
+ "step_up_possible"
+ ],
+ "properties": {
+ "connector": {
+ "$ref": "#/components/schemas/Connector"
+ },
+ "flow": {
+ "type": "string"
+ },
+ "sub_flow": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "router_error": {
+ "type": "string",
+ "nullable": true
+ },
+ "decision": {
+ "$ref": "#/components/schemas/GsmDecision"
+ },
+ "step_up_possible": {
+ "type": "boolean"
+ }
+ }
+ },
+ "GsmDecision": {
+ "type": "string",
+ "enum": [
+ "retry",
+ "requeue",
+ "do_default"
+ ]
+ },
+ "GsmDeleteRequest": {
+ "type": "object",
+ "required": [
+ "connector",
+ "flow",
+ "sub_flow",
+ "code",
+ "message"
+ ],
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "flow": {
+ "type": "string"
+ },
+ "sub_flow": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ },
+ "GsmDeleteResponse": {
+ "type": "object",
+ "required": [
+ "gsm_rule_delete",
+ "connector",
+ "flow",
+ "sub_flow",
+ "code"
+ ],
+ "properties": {
+ "gsm_rule_delete": {
+ "type": "boolean"
+ },
+ "connector": {
+ "type": "string"
+ },
+ "flow": {
+ "type": "string"
+ },
+ "sub_flow": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ }
+ }
+ },
+ "GsmResponse": {
+ "type": "object",
+ "required": [
+ "connector",
+ "flow",
+ "sub_flow",
+ "code",
+ "message",
+ "status",
+ "decision",
+ "step_up_possible"
+ ],
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "flow": {
+ "type": "string"
+ },
+ "sub_flow": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "router_error": {
+ "type": "string",
+ "nullable": true
+ },
+ "decision": {
+ "type": "string"
+ },
+ "step_up_possible": {
+ "type": "boolean"
+ }
+ }
+ },
+ "GsmRetrieveRequest": {
+ "type": "object",
+ "required": [
+ "connector",
+ "flow",
+ "sub_flow",
+ "code",
+ "message"
+ ],
+ "properties": {
+ "connector": {
+ "$ref": "#/components/schemas/Connector"
+ },
+ "flow": {
+ "type": "string"
+ },
+ "sub_flow": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ },
+ "GsmUpdateRequest": {
+ "type": "object",
+ "required": [
+ "connector",
+ "flow",
+ "sub_flow",
+ "code",
+ "message"
+ ],
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "flow": {
+ "type": "string"
+ },
+ "sub_flow": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string",
+ "nullable": true
+ },
+ "router_error": {
+ "type": "string",
+ "nullable": true
+ },
+ "decision": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/GsmDecision"
+ }
+ ],
+ "nullable": true
+ },
+ "step_up_possible": {
+ "type": "boolean",
+ "nullable": true
+ }
+ }
+ },
"IndomaretVoucherData": {
"type": "object",
"required": [
|
refactor
|
add openapi spec support for gsm apis (#2871)
|
7516a16763877c03ecc35fda19388bbd021c5cc7
|
2024-01-18 20:18:44
|
Rachit Naithani
|
feat(users): Added get role from jwt api (#3385)
| false
|
diff --git a/crates/api_models/src/user_role.rs b/crates/api_models/src/user_role.rs
index 72fca2b2f08..b057f8ca8bc 100644
--- a/crates/api_models/src/user_role.rs
+++ b/crates/api_models/src/user_role.rs
@@ -43,6 +43,7 @@ pub enum Permission {
SurchargeDecisionManagerRead,
UsersRead,
UsersWrite,
+ MerchantAccountCreate,
}
#[derive(Debug, serde::Serialize)]
@@ -60,6 +61,7 @@ pub enum PermissionModule {
Files,
ThreeDsDecisionManager,
SurchargeDecisionManager,
+ AccountCreate,
}
#[derive(Debug, serde::Serialize)]
diff --git a/crates/router/src/core/user_role.rs b/crates/router/src/core/user_role.rs
index 2b7752d1904..d8ff836e1f8 100644
--- a/crates/router/src/core/user_role.rs
+++ b/crates/router/src/core/user_role.rs
@@ -20,7 +20,7 @@ pub async fn get_authorization_info(
user_role_api::AuthorizationInfoResponse(
info::get_authorization_info()
.into_iter()
- .filter_map(|module| module.try_into().ok())
+ .map(Into::into)
.collect(),
),
))
@@ -63,6 +63,22 @@ pub async fn get_role(
Ok(ApplicationResponse::Json(info))
}
+pub async fn get_role_from_token(
+ _state: AppState,
+ user: auth::UserFromToken,
+) -> UserResponse<Vec<user_role_api::Permission>> {
+ Ok(ApplicationResponse::Json(
+ predefined_permissions::PREDEFINED_PERMISSIONS
+ .get(user.role_id.as_str())
+ .ok_or(UserErrors::InternalServerError.into())
+ .attach_printable("Invalid Role Id in JWT")?
+ .get_permissions()
+ .iter()
+ .map(|&per| per.into())
+ .collect(),
+ ))
+}
+
pub async fn update_user_role(
state: AppState,
user_from_token: auth::UserFromToken,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0807fb0800e..3d63df2fe80 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -919,6 +919,7 @@ impl User {
.service(web::resource("/permission_info").route(web::get().to(get_authorization_info)))
.service(web::resource("/user/update_role").route(web::post().to(update_user_role)))
.service(web::resource("/role/list").route(web::get().to(list_roles)))
+ .service(web::resource("/role").route(web::get().to(get_role_from_token)))
.service(web::resource("/role/{role_id}").route(web::get().to(get_role)))
.service(web::resource("/user/invite").route(web::post().to(invite_user)))
.service(web::resource("/update").route(web::post().to(update_user_account_details)))
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 805fb115264..d3a2e1af9a7 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -181,9 +181,11 @@ impl From<Flow> for ApiIdentifier {
| Flow::VerifyEmailRequest
| Flow::UpdateUserAccountDetails => Self::User,
- Flow::ListRoles | Flow::GetRole | Flow::UpdateUserRole | Flow::GetAuthorizationInfo => {
- Self::UserRole
- }
+ Flow::ListRoles
+ | Flow::GetRole
+ | Flow::GetRoleFromToken
+ | Flow::UpdateUserRole
+ | Flow::GetAuthorizationInfo => Self::UserRole,
Flow::GetActionUrl | Flow::SyncOnboardingStatus | Flow::ResetTrackingId => {
Self::ConnectorOnboarding
diff --git a/crates/router/src/routes/user_role.rs b/crates/router/src/routes/user_role.rs
index c96e099ab16..fe305942d03 100644
--- a/crates/router/src/routes/user_role.rs
+++ b/crates/router/src/routes/user_role.rs
@@ -7,7 +7,7 @@ use crate::{
core::{api_locking, user_role as user_role_core},
services::{
api,
- authentication::{self as auth},
+ authentication::{self as auth, UserFromToken},
authorization::permissions::Permission,
},
};
@@ -64,6 +64,20 @@ pub async fn get_role(
.await
}
+pub async fn get_role_from_token(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
+ let flow = Flow::GetRoleFromToken;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ (),
+ |state, user: UserFromToken, _| user_role_core::get_role_from_token(state, user),
+ &auth::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
pub async fn update_user_role(
state: web::Data<AppState>,
req: HttpRequest,
diff --git a/crates/router/src/services/authorization/info.rs b/crates/router/src/services/authorization/info.rs
index cef93f82739..99e4f1b6c09 100644
--- a/crates/router/src/services/authorization/info.rs
+++ b/crates/router/src/services/authorization/info.rs
@@ -15,16 +15,13 @@ pub struct PermissionInfo {
impl PermissionInfo {
pub fn new(permissions: &[Permission]) -> Vec<Self> {
- let mut permission_infos = Vec::with_capacity(permissions.len());
- for permission in permissions {
- if let Some(description) = Permission::get_permission_description(permission) {
- permission_infos.push(Self {
- enum_name: permission.clone(),
- description,
- })
- }
- }
- permission_infos
+ permissions
+ .iter()
+ .map(|&per| Self {
+ description: Permission::get_permission_description(&per),
+ enum_name: per,
+ })
+ .collect()
}
}
@@ -43,6 +40,7 @@ pub enum PermissionModule {
Files,
ThreeDsDecisionManager,
SurchargeDecisionManager,
+ AccountCreate,
}
impl PermissionModule {
@@ -60,7 +58,8 @@ impl PermissionModule {
Self::Disputes => "Everything related to disputes - like creating and viewing dispute related information are within this module",
Self::Files => "Permissions for uploading, deleting and viewing files for disputes",
Self::ThreeDsDecisionManager => "View and configure 3DS decision rules configured for a merchant",
- Self::SurchargeDecisionManager =>"View and configure surcharge decision rules configured for a merchant"
+ Self::SurchargeDecisionManager =>"View and configure surcharge decision rules configured for a merchant",
+ Self::AccountCreate => "Create new account within your organization"
}
}
}
@@ -173,6 +172,11 @@ impl ModuleInfo {
Permission::SurchargeDecisionManagerRead,
]),
},
+ PermissionModule::AccountCreate => Self {
+ module: module_name,
+ description,
+ permissions: PermissionInfo::new(&[Permission::MerchantAccountCreate]),
+ },
}
}
}
diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rs
index 426b048e88b..5c5e3ecce30 100644
--- a/crates/router/src/services/authorization/permissions.rs
+++ b/crates/router/src/services/authorization/permissions.rs
@@ -1,6 +1,6 @@
use strum::Display;
-#[derive(PartialEq, Display, Clone, Debug)]
+#[derive(PartialEq, Display, Clone, Debug, Copy)]
pub enum Permission {
PaymentRead,
PaymentWrite,
@@ -34,45 +34,43 @@ pub enum Permission {
}
impl Permission {
- pub fn get_permission_description(&self) -> Option<&'static str> {
+ pub fn get_permission_description(&self) -> &'static str {
match self {
- Self::PaymentRead => Some("View all payments"),
- Self::PaymentWrite => Some("Create payment, download payments data"),
- Self::RefundRead => Some("View all refunds"),
- Self::RefundWrite => Some("Create refund, download refunds data"),
- Self::ApiKeyRead => Some("View API keys (masked generated for the system"),
- Self::ApiKeyWrite => Some("Create and update API keys"),
- Self::MerchantAccountRead => Some("View merchant account details"),
+ Self::PaymentRead => "View all payments",
+ Self::PaymentWrite => "Create payment, download payments data",
+ Self::RefundRead => "View all refunds",
+ Self::RefundWrite => "Create refund, download refunds data",
+ Self::ApiKeyRead => "View API keys (masked generated for the system",
+ Self::ApiKeyWrite => "Create and update API keys",
+ Self::MerchantAccountRead => "View merchant account details",
Self::MerchantAccountWrite => {
- Some("Update merchant account details, configure webhooks, manage api keys")
+ "Update merchant account details, configure webhooks, manage api keys"
}
- Self::MerchantConnectorAccountRead => Some("View connectors configured"),
+ Self::MerchantConnectorAccountRead => "View connectors configured",
Self::MerchantConnectorAccountWrite => {
- Some("Create, update, verify and delete connector configurations")
+ "Create, update, verify and delete connector configurations"
}
- Self::ForexRead => Some("Query Forex data"),
- Self::RoutingRead => Some("View routing configuration"),
- Self::RoutingWrite => Some("Create and activate routing configurations"),
- Self::DisputeRead => Some("View disputes"),
- Self::DisputeWrite => Some("Create and update disputes"),
- Self::MandateRead => Some("View mandates"),
- Self::MandateWrite => Some("Create and update mandates"),
- Self::CustomerRead => Some("View customers"),
- Self::CustomerWrite => Some("Create, update and delete customers"),
- Self::FileRead => Some("View files"),
- Self::FileWrite => Some("Create, update and delete files"),
- Self::Analytics => Some("Access to analytics module"),
- Self::ThreeDsDecisionManagerWrite => Some("Create and update 3DS decision rules"),
+ Self::ForexRead => "Query Forex data",
+ Self::RoutingRead => "View routing configuration",
+ Self::RoutingWrite => "Create and activate routing configurations",
+ Self::DisputeRead => "View disputes",
+ Self::DisputeWrite => "Create and update disputes",
+ Self::MandateRead => "View mandates",
+ Self::MandateWrite => "Create and update mandates",
+ Self::CustomerRead => "View customers",
+ Self::CustomerWrite => "Create, update and delete customers",
+ Self::FileRead => "View files",
+ Self::FileWrite => "Create, update and delete files",
+ Self::Analytics => "Access to analytics module",
+ Self::ThreeDsDecisionManagerWrite => "Create and update 3DS decision rules",
Self::ThreeDsDecisionManagerRead => {
- Some("View all 3DS decision rules configured for a merchant")
+ "View all 3DS decision rules configured for a merchant"
}
- Self::SurchargeDecisionManagerWrite => {
- Some("Create and update the surcharge decision rules")
- }
- Self::SurchargeDecisionManagerRead => Some("View all the surcharge decision rules"),
- Self::UsersRead => Some("View all the users for a merchant"),
- Self::UsersWrite => Some("Invite users, assign and update roles"),
- Self::MerchantAccountCreate => None,
+ Self::SurchargeDecisionManagerWrite => "Create and update the surcharge decision rules",
+ Self::SurchargeDecisionManagerRead => "View all the surcharge decision rules",
+ Self::UsersRead => "View all the users for a merchant",
+ Self::UsersWrite => "Invite users, assign and update roles",
+ Self::MerchantAccountCreate => "Create merchant account",
}
}
}
diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs
index d271ed5e29d..53c88f8aea1 100644
--- a/crates/router/src/types/domain/user.rs
+++ b/crates/router/src/types/domain/user.rs
@@ -762,19 +762,13 @@ impl UserFromStorage {
}
}
-impl TryFrom<info::ModuleInfo> for user_role_api::ModuleInfo {
- type Error = ();
- fn try_from(value: info::ModuleInfo) -> Result<Self, Self::Error> {
- let mut permissions = Vec::with_capacity(value.permissions.len());
- for permission in value.permissions {
- let permission = permission.try_into()?;
- permissions.push(permission);
- }
- Ok(Self {
+impl From<info::ModuleInfo> for user_role_api::ModuleInfo {
+ fn from(value: info::ModuleInfo) -> Self {
+ Self {
module: value.module.into(),
description: value.description,
- permissions,
- })
+ permissions: value.permissions.into_iter().map(Into::into).collect(),
+ }
}
}
@@ -794,18 +788,17 @@ impl From<info::PermissionModule> for user_role_api::PermissionModule {
info::PermissionModule::Files => Self::Files,
info::PermissionModule::ThreeDsDecisionManager => Self::ThreeDsDecisionManager,
info::PermissionModule::SurchargeDecisionManager => Self::SurchargeDecisionManager,
+ info::PermissionModule::AccountCreate => Self::AccountCreate,
}
}
}
-impl TryFrom<info::PermissionInfo> for user_role_api::PermissionInfo {
- type Error = ();
- fn try_from(value: info::PermissionInfo) -> Result<Self, Self::Error> {
- let enum_name = (&value.enum_name).try_into()?;
- Ok(Self {
- enum_name,
+impl From<info::PermissionInfo> for user_role_api::PermissionInfo {
+ fn from(value: info::PermissionInfo) -> Self {
+ Self {
+ enum_name: value.enum_name.into(),
description: value.description,
- })
+ }
}
}
diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs
index c474a82981b..65ead92ad34 100644
--- a/crates/router/src/utils/user_role.rs
+++ b/crates/router/src/utils/user_role.rs
@@ -1,7 +1,6 @@
use api_models::user_role as user_role_api;
use diesel_models::enums::UserStatus;
use error_stack::ResultExt;
-use router_env::logger;
use crate::{
consts,
@@ -44,52 +43,50 @@ pub fn validate_role_id(role_id: &str) -> UserResult<()> {
pub fn get_role_name_and_permission_response(
role_info: &RoleInfo,
) -> Option<(Vec<user_role_api::Permission>, &'static str)> {
- role_info
- .get_permissions()
- .iter()
- .map(TryInto::try_into)
- .collect::<Result<Vec<user_role_api::Permission>, _>>()
- .ok()
- .zip(role_info.get_name())
+ role_info.get_name().map(|name| {
+ (
+ role_info
+ .get_permissions()
+ .iter()
+ .map(|&per| per.into())
+ .collect::<Vec<user_role_api::Permission>>(),
+ name,
+ )
+ })
}
-impl TryFrom<&Permission> for user_role_api::Permission {
- type Error = ();
- fn try_from(value: &Permission) -> Result<Self, Self::Error> {
+impl From<Permission> for user_role_api::Permission {
+ fn from(value: Permission) -> Self {
match value {
- Permission::PaymentRead => Ok(Self::PaymentRead),
- Permission::PaymentWrite => Ok(Self::PaymentWrite),
- Permission::RefundRead => Ok(Self::RefundRead),
- Permission::RefundWrite => Ok(Self::RefundWrite),
- Permission::ApiKeyRead => Ok(Self::ApiKeyRead),
- Permission::ApiKeyWrite => Ok(Self::ApiKeyWrite),
- Permission::MerchantAccountRead => Ok(Self::MerchantAccountRead),
- Permission::MerchantAccountWrite => Ok(Self::MerchantAccountWrite),
- Permission::MerchantConnectorAccountRead => Ok(Self::MerchantConnectorAccountRead),
- Permission::MerchantConnectorAccountWrite => Ok(Self::MerchantConnectorAccountWrite),
- Permission::ForexRead => Ok(Self::ForexRead),
- Permission::RoutingRead => Ok(Self::RoutingRead),
- Permission::RoutingWrite => Ok(Self::RoutingWrite),
- Permission::DisputeRead => Ok(Self::DisputeRead),
- Permission::DisputeWrite => Ok(Self::DisputeWrite),
- Permission::MandateRead => Ok(Self::MandateRead),
- Permission::MandateWrite => Ok(Self::MandateWrite),
- Permission::CustomerRead => Ok(Self::CustomerRead),
- Permission::CustomerWrite => Ok(Self::CustomerWrite),
- Permission::FileRead => Ok(Self::FileRead),
- Permission::FileWrite => Ok(Self::FileWrite),
- Permission::Analytics => Ok(Self::Analytics),
- Permission::ThreeDsDecisionManagerWrite => Ok(Self::ThreeDsDecisionManagerWrite),
- Permission::ThreeDsDecisionManagerRead => Ok(Self::ThreeDsDecisionManagerRead),
- Permission::SurchargeDecisionManagerWrite => Ok(Self::SurchargeDecisionManagerWrite),
- Permission::SurchargeDecisionManagerRead => Ok(Self::SurchargeDecisionManagerRead),
- Permission::UsersRead => Ok(Self::UsersRead),
- Permission::UsersWrite => Ok(Self::UsersWrite),
-
- Permission::MerchantAccountCreate => {
- logger::error!("Invalid use of internal permission");
- Err(())
- }
+ Permission::PaymentRead => Self::PaymentRead,
+ Permission::PaymentWrite => Self::PaymentWrite,
+ Permission::RefundRead => Self::RefundRead,
+ Permission::RefundWrite => Self::RefundWrite,
+ Permission::ApiKeyRead => Self::ApiKeyRead,
+ Permission::ApiKeyWrite => Self::ApiKeyWrite,
+ Permission::MerchantAccountRead => Self::MerchantAccountRead,
+ Permission::MerchantAccountWrite => Self::MerchantAccountWrite,
+ Permission::MerchantConnectorAccountRead => Self::MerchantConnectorAccountRead,
+ Permission::MerchantConnectorAccountWrite => Self::MerchantConnectorAccountWrite,
+ Permission::ForexRead => Self::ForexRead,
+ Permission::RoutingRead => Self::RoutingRead,
+ Permission::RoutingWrite => Self::RoutingWrite,
+ Permission::DisputeRead => Self::DisputeRead,
+ Permission::DisputeWrite => Self::DisputeWrite,
+ Permission::MandateRead => Self::MandateRead,
+ Permission::MandateWrite => Self::MandateWrite,
+ Permission::CustomerRead => Self::CustomerRead,
+ Permission::CustomerWrite => Self::CustomerWrite,
+ Permission::FileRead => Self::FileRead,
+ Permission::FileWrite => Self::FileWrite,
+ Permission::Analytics => Self::Analytics,
+ Permission::ThreeDsDecisionManagerWrite => Self::ThreeDsDecisionManagerWrite,
+ Permission::ThreeDsDecisionManagerRead => Self::ThreeDsDecisionManagerRead,
+ Permission::SurchargeDecisionManagerWrite => Self::SurchargeDecisionManagerWrite,
+ Permission::SurchargeDecisionManagerRead => Self::SurchargeDecisionManagerRead,
+ Permission::UsersRead => Self::UsersRead,
+ Permission::UsersWrite => Self::UsersWrite,
+ Permission::MerchantAccountCreate => Self::MerchantAccountCreate,
}
}
}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index c4e0aa3f3ea..7e3a692517f 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -297,6 +297,8 @@ pub enum Flow {
ListRoles,
/// Get role
GetRole,
+ /// Get role from token
+ GetRoleFromToken,
/// Update user role
UpdateUserRole,
/// Create merchant account for user in a org
|
feat
|
Added get role from jwt api (#3385)
|
5fb35029de31af4cbd24caaaf32f05effb65e005
|
2023-01-09 17:56:26
|
Abhishek
|
refactor(router): better mapping funtion handling for metadata (#326)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index e7d691b22d9..14816b0ada5 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -566,7 +566,8 @@ impl TryFrom<PaymentsRequest> for PaymentsResponse {
};
let metadata = item
.metadata
- .map(|a| Encode::<Metadata>::encode_to_value(&a))
+ .as_ref()
+ .map(Encode::<Metadata>::encode_to_value)
.transpose()?;
Ok(Self {
payment_id,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 8312e4e9e79..5c8b8168953 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -444,7 +444,7 @@ impl PaymentCreate {
let metadata = request
.metadata
.as_ref()
- .map(|a| Encode::<api_models::payments::Metadata>::encode_to_value(&a))
+ .map(Encode::<api_models::payments::Metadata>::encode_to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Encoding Metadata to value failed")?;
|
refactor
|
better mapping funtion handling for metadata (#326)
|
771f48cfe0ec6d8625ca3ff3095f5d9806915779
|
2024-08-28 13:22:19
|
Sai Harsha Vardhan
|
refactor(router): add domain type for merchant_connector_account id (#5685)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 48739ac77f9..5c57891d103 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8537,12 +8537,6 @@
"example": "\n[{\"gateway\":\"stripe\",\"payment_methods\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"card_networks\":[\"Visa\"],\"flow\":\"pre\",\"action\":\"cancel_txn\"},{\"payment_method_type\":\"debit\",\"card_networks\":[\"Visa\"],\"flow\":\"pre\"}]}]}]\n",
"nullable": true
},
- "merchant_connector_id": {
- "type": "string",
- "description": "Unique ID of the connector",
- "example": "mca_5apGeP94tMts6rg3U3kR",
- "nullable": true
- },
"pm_auth_config": {
"type": "object",
"description": "pm_auth_config will relate MCA records to their respective chosen auth services, based on payment_method and pmt",
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 55a2444973d..5b2432cda9f 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -670,16 +670,18 @@ pub struct MerchantId {
any(feature = "v1", feature = "v2"),
not(feature = "merchant_connector_account_v2")
))]
-#[derive(Default, Debug, Deserialize, ToSchema, Serialize)]
+#[derive(Debug, Deserialize, ToSchema, Serialize)]
pub struct MerchantConnectorId {
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
- pub merchant_connector_id: String,
+ #[schema(value_type = String)]
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
}
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
-#[derive(Default, Debug, Deserialize, ToSchema, Serialize)]
+#[derive(Debug, Deserialize, ToSchema, Serialize)]
pub struct MerchantConnectorId {
- pub id: String,
+ #[schema(value_type = String)]
+ pub id: id_type::MerchantConnectorAccountId,
}
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
@@ -757,10 +759,6 @@ pub struct MerchantConnectorCreate {
#[schema(example = json!(consts::FRM_CONFIGS_EG))]
pub frm_configs: Option<Vec<FrmConfigs>>,
- /// Unique ID of the connector
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub merchant_connector_id: Option<String>,
-
/// pm_auth_config will relate MCA records to their respective chosen auth services, based on payment_method and pmt
#[schema(value_type = Option<Object>)]
pub pm_auth_config: Option<pii::SecretSerdeValue>,
@@ -904,8 +902,8 @@ pub struct MerchantConnectorCreate {
pub business_sub_label: Option<String>,
/// Unique ID of the connector
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub merchant_connector_id: Option<String>,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = Option<String>)]
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
#[schema(value_type = Option<Object>)]
pub pm_auth_config: Option<pii::SecretSerdeValue>,
@@ -1031,11 +1029,15 @@ pub struct MerchantConnectorWebhookDetails {
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
pub struct MerchantConnectorInfo {
pub connector_label: String,
- pub merchant_connector_id: String,
+ #[schema(value_type = String)]
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
}
impl MerchantConnectorInfo {
- pub fn new(connector_label: String, merchant_connector_id: String) -> Self {
+ pub fn new(
+ connector_label: String,
+ merchant_connector_id: id_type::MerchantConnectorAccountId,
+ ) -> Self {
Self {
connector_label,
merchant_connector_id,
@@ -1060,8 +1062,8 @@ pub struct MerchantConnectorResponse {
pub connector_label: Option<String>,
/// Unique ID of the merchant connector account
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub id: String,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]
+ pub id: id_type::MerchantConnectorAccountId,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
@@ -1167,8 +1169,8 @@ pub struct MerchantConnectorResponse {
pub connector_label: Option<String>,
/// Unique ID of the merchant connector account
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub merchant_connector_id: String,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
@@ -1291,8 +1293,8 @@ pub struct MerchantConnectorListResponse {
pub connector_label: Option<String>,
/// Unique ID of the merchant connector account
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub merchant_connector_id: String,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
@@ -1400,8 +1402,8 @@ pub struct MerchantConnectorListResponse {
pub connector_label: Option<String>,
/// Unique ID of the merchant connector account
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub id: String,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]
+ pub id: id_type::MerchantConnectorAccountId,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
@@ -1760,8 +1762,8 @@ pub struct MerchantConnectorDeleteResponse {
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Unique ID of the connector
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub merchant_connector_id: String,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
/// If the connector is deleted or not
#[schema(example = false)]
pub deleted: bool,
@@ -1774,8 +1776,8 @@ pub struct MerchantConnectorDeleteResponse {
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Unique ID of the connector
- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub id: String,
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]
+ pub id: id_type::MerchantConnectorAccountId,
/// If the connector is deleted or not
#[schema(example = false)]
pub deleted: bool,
diff --git a/crates/api_models/src/connector_onboarding.rs b/crates/api_models/src/connector_onboarding.rs
index de4b8843dfc..2dca57d5953 100644
--- a/crates/api_models/src/connector_onboarding.rs
+++ b/crates/api_models/src/connector_onboarding.rs
@@ -1,9 +1,11 @@
+use common_utils::id_type;
+
use super::{admin, enums};
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct ActionUrlRequest {
pub connector: enums::Connector,
- pub connector_id: String,
+ pub connector_id: id_type::MerchantConnectorAccountId,
pub return_url: String,
}
@@ -15,8 +17,8 @@ pub enum ActionUrlResponse {
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct OnboardingSyncRequest {
- pub profile_id: common_utils::id_type::ProfileId,
- pub connector_id: String,
+ pub profile_id: id_type::ProfileId,
+ pub connector_id: id_type::MerchantConnectorAccountId,
pub connector: enums::Connector,
}
@@ -45,7 +47,7 @@ pub enum PayPalOnboardingStatus {
#[derive(serde::Serialize, Debug, Clone)]
pub struct PayPalOnboardingDone {
- pub payer_id: common_utils::id_type::MerchantId,
+ pub payer_id: id_type::MerchantId,
}
#[derive(serde::Serialize, Debug, Clone)]
@@ -55,6 +57,6 @@ pub struct PayPalIntegrationDone {
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct ResetTrackingIdRequest {
- pub connector_id: String,
+ pub connector_id: id_type::MerchantConnectorAccountId,
pub connector: enums::Connector,
}
diff --git a/crates/api_models/src/disputes.rs b/crates/api_models/src/disputes.rs
index 5e9db4cdfd1..42803c519cb 100644
--- a/crates/api_models/src/disputes.rs
+++ b/crates/api_models/src/disputes.rs
@@ -47,7 +47,8 @@ pub struct DisputeResponse {
#[schema(value_type = Option<String>)]
pub profile_id: Option<common_utils::id_type::ProfileId>,
/// The `merchant_connector_id` of the connector / processor through which the dispute was processed
- pub merchant_connector_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]
diff --git a/crates/api_models/src/mandates.rs b/crates/api_models/src/mandates.rs
index b62a2c38b9c..44a83319424 100644
--- a/crates/api_models/src/mandates.rs
+++ b/crates/api_models/src/mandates.rs
@@ -129,5 +129,6 @@ pub struct ProcessorPaymentToken {
pub processor_payment_token: String,
#[schema(value_type = Connector, example = "stripe")]
pub connector: api_enums::Connector,
- pub merchant_connector_id: String,
+ #[schema(value_type = String)]
+ pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
}
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index de94d4f5872..2204a7fc584 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -215,7 +215,9 @@ pub struct PaymentMethodMigrate {
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-pub struct PaymentsMandateReference(pub HashMap<String, PaymentsMandateReferenceRecord>);
+pub struct PaymentsMandateReference(
+ pub HashMap<id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>,
+);
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentsMandateReferenceRecord {
@@ -733,7 +735,7 @@ pub struct BankAccountTokenData {
pub struct BankAccountConnectorDetails {
pub connector: String,
pub account_id: masking::Secret<String>,
- pub mca_id: String,
+ pub mca_id: id_type::MerchantConnectorAccountId,
pub access_token: BankAccountAccessCreds,
}
@@ -1983,7 +1985,7 @@ pub struct PaymentMethodRecord {
pub billing_address_line2: Option<masking::Secret<String>>,
pub billing_address_line3: Option<masking::Secret<String>>,
pub raw_card_number: Option<masking::Secret<String>>,
- pub merchant_connector_id: String,
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
pub original_transaction_amount: Option<i64>,
pub original_transaction_currency: Option<common_enums::Currency>,
pub line_number: Option<i64>,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index be657cb948b..04bcae4c56c 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3829,7 +3829,8 @@ pub struct PaymentsResponse {
pub merchant_decision: Option<String>,
/// Identifier of the connector ( merchant connector account ) which was chosen to make the payment
- pub merchant_connector_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
/// If true, incremental authorization can be performed on this payment, in case the funds authorized initially fall short.
pub incremental_authorization_allowed: Option<bool>,
@@ -4059,7 +4060,7 @@ pub struct PaymentListFilterConstraints {
/// The list of authentication types to filter payments list
pub authentication_type: Option<Vec<enums::AuthenticationType>>,
/// The list of merchant connector ids to filter payments list for selected label
- pub merchant_connector_id: Option<Vec<String>>,
+ pub merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
/// The order in which payments list should be sorted
#[serde(default)]
pub order: Order,
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index b6b040a36f3..aad0cfcf303 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -473,7 +473,7 @@ pub struct PayoutCreateResponse {
/// Unique identifier of the merchant connector account
#[schema(value_type = Option<String>, example = "mca_sAD3OZLATetvjLOYhUSy")]
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
/// Current status of the Payout
#[schema(value_type = PayoutStatus, example = RequiresConfirmation)]
diff --git a/crates/api_models/src/pm_auth.rs b/crates/api_models/src/pm_auth.rs
index 4a1c8eaa31b..a949f618bdc 100644
--- a/crates/api_models/src/pm_auth.rs
+++ b/crates/api_models/src/pm_auth.rs
@@ -1,7 +1,7 @@
use common_enums::{PaymentMethod, PaymentMethodType};
use common_utils::{
events::{ApiEventMetric, ApiEventsType},
- impl_api_event_type,
+ id_type, impl_api_event_type,
};
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
@@ -46,7 +46,7 @@ pub struct PaymentMethodAuthConnectorChoice {
pub payment_method: PaymentMethod,
pub payment_method_type: PaymentMethodType,
pub connector_name: String,
- pub mca_id: String,
+ pub mca_id: id_type::MerchantConnectorAccountId,
}
impl_api_event_type!(
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index 656416dce96..1f3361d004e 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -159,7 +159,8 @@ pub struct RefundResponse {
#[schema(value_type = Option<String>)]
pub profile_id: Option<common_utils::id_type::ProfileId>,
/// The merchant_connector_id of the processor through which this payment went through
- pub merchant_connector_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
/// Charge specific fields for controlling the revert of funds from either platform or connected account
#[schema(value_type = Option<ChargeRefunds>)]
pub charges: Option<ChargeRefunds>,
@@ -186,7 +187,8 @@ pub struct RefundListRequest {
/// The list of connectors to filter refunds list
pub connector: Option<Vec<String>>,
/// The list of merchant connector ids to filter the refunds list for selected label
- pub merchant_connector_id: Option<Vec<String>>,
+ #[schema(value_type = Option<Vec<String>>)]
+ pub merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
/// The list of currencies to filter refunds list
#[schema(value_type = Option<Vec<Currency>>)]
pub currency: Option<Vec<enums::Currency>>,
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 04a58aed0d9..f9bcf3901b9 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -173,7 +173,8 @@ pub struct RoutableConnectorChoice {
#[serde(skip)]
pub choice_kind: RoutableChoiceKind,
pub connector: RoutableConnectors,
- pub merchant_connector_id: Option<String>,
+ #[schema(value_type = Option<String>)]
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -188,7 +189,7 @@ pub enum RoutableChoiceSerde {
OnlyConnector(Box<RoutableConnectors>),
FullStruct {
connector: RoutableConnectors,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
diff --git a/crates/api_models/src/user/dashboard_metadata.rs b/crates/api_models/src/user/dashboard_metadata.rs
index d8a437e31a6..91d1471d9ee 100644
--- a/crates/api_models/src/user/dashboard_metadata.rs
+++ b/crates/api_models/src/user/dashboard_metadata.rs
@@ -1,5 +1,5 @@
use common_enums::CountryAlpha2;
-use common_utils::pii;
+use common_utils::{id_type, pii};
use masking::Secret;
use strum::EnumString;
@@ -43,7 +43,7 @@ pub struct SetupProcessor {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct ProcessorConnected {
- pub processor_id: String,
+ pub processor_id: id_type::MerchantConnectorAccountId,
pub processor_name: String,
}
diff --git a/crates/api_models/src/verifications.rs b/crates/api_models/src/verifications.rs
index 5fa1b8cd4c8..e84f1758399 100644
--- a/crates/api_models/src/verifications.rs
+++ b/crates/api_models/src/verifications.rs
@@ -1,3 +1,5 @@
+use common_utils::id_type;
+
/// The request body for verification of merchant (everything except domain_names are prefilled)
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -13,7 +15,7 @@ pub struct ApplepayMerchantVerificationConfigs {
#[serde(rename_all = "snake_case")]
pub struct ApplepayMerchantVerificationRequest {
pub domain_names: Vec<String>,
- pub merchant_connector_account_id: String,
+ pub merchant_connector_account_id: id_type::MerchantConnectorAccountId,
}
/// Response to be sent for the verify/applepay api
@@ -27,8 +29,8 @@ pub struct ApplepayMerchantResponse {
#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct ApplepayGetVerifiedDomainsParam {
- pub merchant_id: common_utils::id_type::MerchantId,
- pub merchant_connector_account_id: String,
+ pub merchant_id: id_type::MerchantId,
+ pub merchant_connector_account_id: id_type::MerchantConnectorAccountId,
}
/// Response to be sent for derivation of the already verified domains
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
index cc4c56d6abb..b6de37fab4f 100644
--- a/crates/common_utils/src/id_type.rs
+++ b/crates/common_utils/src/id_type.rs
@@ -5,6 +5,7 @@ use std::{borrow::Cow, fmt::Debug};
mod customer;
mod merchant;
+mod merchant_connector_account;
mod organization;
mod profile;
@@ -19,6 +20,7 @@ use diesel::{
sql_types,
};
pub use merchant::MerchantId;
+pub use merchant_connector_account::MerchantConnectorAccountId;
pub use organization::OrganizationId;
pub use profile::ProfileId;
use serde::{Deserialize, Serialize};
diff --git a/crates/common_utils/src/id_type/merchant_connector_account.rs b/crates/common_utils/src/id_type/merchant_connector_account.rs
new file mode 100644
index 00000000000..f1bdb171b21
--- /dev/null
+++ b/crates/common_utils/src/id_type/merchant_connector_account.rs
@@ -0,0 +1,23 @@
+use crate::errors::{CustomResult, ValidationError};
+
+crate::id_type!(
+ MerchantConnectorAccountId,
+ "A type for merchant_connector_id that can be used for merchant_connector_account ids"
+);
+crate::impl_id_type_methods!(MerchantConnectorAccountId, "merchant_connector_id");
+
+// This is to display the `MerchantConnectorAccountId` as MerchantConnectorAccountId(abcd)
+crate::impl_debug_id_type!(MerchantConnectorAccountId);
+crate::impl_generate_id_id_type!(MerchantConnectorAccountId, "mca");
+crate::impl_try_from_cow_str_id_type!(MerchantConnectorAccountId, "merchant_connector_id");
+
+crate::impl_serializable_secret_id_type!(MerchantConnectorAccountId);
+crate::impl_queryable_id_type!(MerchantConnectorAccountId);
+crate::impl_to_sql_from_sql_id_type!(MerchantConnectorAccountId);
+
+impl MerchantConnectorAccountId {
+ /// Get a merchant connector account id from String
+ pub fn wrap(merchant_connector_account_id: String) -> CustomResult<Self, ValidationError> {
+ Self::try_from(std::borrow::Cow::from(merchant_connector_account_id))
+ }
+}
diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs
index 67a67bee5c3..f51ed6eab05 100644
--- a/crates/common_utils/src/lib.rs
+++ b/crates/common_utils/src/lib.rs
@@ -233,6 +233,14 @@ pub fn generate_profile_id_of_default_length() -> id_type::ProfileId {
id_type::ProfileId::generate()
}
+/// Generate a merchant_connector_account id with default length, with prefix as `mca`
+pub fn generate_merchant_connector_account_id_of_default_length(
+) -> id_type::MerchantConnectorAccountId {
+ use id_type::GenerateId;
+
+ id_type::MerchantConnectorAccountId::generate()
+}
+
/// Generate a nanoid with the given prefix and a default length
#[inline]
pub fn generate_id_with_default_len(prefix: &str) -> String {
diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs
index 606644255bc..488066ff253 100644
--- a/crates/diesel_models/src/authentication.rs
+++ b/crates/diesel_models/src/authentication.rs
@@ -43,7 +43,7 @@ pub struct Authentication {
pub acs_signed_content: Option<String>,
pub profile_id: common_utils::id_type::ProfileId,
pub payment_id: Option<String>,
- pub merchant_connector_id: String,
+ pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
pub ds_trans_id: Option<String>,
pub directory_server_id: Option<String>,
pub acquirer_country_code: Option<String>,
@@ -90,7 +90,7 @@ pub struct AuthenticationNew {
pub acs_signed_content: Option<String>,
pub profile_id: common_utils::id_type::ProfileId,
pub payment_id: Option<String>,
- pub merchant_connector_id: String,
+ pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
pub ds_trans_id: Option<String>,
pub directory_server_id: Option<String>,
pub acquirer_country_code: Option<String>,
diff --git a/crates/diesel_models/src/dispute.rs b/crates/diesel_models/src/dispute.rs
index 14fe16c9826..45004e10ba5 100644
--- a/crates/diesel_models/src/dispute.rs
+++ b/crates/diesel_models/src/dispute.rs
@@ -28,7 +28,7 @@ pub struct DisputeNew {
pub connector: String,
pub evidence: Option<Secret<serde_json::Value>>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub dispute_amount: i64,
}
@@ -57,7 +57,7 @@ pub struct Dispute {
pub connector: String,
pub evidence: Secret<serde_json::Value>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub dispute_amount: i64,
}
diff --git a/crates/diesel_models/src/file.rs b/crates/diesel_models/src/file.rs
index 523bb1f26ef..99265bfa807 100644
--- a/crates/diesel_models/src/file.rs
+++ b/crates/diesel_models/src/file.rs
@@ -18,7 +18,7 @@ pub struct FileMetadataNew {
pub available: bool,
pub connector_label: Option<String>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable, Selectable)]
@@ -37,7 +37,7 @@ pub struct FileMetadata {
pub created_at: time::PrimitiveDateTime,
pub connector_label: Option<String>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Debug)]
@@ -47,7 +47,7 @@ pub enum FileMetadataUpdate {
file_upload_provider: Option<common_enums::FileUploadProvider>,
available: bool,
profile_id: Option<common_utils::id_type::ProfileId>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
@@ -58,7 +58,7 @@ pub struct FileMetadataUpdateInternal {
file_upload_provider: Option<common_enums::FileUploadProvider>,
available: bool,
profile_id: Option<common_utils::id_type::ProfileId>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
impl From<FileMetadataUpdate> for FileMetadataUpdateInternal {
diff --git a/crates/diesel_models/src/mandate.rs b/crates/diesel_models/src/mandate.rs
index bfac1849a58..dc6916f3c4b 100644
--- a/crates/diesel_models/src/mandate.rs
+++ b/crates/diesel_models/src/mandate.rs
@@ -33,7 +33,7 @@ pub struct Mandate {
pub metadata: Option<pii::SecretSerdeValue>,
pub connector_mandate_ids: Option<pii::SecretSerdeValue>,
pub original_payment_id: Option<String>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub updated_by: Option<String>,
}
@@ -71,7 +71,7 @@ pub struct MandateNew {
pub metadata: Option<pii::SecretSerdeValue>,
pub connector_mandate_ids: Option<pii::SecretSerdeValue>,
pub original_payment_id: Option<String>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub updated_by: Option<String>,
}
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index e674b9b7587..cd92f5492a1 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -33,7 +33,7 @@ pub struct MerchantConnectorAccount {
pub connector_account_details: Encryption,
pub test_mode: Option<bool>,
pub disabled: Option<bool>,
- pub merchant_connector_id: String,
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,
pub connector_type: storage_enums::ConnectorType,
@@ -63,7 +63,7 @@ pub struct MerchantConnectorAccount {
not(feature = "merchant_connector_account_v2")
))]
impl MerchantConnectorAccount {
- pub fn get_id(&self) -> String {
+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.merchant_connector_id.clone()
}
}
@@ -102,13 +102,13 @@ pub struct MerchantConnectorAccount {
pub status: storage_enums::ConnectorStatus,
pub additional_merchant_data: Option<Encryption>,
pub connector_wallets_details: Option<Encryption>,
- pub id: String,
+ pub id: id_type::MerchantConnectorAccountId,
pub version: common_enums::ApiVersion,
}
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
impl MerchantConnectorAccount {
- pub fn get_id(&self) -> String {
+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.id.clone()
}
}
@@ -126,7 +126,7 @@ pub struct MerchantConnectorAccountNew {
pub connector_account_details: Option<Encryption>,
pub test_mode: Option<bool>,
pub disabled: Option<bool>,
- pub merchant_connector_id: String,
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,
pub metadata: Option<pii::SecretSerdeValue>,
pub connector_label: Option<String>,
@@ -173,7 +173,7 @@ pub struct MerchantConnectorAccountNew {
pub status: storage_enums::ConnectorStatus,
pub additional_merchant_data: Option<Encryption>,
pub connector_wallets_details: Option<Encryption>,
- pub id: String,
+ pub id: id_type::MerchantConnectorAccountId,
pub version: common_enums::ApiVersion,
}
@@ -190,7 +190,7 @@ pub struct MerchantConnectorAccountUpdateInternal {
pub connector_label: Option<String>,
pub test_mode: Option<bool>,
pub disabled: Option<bool>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,
pub frm_configs: Option<pii::SecretSerdeValue>,
pub metadata: Option<pii::SecretSerdeValue>,
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 84811f22624..ec87b2da2e4 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -62,7 +62,7 @@ pub struct PaymentAttempt {
pub connector_response_reference_id: Option<String>,
pub amount_capturable: i64,
pub updated_by: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub authentication_data: Option<serde_json::Value>,
pub encoded_data: Option<String>,
pub unified_code: Option<String>,
@@ -133,7 +133,7 @@ pub struct PaymentAttempt {
pub connector_response_reference_id: Option<String>,
pub amount_capturable: i64,
pub updated_by: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub authentication_data: Option<serde_json::Value>,
pub encoded_data: Option<String>,
pub unified_code: Option<String>,
@@ -215,7 +215,7 @@ pub struct PaymentAttemptNew {
pub multiple_capture_count: Option<i16>,
pub amount_capturable: i64,
pub updated_by: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub authentication_data: Option<serde_json::Value>,
pub encoded_data: Option<String>,
pub unified_code: Option<String>,
@@ -280,7 +280,7 @@ pub enum PaymentAttemptUpdate {
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
updated_by: String,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
AuthenticationTypeUpdate {
authentication_type: storage_enums::AuthenticationType,
@@ -308,7 +308,7 @@ pub enum PaymentAttemptUpdate {
tax_amount: Option<i64>,
fingerprint_id: Option<String>,
updated_by: String,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
payment_method_id: Option<String>,
external_three_ds_authentication_attempted: Option<bool>,
authentication_connector: Option<String>,
@@ -475,7 +475,7 @@ pub struct PaymentAttemptUpdateInternal {
tax_amount: Option<i64>,
amount_capturable: Option<i64>,
updated_by: String,
- merchant_connector_id: Option<Option<String>>,
+ merchant_connector_id: Option<Option<common_utils::id_type::MerchantConnectorAccountId>>,
authentication_data: Option<serde_json::Value>,
encoded_data: Option<String>,
unified_code: Option<Option<String>>,
diff --git a/crates/diesel_models/src/payout_attempt.rs b/crates/diesel_models/src/payout_attempt.rs
index 7e9b2ec4e1c..619e694f411 100644
--- a/crates/diesel_models/src/payout_attempt.rs
+++ b/crates/diesel_models/src/payout_attempt.rs
@@ -28,7 +28,7 @@ pub struct PayoutAttempt {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
pub profile_id: common_utils::id_type::ProfileId,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub routing_info: Option<serde_json::Value>,
}
@@ -64,7 +64,7 @@ pub struct PayoutAttemptNew {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
pub profile_id: common_utils::id_type::ProfileId,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub routing_info: Option<serde_json::Value>,
}
@@ -89,7 +89,7 @@ pub enum PayoutAttemptUpdate {
UpdateRouting {
connector: String,
routing_info: Option<serde_json::Value>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
@@ -109,7 +109,7 @@ pub struct PayoutAttemptUpdateInternal {
pub last_modified_at: PrimitiveDateTime,
pub address_id: Option<String>,
pub customer_id: Option<common_utils::id_type::CustomerId>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
impl Default for PayoutAttemptUpdateInternal {
diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rs
index 7eeddd5d592..ed3f1562f7c 100644
--- a/crates/diesel_models/src/query/merchant_connector_account.rs
+++ b/crates/diesel_models/src/query/merchant_connector_account.rs
@@ -51,7 +51,7 @@ impl MerchantConnectorAccount {
pub async fn delete_by_merchant_id_merchant_connector_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(
conn,
@@ -115,7 +115,7 @@ impl MerchantConnectorAccount {
pub async fn find_by_merchant_id_merchant_connector_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
@@ -182,12 +182,18 @@ impl MerchantConnectorAccount {
}
}
- pub async fn delete_by_id(conn: &PgPooledConn, id: &str) -> StorageResult<bool> {
+ pub async fn delete_by_id(
+ conn: &PgPooledConn,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
+ ) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(conn, dsl::id.eq(id.to_owned()))
.await
}
- pub async fn find_by_id(conn: &PgPooledConn, id: &str) -> StorageResult<Self> {
+ pub async fn find_by_id(
+ conn: &PgPooledConn,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
+ ) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::id.eq(id.to_owned()),
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index 68f16b34457..2af603f6954 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -322,7 +322,7 @@ impl PaymentAttempt {
payment_method: Option<Vec<enums::PaymentMethod>>,
payment_method_type: Option<Vec<enums::PaymentMethodType>>,
authentication_type: Option<Vec<enums::AuthenticationType>>,
- merchant_connector_id: Option<Vec<String>>,
+ merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
) -> StorageResult<i64> {
let mut filter = <Self as HasTable>::table()
.count()
diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs
index 3b73a603677..10c1fbb9b29 100644
--- a/crates/diesel_models/src/refund.rs
+++ b/crates/diesel_models/src/refund.rs
@@ -48,7 +48,7 @@ pub struct Refund {
pub refund_error_code: Option<String>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
pub updated_by: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub charges: Option<ChargeRefunds>,
}
@@ -90,7 +90,7 @@ pub struct RefundNew {
pub refund_reason: Option<String>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
pub updated_by: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub charges: Option<ChargeRefunds>,
}
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index 035d99e554b..dbdae51c45a 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -64,7 +64,7 @@ pub struct PaymentAttemptBatchNew {
pub multiple_capture_count: Option<i16>,
pub amount_capturable: i64,
pub updated_by: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub authentication_data: Option<serde_json::Value>,
pub encoded_data: Option<String>,
pub unified_code: Option<String>,
diff --git a/crates/euclid/src/frontend/ast.rs b/crates/euclid/src/frontend/ast.rs
index c77736effa9..5a7b88acfbc 100644
--- a/crates/euclid/src/frontend/ast.rs
+++ b/crates/euclid/src/frontend/ast.rs
@@ -164,7 +164,7 @@ pub struct RoutableConnectorChoice {
#[serde(skip)]
pub choice_kind: RoutableChoiceKind,
pub connector: RoutableConnectors,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
index a841e2d1507..c97fcbdfe86 100644
--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
@@ -3,7 +3,7 @@ use common_utils::{
date_time,
encryption::Encryption,
errors::{CustomResult, ValidationError},
- pii, type_name,
+ id_type, pii, type_name,
types::keymanager::{Identifier, KeyManagerState},
};
use diesel_models::{enums, merchant_connector_account::MerchantConnectorAccountUpdateInternal};
@@ -19,12 +19,12 @@ use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
))]
#[derive(Clone, Debug)]
pub struct MerchantConnectorAccount {
- pub merchant_id: common_utils::id_type::MerchantId,
+ pub merchant_id: id_type::MerchantId,
pub connector_name: String,
pub connector_account_details: Encryptable<pii::SecretSerdeValue>,
pub test_mode: Option<bool>,
pub disabled: Option<bool>,
- pub merchant_connector_id: String,
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,
pub connector_type: enums::ConnectorType,
pub metadata: Option<pii::SecretSerdeValue>,
@@ -36,7 +36,7 @@ pub struct MerchantConnectorAccount {
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
- pub profile_id: common_utils::id_type::ProfileId,
+ pub profile_id: id_type::ProfileId,
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
pub status: enums::ConnectorStatus,
@@ -50,7 +50,7 @@ pub struct MerchantConnectorAccount {
not(feature = "merchant_connector_account_v2")
))]
impl MerchantConnectorAccount {
- pub fn get_id(&self) -> String {
+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.merchant_connector_id.clone()
}
}
@@ -58,8 +58,8 @@ impl MerchantConnectorAccount {
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
#[derive(Clone, Debug)]
pub struct MerchantConnectorAccount {
- pub id: String,
- pub merchant_id: common_utils::id_type::MerchantId,
+ pub id: id_type::MerchantConnectorAccountId,
+ pub merchant_id: id_type::MerchantId,
pub connector_name: String,
pub connector_account_details: Encryptable<pii::SecretSerdeValue>,
pub disabled: Option<bool>,
@@ -71,7 +71,7 @@ pub struct MerchantConnectorAccount {
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
- pub profile_id: common_utils::id_type::ProfileId,
+ pub profile_id: id_type::ProfileId,
pub applepay_verified_domains: Option<Vec<String>>,
pub pm_auth_config: Option<pii::SecretSerdeValue>,
pub status: enums::ConnectorStatus,
@@ -82,7 +82,7 @@ pub struct MerchantConnectorAccount {
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
impl MerchantConnectorAccount {
- pub fn get_id(&self) -> String {
+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.id.clone()
}
}
@@ -99,7 +99,7 @@ pub enum MerchantConnectorAccountUpdate {
connector_account_details: Option<Encryptable<pii::SecretSerdeValue>>,
test_mode: Option<bool>,
disabled: Option<bool>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,
metadata: Option<pii::SecretSerdeValue>,
frm_configs: Option<Vec<pii::SecretSerdeValue>>,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 5f2bc035f57..12880172d3d 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -111,7 +111,7 @@ pub trait PaymentAttemptInterface {
payment_method: Option<Vec<storage_enums::PaymentMethod>>,
payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
- merchant_connector_id: Option<Vec<String>>,
+ merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<i64, errors::StorageError>;
}
@@ -168,7 +168,7 @@ pub struct PaymentAttempt {
pub updated_by: String,
pub authentication_data: Option<serde_json::Value>,
pub encoded_data: Option<String>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub external_three_ds_authentication_attempted: Option<bool>,
@@ -258,7 +258,7 @@ pub struct PaymentAttemptNew {
pub updated_by: String,
pub authentication_data: Option<serde_json::Value>,
pub encoded_data: Option<String>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub external_three_ds_authentication_attempted: Option<bool>,
@@ -317,7 +317,7 @@ pub enum PaymentAttemptUpdate {
surcharge_amount: Option<MinorUnit>,
tax_amount: Option<MinorUnit>,
updated_by: String,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
},
AuthenticationTypeUpdate {
authentication_type: storage_enums::AuthenticationType,
@@ -344,7 +344,7 @@ pub enum PaymentAttemptUpdate {
updated_by: String,
surcharge_amount: Option<MinorUnit>,
tax_amount: Option<MinorUnit>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
external_three_ds_authentication_attempted: Option<bool>,
authentication_connector: Option<String>,
authentication_id: Option<String>,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 4c59a90ba15..dcb06733cc8 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -745,7 +745,7 @@ pub struct PaymentIntentListParams {
pub payment_method: Option<Vec<storage_enums::PaymentMethod>>,
pub payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
pub authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
- pub merchant_connector_id: Option<Vec<String>>,
+ pub merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
pub profile_id: Option<id_type::ProfileId>,
pub customer_id: Option<id_type::CustomerId>,
pub starting_after_id: Option<String>,
diff --git a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
index 8182ed35bab..f747eb96c4a 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
@@ -76,7 +76,7 @@ pub struct PayoutAttempt {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub last_modified_at: PrimitiveDateTime,
pub profile_id: id_type::ProfileId,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
pub routing_info: Option<serde_json::Value>,
}
@@ -99,7 +99,7 @@ pub struct PayoutAttemptNew {
pub created_at: PrimitiveDateTime,
pub last_modified_at: PrimitiveDateTime,
pub profile_id: id_type::ProfileId,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
pub routing_info: Option<serde_json::Value>,
}
@@ -124,7 +124,7 @@ pub enum PayoutAttemptUpdate {
UpdateRouting {
connector: String,
routing_info: Option<serde_json::Value>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
},
}
@@ -142,7 +142,7 @@ pub struct PayoutAttemptUpdateInternal {
pub routing_info: Option<serde_json::Value>,
pub address_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
}
impl From<PayoutAttemptUpdate> for PayoutAttemptUpdateInternal {
diff --git a/crates/kgraph_utils/benches/evaluation.rs b/crates/kgraph_utils/benches/evaluation.rs
index 5a078de1d79..8e3bec16b2a 100644
--- a/crates/kgraph_utils/benches/evaluation.rs
+++ b/crates/kgraph_utils/benches/evaluation.rs
@@ -58,7 +58,7 @@ fn build_test_data(
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
- id: "something".to_string(),
+ id: common_utils::generate_merchant_connector_account_id_of_default_length(),
connector_account_details: masking::Secret::new(serde_json::json!({})),
disabled: None,
metadata: None,
@@ -80,7 +80,8 @@ fn build_test_data(
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
- merchant_connector_id: "something".to_string(),
+ merchant_connector_id:
+ common_utils::generate_merchant_connector_account_id_of_default_length(),
connector_account_details: masking::Secret::new(serde_json::json!({})),
test_mode: None,
disabled: None,
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index 1e099589b00..fa98ae915e8 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -710,7 +710,7 @@ mod tests {
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
- id: "something".to_string(),
+ id: common_utils::generate_merchant_connector_account_id_of_default_length(),
connector_label: Some("something".to_string()),
connector_account_details: masking::Secret::new(serde_json::json!({})),
disabled: None,
@@ -767,7 +767,8 @@ mod tests {
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
- merchant_connector_id: "something".to_string(),
+ merchant_connector_id:
+ common_utils::generate_merchant_connector_account_id_of_default_length(),
business_country: Some(api_enums::CountryAlpha2::US),
connector_label: Some("something".to_string()),
business_label: Some("food".to_string()),
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 084ac8eacc7..cb95feee9e9 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1842,7 +1842,7 @@ impl<'a> ConnectorTypeAndConnectorName<'a> {
))]
struct MerchantDefaultConfigUpdate<'a> {
routable_connector: &'a Option<api_enums::RoutableConnectors>,
- merchant_connector_id: &'a String,
+ merchant_connector_id: &'a id_type::MerchantConnectorAccountId,
store: &'a dyn StorageInterface,
merchant_id: &'a id_type::MerchantId,
profile_id: &'a id_type::ProfileId,
@@ -1907,7 +1907,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> {
))]
struct DefaultFallbackRoutingConfigUpdate<'a> {
routable_connector: &'a Option<api_enums::RoutableConnectors>,
- merchant_connector_id: &'a String,
+ merchant_connector_id: &'a common_utils::id_type::MerchantConnectorAccountId,
store: &'a dyn StorageInterface,
business_profile: domain::BusinessProfile,
key_store: hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
@@ -1954,7 +1954,7 @@ trait MerchantConnectorAccountUpdateBridge {
self,
db: &dyn StorageInterface,
merchant_id: &id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
key_manager_state: &KeyManagerState,
) -> RouterResult<domain::MerchantConnectorAccount>;
@@ -1980,7 +1980,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect
self,
db: &dyn StorageInterface,
_merchant_id: &id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
key_manager_state: &KeyManagerState,
) -> RouterResult<domain::MerchantConnectorAccount> {
@@ -2148,7 +2148,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect
self,
db: &dyn StorageInterface,
merchant_id: &id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
key_manager_state: &KeyManagerState,
) -> RouterResult<domain::MerchantConnectorAccount> {
@@ -2161,7 +2161,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.to_string(),
+ id: merchant_connector_id.get_string_repr().to_string(),
},
)
}
@@ -2433,7 +2433,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
connector_label: Some(connector_label.clone()),
created_at: date_time::now(),
modified_at: date_time::now(),
- id: common_utils::generate_time_ordered_id("mca"),
+ id: common_utils::generate_merchant_connector_account_id_of_default_length(),
connector_webhook_details: match self.connector_webhook_details {
Some(connector_webhook_details) => {
connector_webhook_details.encode_to_value(
@@ -2580,7 +2580,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
merchant_id: business_profile.merchant_id.clone(),
connector_type: self.connector_type,
connector_name: self.connector_name.to_string(),
- merchant_connector_id: utils::generate_id(consts::ID_LENGTH, "mca"),
+ merchant_connector_id: common_utils::generate_merchant_connector_account_id_of_default_length(),
connector_account_details: domain_types::crypto_operation(
key_manager_state,
type_name!(domain::MerchantConnectorAccount),
@@ -2913,7 +2913,7 @@ pub async fn retrieve_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
profile_id: Option<id_type::ProfileId>,
- merchant_connector_id: String,
+ merchant_connector_id: id_type::MerchantConnectorAccountId,
) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -2940,7 +2940,7 @@ pub async fn retrieve_connector(
)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.clone(),
+ id: merchant_connector_id.get_string_repr().to_string(),
})?;
core_utils::validate_profile_id_from_auth_layer(profile_id, &mca)?;
@@ -2953,7 +2953,7 @@ pub async fn retrieve_connector(
pub async fn retrieve_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
- id: String,
+ id: id_type::MerchantConnectorAccountId,
) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
let store = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -2970,14 +2970,14 @@ pub async fn retrieve_connector(
.find_merchant_connector_account_by_id(key_manager_state, &id, &key_store)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: id.clone(),
+ id: id.clone().get_string_repr().to_string(),
})?;
// Validate if the merchant_id sent in the request is valid
if mca.merchant_id != merchant_id {
return Err(errors::ApiErrorResponse::InvalidRequestData {
message: format!(
- "Invalid merchant_id {} provided for merchant_connector_account {}",
+ "Invalid merchant_id {} provided for merchant_connector_account {:?}",
merchant_id.get_string_repr(),
id
),
@@ -3039,7 +3039,7 @@ pub async fn update_connector(
state: SessionState,
merchant_id: &id_type::MerchantId,
profile_id: Option<id_type::ProfileId>,
- merchant_connector_id: &str,
+ merchant_connector_id: &id_type::MerchantConnectorAccountId,
req: api_models::admin::MerchantConnectorUpdate,
) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
let db = state.store.as_ref();
@@ -3101,7 +3101,10 @@ pub async fn update_connector(
},
)
.attach_printable_lazy(|| {
- format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")
+ format!(
+ "Failed while updating MerchantConnectorAccount: id: {:?}",
+ merchant_connector_id
+ )
})?;
let response = updated_mca.foreign_try_into()?;
@@ -3116,7 +3119,7 @@ pub async fn update_connector(
pub async fn delete_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
- merchant_connector_id: String,
+ merchant_connector_id: id_type::MerchantConnectorAccountId,
) -> RouterResponse<api::MerchantConnectorDeleteResponse> {
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -3143,7 +3146,7 @@ pub async fn delete_connector(
)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.clone(),
+ id: merchant_connector_id.get_string_repr().to_string(),
})?;
let is_deleted = db
@@ -3153,7 +3156,7 @@ pub async fn delete_connector(
)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.clone(),
+ id: merchant_connector_id.get_string_repr().to_string(),
})?;
let response = api::MerchantConnectorDeleteResponse {
@@ -3168,7 +3171,7 @@ pub async fn delete_connector(
pub async fn delete_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
- id: String,
+ id: id_type::MerchantConnectorAccountId,
) -> RouterResponse<api::MerchantConnectorDeleteResponse> {
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
@@ -3185,14 +3188,14 @@ pub async fn delete_connector(
.find_merchant_connector_account_by_id(key_manager_state, &id, &key_store)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: id.clone(),
+ id: id.clone().get_string_repr().to_string(),
})?;
// Validate if the merchant_id sent in the request is valid
if mca.merchant_id != merchant_id {
return Err(errors::ApiErrorResponse::InvalidRequestData {
message: format!(
- "Invalid merchant_id {} provided for merchant_connector_account {}",
+ "Invalid merchant_id {} provided for merchant_connector_account {:?}",
merchant_id.get_string_repr(),
id
),
@@ -3204,7 +3207,7 @@ pub async fn delete_connector(
.delete_merchant_connector_account_by_id(&id)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: id.clone(),
+ id: id.clone().get_string_repr().to_string(),
})?;
let response = api::MerchantConnectorDeleteResponse {
diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs
index 58862d18906..cd93a1cf627 100644
--- a/crates/router/src/core/authentication/utils.rs
+++ b/crates/router/src/core/authentication/utils.rs
@@ -180,7 +180,7 @@ pub async fn create_new_authentication(
token: String,
profile_id: common_utils::id_type::ProfileId,
payment_id: Option<String>,
- merchant_connector_id: String,
+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
) -> RouterResult<storage::Authentication> {
let authentication_id =
common_utils::generate_id_with_default_len(consts::AUTHENTICATION_ID_PREFIX);
diff --git a/crates/router/src/core/connector_onboarding/paypal.rs b/crates/router/src/core/connector_onboarding/paypal.rs
index f967f2aece3..a61fab395f0 100644
--- a/crates/router/src/core/connector_onboarding/paypal.rs
+++ b/crates/router/src/core/connector_onboarding/paypal.rs
@@ -141,7 +141,7 @@ async fn find_paypal_merchant_by_tracking_id(
pub async fn update_mca(
state: &SessionState,
merchant_id: common_utils::id_type::MerchantId,
- connector_id: String,
+ connector_id: common_utils::id_type::MerchantConnectorAccountId,
auth_details: oss_types::ConnectorAuthType,
) -> RouterResult<oss_api_types::MerchantConnectorResponse> {
let connector_auth_json = auth_details
diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rs
index 14e404e88a0..bd4fc749758 100644
--- a/crates/router/src/core/files/helpers.rs
+++ b/crates/router/src/core/files/helpers.rs
@@ -246,7 +246,7 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(
String,
api_models::enums::FileUploadProvider,
Option<common_utils::id_type::ProfileId>,
- Option<String>,
+ Option<common_utils::id_type::MerchantConnectorAccountId>,
),
errors::ApiErrorResponse,
> {
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index e74f7f11a73..8118d8a322a 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -353,7 +353,7 @@ pub async fn mandate_procedure<F, FData>(
resp: &types::RouterData<F, FData, types::PaymentsResponseData>,
customer_id: &Option<id_type::CustomerId>,
pm_id: Option<String>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
storage_scheme: MerchantStorageScheme,
) -> errors::RouterResult<Option<String>>
where
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 586e93a0fe6..9896ff3008e 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2763,7 +2763,10 @@ pub async fn list_payment_methods(
// No PM_FILTER_CGRAPH Cache present in MokaCache
let mut builder = cgraph::ConstraintGraphBuilder::new();
for mca in &filtered_mcas {
- let domain_id = builder.make_domain(mca.get_id(), mca.connector_name.as_str());
+ let domain_id = builder.make_domain(
+ mca.get_id().get_string_repr().to_string(),
+ mca.connector_name.as_str(),
+ );
let Ok(domain_id) = domain_id else {
logger::error!("Failed to construct domain for list payment methods");
@@ -3778,7 +3781,7 @@ pub async fn call_surcharge_decision_management_for_saved_card(
#[allow(clippy::too_many_arguments)]
pub async fn filter_payment_methods(
graph: &cgraph::ConstraintGraph<dir::DirValue>,
- mca_id: String,
+ mca_id: id_type::MerchantConnectorAccountId,
payment_methods: &[Secret<serde_json::Value>],
req: &mut api::PaymentMethodListRequest,
resp: &mut Vec<ResponsePaymentMethodIntermediate>,
@@ -3928,7 +3931,7 @@ pub async fn filter_payment_methods(
let context = AnalysisContext::from_dir_values(context_values.clone());
logger::info!("Context created for List Payment method is {:?}", context);
- let domain_ident: &[String] = &[mca_id.clone()];
+ let domain_ident: &[String] = &[mca_id.clone().get_string_repr().to_string()];
let result = graph.key_value_analysis(
pm_dir_value.clone(),
&context,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 72a188a47ec..586d1989dec 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -2008,8 +2008,10 @@ where
&connector_name,
);
- let connector_label = if let Some(connector_label) =
- merchant_connector_account.get_mca_id().or(connector_label)
+ let connector_label = if let Some(connector_label) = merchant_connector_account
+ .get_mca_id()
+ .map(|mca_id| mca_id.get_string_repr().to_string())
+ .or(connector_label)
{
connector_label
} else {
@@ -2284,7 +2286,7 @@ pub async fn construct_profile_id_and_get_mca<'a, F>(
merchant_account: &domain::MerchantAccount,
payment_data: &mut PaymentData<F>,
connector_name: &str,
- merchant_connector_id: Option<&String>,
+ merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
key_store: &domain::MerchantKeyStore,
_should_validate: bool,
) -> RouterResult<helpers::MerchantConnectorAccountType>
@@ -2710,7 +2712,7 @@ where
#[derive(Clone)]
pub struct MandateConnectorDetails {
pub connector: String,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
}
#[derive(Clone)]
diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rs
index 78ef29e473d..8ac89f76ad3 100644
--- a/crates/router/src/core/payments/access_token.rs
+++ b/crates/router/src/core/payments/access_token.rs
@@ -76,6 +76,7 @@ pub async fn add_access_token<
let merchant_connector_id_or_connector_name = connector
.merchant_connector_id
.clone()
+ .map(|mca_id| mca_id.get_string_repr().to_string())
.or(creds_identifier.cloned())
.unwrap_or(connector.connector_name.to_string());
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 176e7d96aca..181e2232d90 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2693,7 +2693,7 @@ pub fn generate_mandate(
network_txn_id: Option<String>,
payment_method_data_option: Option<domain::payments::PaymentMethodData>,
mandate_reference: Option<MandateReference>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
) -> CustomResult<Option<storage::MandateNew>, errors::ApiErrorResponse> {
match (setup_mandate_details, customer_id) {
(Some(data), Some(cus_id)) => {
@@ -3205,7 +3205,7 @@ impl MerchantConnectorAccountType {
None
}
- pub fn get_mca_id(&self) -> Option<String> {
+ pub fn get_mca_id(&self) -> Option<id_type::MerchantConnectorAccountId> {
match self {
Self::DbVal(db_val) => Some(db_val.get_id()),
Self::CacheVal(_) => None,
@@ -3239,7 +3239,7 @@ pub async fn get_merchant_connector_account(
key_store: &domain::MerchantKeyStore,
profile_id: &id_type::ProfileId,
connector_name: &str,
- merchant_connector_id: Option<&String>,
+ merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
) -> RouterResult<MerchantConnectorAccountType> {
let db = &*state.store;
let key_manager_state: &KeyManagerState = &state.into();
@@ -3332,7 +3332,7 @@ pub async fn get_merchant_connector_account(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.to_string(),
+ id: merchant_connector_id.get_string_repr().to_string(),
},
)
}
@@ -4232,7 +4232,7 @@ pub async fn get_apple_pay_retryable_connectors<F>(
payment_data: &mut PaymentData<F>,
key_store: &domain::MerchantKeyStore,
pre_routing_connector_data_list: &[api::ConnectorData],
- merchant_connector_id: Option<&String>,
+ merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
business_profile: domain::BusinessProfile,
) -> CustomResult<Option<Vec<api::ConnectorData>>, errors::ApiErrorResponse>
where
@@ -5199,7 +5199,7 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details(
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
let merchant_connector_account_details_hash_map: std::collections::HashMap<
- String,
+ id_type::MerchantConnectorAccountId,
domain::MerchantConnectorAccount,
> = merchant_connector_account_list
.iter()
@@ -5214,33 +5214,43 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details(
for (migrating_merchant_connector_id, migrating_connector_mandate_details) in
connector_mandate_details.0.clone()
{
- match (card_network.clone() ,merchant_connector_account_details_hash_map.get(&migrating_merchant_connector_id)) {
- (Some(enums::CardNetwork::Discover),Some(merchant_connector_account_details)) => if let ("cybersource", None) = (
- merchant_connector_account_details.connector_name.as_str(),
- migrating_connector_mandate_details
- .original_payment_authorized_amount
- .zip(
- migrating_connector_mandate_details
- .original_payment_authorized_currency,
- ),
- ) {
- Err(errors::ApiErrorResponse::MissingRequiredFields {
- field_names: vec![
- "original_payment_authorized_currency",
- "original_payment_authorized_amount",
- ],
- }).attach_printable(format!("Invalid connector_mandate_details provided for connector {migrating_merchant_connector_id}"))?
- },
- (_, Some(_)) => (),
- (_, None) => {
- Err(errors::ApiErrorResponse::InvalidDataValue {
- field_name: "merchant_connector_id",
- })
- .attach_printable_lazy(|| {
- format!("{migrating_merchant_connector_id} invalid merchant connector id in connector_mandate_details")
- })?
- },
- }
+ match (
+ card_network.clone(),
+ merchant_connector_account_details_hash_map.get(&migrating_merchant_connector_id),
+ ) {
+ (Some(enums::CardNetwork::Discover), Some(merchant_connector_account_details)) => {
+ if let ("cybersource", None) = (
+ merchant_connector_account_details.connector_name.as_str(),
+ migrating_connector_mandate_details
+ .original_payment_authorized_amount
+ .zip(
+ migrating_connector_mandate_details
+ .original_payment_authorized_currency,
+ ),
+ ) {
+ Err(errors::ApiErrorResponse::MissingRequiredFields {
+ field_names: vec![
+ "original_payment_authorized_currency",
+ "original_payment_authorized_amount",
+ ],
+ })
+ .attach_printable(format!(
+ "Invalid connector_mandate_details provided for connector {:?}",
+ migrating_merchant_connector_id
+ ))?
+ }
+ }
+ (_, Some(_)) => (),
+ (_, None) => Err(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "merchant_connector_id",
+ })
+ .attach_printable_lazy(|| {
+ format!(
+ "{:?} invalid merchant connector id in connector_mandate_details",
+ migrating_merchant_connector_id
+ )
+ })?,
+ }
}
Ok(())
}
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index f26ed588a01..6a2689da400 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -67,7 +67,7 @@ impl<F, Req: Clone> From<&types::RouterData<F, Req, types::PaymentsResponseData>
pub async fn save_payment_method<FData>(
state: &SessionState,
connector_name: String,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
save_payment_method_data: SavePaymentMethodData<FData>,
customer_id: Option<id_type::CustomerId>,
merchant_account: &domain::MerchantAccount,
@@ -657,7 +657,7 @@ where
pub async fn save_payment_method<FData>(
_state: &SessionState,
_connector_name: String,
- _merchant_connector_id: Option<String>,
+ _merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
_save_payment_method_data: SavePaymentMethodData<FData>,
_customer_id: Option<id_type::CustomerId>,
_merchant_account: &domain::MerchantAccount,
@@ -983,7 +983,7 @@ pub fn add_connector_mandate_details_in_payment_method(
payment_method_type: Option<storage_enums::PaymentMethodType>,
authorized_amount: Option<i64>,
authorized_currency: Option<storage_enums::Currency>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
connector_mandate_id: Option<String>,
) -> Option<storage::PaymentsMandateReference> {
let mut mandate_details = HashMap::new();
@@ -1011,7 +1011,7 @@ pub fn update_connector_mandate_details_in_payment_method(
payment_method_type: Option<storage_enums::PaymentMethodType>,
authorized_amount: Option<i64>,
authorized_currency: Option<storage_enums::Currency>,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
connector_mandate_id: Option<String>,
) -> RouterResult<Option<serde_json::Value>> {
let mandate_reference = match payment_method.connector_mandate_details {
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 1f24298d998..57c4152ee29 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -2763,7 +2763,7 @@ pub async fn get_mca_from_profile_id(
merchant_account: &domain::MerchantAccount,
profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
- merchant_connector_id: Option<&String>,
+ merchant_connector_id: Option<&common_utils::id_type::MerchantConnectorAccountId>,
key_store: &domain::MerchantKeyStore,
) -> RouterResult<payment_helpers::MerchantConnectorAccountType> {
let merchant_connector_account = payment_helpers::get_merchant_connector_account(
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 47f843030ee..4a462b4bc62 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -307,7 +307,7 @@ async fn store_bank_details_in_payment_methods(
state: SessionState,
bank_account_details_resp: pm_auth_types::BankAccountCredentialsResponse,
connector_details: (&str, Secret<String>),
- mca_id: String,
+ mca_id: common_utils::id_type::MerchantConnectorAccountId,
) -> RouterResult<()> {
let key = key_store.key.get_inner().peek();
let db = &*state.clone().store;
@@ -753,7 +753,12 @@ pub async fn retrieve_payment_method_from_auth_service(
)
.await
.to_not_found_response(ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: auth_token.connector_details.mca_id.clone(),
+ id: auth_token
+ .connector_details
+ .mca_id
+ .get_string_repr()
+ .to_string()
+ .clone(),
})
.attach_printable(
"error while fetching merchant_connector_account from merchant_id and connector name",
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 5cbb1e9fdf6..448cebbf06e 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -251,7 +251,12 @@ pub struct RoutingAlgorithmHelpers<'h> {
}
#[derive(Clone, Debug)]
-pub struct ConnectNameAndMCAIdForProfile<'a>(pub FxHashSet<(&'a String, String)>);
+pub struct ConnectNameAndMCAIdForProfile<'a>(
+ pub FxHashSet<(
+ &'a String,
+ common_utils::id_type::MerchantConnectorAccountId,
+ )>,
+);
#[derive(Clone, Debug)]
pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a String>);
@@ -322,7 +327,7 @@ impl<'h> RoutingAlgorithmHelpers<'h> {
self.name_mca_id_set.0.contains(&(&choice.connector.to_string(), mca_id.clone())),
errors::ApiErrorResponse::InvalidRequestData {
message: format!(
- "connector with name '{}' and merchant connector account id '{}' not found for the given profile",
+ "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile",
choice.connector,
mca_id,
)
@@ -430,7 +435,7 @@ pub async fn validate_connectors_in_routing_config(
name_mca_id_set.contains(&(&choice.connector.to_string(), mca_id.clone())),
errors::ApiErrorResponse::InvalidRequestData {
message: format!(
- "connector with name '{}' and merchant connector account id '{}' not found for the given profile",
+ "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile",
choice.connector,
mca_id,
)
diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index 44bb67d0baf..8dc312b7f58 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -87,7 +87,7 @@ pub async fn verify_merchant_creds_for_applepay(
pub async fn get_verified_apple_domains_with_mid_mca_id(
state: SessionState,
merchant_id: common_utils::id_type::MerchantId,
- merchant_connector_id: String,
+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<
services::ApplicationResponse<verifications::ApplepayVerifiedDomainsResponse>,
errors::ApiErrorResponse,
@@ -111,7 +111,7 @@ pub async fn get_verified_apple_domains_with_mid_mca_id(
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
&merchant_id,
- merchant_connector_id.as_str(),
+ &merchant_connector_id,
&key_store,
)
.await
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
index c4fbf7ab081..e868fe930b7 100644
--- a/crates/router/src/core/verification/utils.rs
+++ b/crates/router/src/core/verification/utils.rs
@@ -16,7 +16,7 @@ pub async fn check_existence_and_add_domain_to_db(
state: &SessionState,
merchant_id: common_utils::id_type::MerchantId,
profile_id_from_auth_layer: Option<common_utils::id_type::ProfileId>,
- merchant_connector_id: String,
+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
domain_from_req: Vec<String>,
) -> CustomResult<Vec<String>, errors::ApiErrorResponse> {
let key_manager_state = &state.into();
@@ -116,7 +116,10 @@ pub async fn check_existence_and_add_domain_to_db(
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
- format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")
+ format!(
+ "Failed while updating MerchantConnectorAccount: id: {:?}",
+ merchant_connector_id
+ )
})?;
Ok(already_verified_domains.clone())
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 01a1046be36..0a0a35c23cc 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -1598,7 +1598,7 @@ async fn verify_webhook_source_verification_call(
fn get_connector_by_connector_name(
state: &SessionState,
connector_name: &str,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
) -> CustomResult<(ConnectorEnum, String), errors::ApiErrorResponse> {
let authentication_connector =
api_models::enums::convert_authentication_connector(connector_name);
@@ -1666,7 +1666,14 @@ async fn fetch_optional_mca_and_connector(
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&state.into(),
merchant_account.get_id(),
- connector_name_or_mca_id,
+ &common_utils::id_type::MerchantConnectorAccountId::wrap(
+ connector_name_or_mca_id.to_owned(),
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "Error while converting MerchanConnectorAccountId from string
+ ",
+ )?,
key_store,
)
.await
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 37613d5961e..403b79a0377 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1162,7 +1162,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
&self,
state: &KeyManagerState,
merchant_id: &id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
self.diesel_store
@@ -1179,7 +1179,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
- id: &str,
+ id: &id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
self.diesel_store
@@ -1223,7 +1223,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError> {
self.diesel_store
.delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
@@ -1236,7 +1236,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
async fn delete_merchant_connector_account_by_id(
&self,
- id: &str,
+ id: &id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError> {
self.diesel_store
.delete_merchant_connector_account_by_id(id)
@@ -1472,7 +1472,7 @@ impl PaymentAttemptInterface for KafkaStore {
payment_method: Option<Vec<common_enums::PaymentMethod>>,
payment_method_type: Option<Vec<common_enums::PaymentMethodType>>,
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
- merchant_connector_id: Option<Vec<String>>,
+ merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::DataStorageError> {
self.diesel_store
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 1908e01e94f..831804b0c6e 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -173,7 +173,7 @@ where
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
@@ -181,7 +181,7 @@ where
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
- id: &str,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
@@ -216,13 +216,13 @@ where
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError>;
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
async fn delete_merchant_connector_account_by_id(
&self,
- id: &str,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError>;
}
@@ -387,7 +387,7 @@ impl MerchantConnectorAccountInterface for Store {
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
let find_call = || async {
@@ -421,7 +421,7 @@ impl MerchantConnectorAccountInterface for Store {
&format!(
"{}_{}",
merchant_id.get_string_repr(),
- merchant_connector_id
+ merchant_connector_id.get_string_repr()
),
find_call,
&cache::ACCOUNTS_CACHE,
@@ -442,7 +442,7 @@ impl MerchantConnectorAccountInterface for Store {
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
- id: &str,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
let find_call = || async {
@@ -467,17 +467,22 @@ impl MerchantConnectorAccountInterface for Store {
#[cfg(feature = "accounts_cache")]
{
- cache::get_or_populate_in_memory(self, id, find_call, &cache::ACCOUNTS_CACHE)
- .await?
- .convert(
- state,
- key_store.key.get_inner(),
- common_utils::types::keymanager::Identifier::Merchant(
- key_store.merchant_id.clone(),
- ),
- )
- .await
- .change_context(errors::StorageError::DecryptionError)
+ cache::get_or_populate_in_memory(
+ self,
+ id.get_string_repr(),
+ find_call,
+ &cache::ACCOUNTS_CACHE,
+ )
+ .await?
+ .convert(
+ state,
+ key_store.key.get_inner(),
+ common_utils::types::keymanager::Identifier::Merchant(
+ key_store.merchant_id.clone(),
+ ),
+ )
+ .await
+ .change_context(errors::StorageError::DecryptionError)
}
}
@@ -593,7 +598,7 @@ impl MerchantConnectorAccountInterface for Store {
format!(
"{}_{}",
_merchant_id.get_string_repr(),
- _merchant_connector_id
+ _merchant_connector_id.get_string_repr()
)
.into(),
),
@@ -693,7 +698,7 @@ impl MerchantConnectorAccountInterface for Store {
format!(
"{}_{}",
_merchant_id.get_string_repr(),
- _merchant_connector_id
+ _merchant_connector_id.get_string_repr()
)
.into(),
),
@@ -775,7 +780,7 @@ impl MerchantConnectorAccountInterface for Store {
format!(
"{}_{}",
_merchant_id.get_string_repr(),
- _merchant_connector_id
+ _merchant_connector_id.get_string_repr()
)
.into(),
),
@@ -815,7 +820,7 @@ impl MerchantConnectorAccountInterface for Store {
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
let delete_call = || async {
@@ -890,7 +895,7 @@ impl MerchantConnectorAccountInterface for Store {
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
async fn delete_merchant_connector_account_by_id(
&self,
- id: &str,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
let delete_call = || async {
@@ -1092,7 +1097,7 @@ impl MerchantConnectorAccountInterface for MockDb {
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
match self
@@ -1102,7 +1107,7 @@ impl MerchantConnectorAccountInterface for MockDb {
.iter()
.find(|account| {
account.merchant_id == *merchant_id
- && account.merchant_connector_id == merchant_connector_id
+ && account.merchant_connector_id == *merchant_connector_id
})
.cloned()
.async_map(|account| async {
@@ -1131,7 +1136,7 @@ impl MerchantConnectorAccountInterface for MockDb {
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
- id: &str,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
match self
@@ -1139,7 +1144,7 @@ impl MerchantConnectorAccountInterface for MockDb {
.lock()
.await
.iter()
- .find(|account| account.get_id() == id)
+ .find(|account| account.get_id() == *id)
.cloned()
.async_map(|account| async {
account
@@ -1393,12 +1398,12 @@ impl MerchantConnectorAccountInterface for MockDb {
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
- merchant_connector_id: &str,
+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError> {
let mut accounts = self.merchant_connector_accounts.lock().await;
match accounts.iter().position(|account| {
account.merchant_id == *merchant_id
- && account.merchant_connector_id == merchant_connector_id
+ && account.merchant_connector_id == *merchant_connector_id
}) {
Some(index) => {
accounts.remove(index);
@@ -1416,10 +1421,10 @@ impl MerchantConnectorAccountInterface for MockDb {
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
async fn delete_merchant_connector_account_by_id(
&self,
- id: &str,
+ id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError> {
let mut accounts = self.merchant_connector_accounts.lock().await;
- match accounts.iter().position(|account| account.get_id() == id) {
+ match accounts.iter().position(|account| account.get_id() == *id) {
Some(index) => {
accounts.remove(index);
return Ok(true);
@@ -1562,7 +1567,10 @@ mod merchant_connector_account_cache_tests {
.unwrap(),
test_mode: None,
disabled: None,
- merchant_connector_id: merchant_connector_id.to_string(),
+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId::wrap(
+ merchant_connector_id.to_string(),
+ )
+ .unwrap(),
payment_methods_enabled: None,
connector_type: ConnectorType::FinOperations,
metadata: None,
@@ -1628,7 +1636,10 @@ mod merchant_connector_account_cache_tests {
let delete_call = || async {
db.delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&merchant_id,
- merchant_connector_id,
+ &common_utils::id_type::MerchantConnectorAccountId::wrap(
+ merchant_connector_id.to_string(),
+ )
+ .unwrap(),
)
.await
};
@@ -1685,7 +1696,7 @@ mod merchant_connector_account_cache_tests {
common_utils::id_type::MerchantId::try_from(std::borrow::Cow::from("test_merchant"))
.unwrap();
let connector_label = "stripe_USA";
- let id = "simple_id";
+ let id = common_utils::generate_merchant_connector_account_id_of_default_length();
let profile_id =
common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from("pro_max_ultra"))
.unwrap();
@@ -1723,7 +1734,7 @@ mod merchant_connector_account_cache_tests {
.unwrap();
let mca = domain::MerchantConnectorAccount {
- id: id.to_string(),
+ id: id.clone(),
merchant_id: merchant_id.clone(),
connector_name: "stripe".to_string(),
connector_account_details: domain::types::crypto_operation(
@@ -1803,7 +1814,7 @@ mod merchant_connector_account_cache_tests {
.await
.unwrap();
- let delete_call = || async { db.delete_merchant_connector_account_by_id(id).await };
+ let delete_call = || async { db.delete_merchant_connector_account_by_id(&id).await };
cache::publish_and_redact(
&db,
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index 343246e31a0..7616e83beef 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -410,7 +410,10 @@ pub async fn connector_create(
pub async fn connector_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<(common_utils::id_type::MerchantId, String)>,
+ path: web::Path<(
+ common_utils::id_type::MerchantId,
+ common_utils::id_type::MerchantConnectorAccountId,
+ )>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsRetrieve;
let (merchant_id, merchant_connector_id) = path.into_inner();
@@ -468,7 +471,7 @@ pub async fn connector_retrieve(
pub async fn connector_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::MerchantConnectorAccountId>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsRetrieve;
let id = path.into_inner();
@@ -623,7 +626,10 @@ pub async fn payment_connector_list_profile(
pub async fn connector_update(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<(common_utils::id_type::MerchantId, String)>,
+ path: web::Path<(
+ common_utils::id_type::MerchantId,
+ common_utils::id_type::MerchantConnectorAccountId,
+ )>,
json_payload: web::Json<api_models::admin::MerchantConnectorUpdate>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsUpdate;
@@ -680,7 +686,7 @@ pub async fn connector_update(
pub async fn connector_update(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::MerchantConnectorAccountId>,
json_payload: web::Json<api_models::admin::MerchantConnectorUpdate>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsUpdate;
@@ -733,7 +739,10 @@ pub async fn connector_update(
pub async fn connector_delete(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<(common_utils::id_type::MerchantId, String)>,
+ path: web::Path<(
+ common_utils::id_type::MerchantId,
+ common_utils::id_type::MerchantConnectorAccountId,
+ )>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsDelete;
let (merchant_id, merchant_connector_id) = path.into_inner();
@@ -784,7 +793,7 @@ pub async fn connector_delete(
pub async fn connector_delete(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<common_utils::id_type::MerchantConnectorAccountId>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsDelete;
let id = path.into_inner();
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index d064da0517f..b818fcfc1d4 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -59,7 +59,7 @@ pub async fn retrieve_apple_pay_verified_domains(
verification::get_verified_apple_domains_with_mid_mca_id(
state,
merchant_id.to_owned(),
- mca_id.to_string(),
+ mca_id.clone(),
)
},
auth::auth_type(
diff --git a/crates/router/src/services/kafka/authentication.rs b/crates/router/src/services/kafka/authentication.rs
index 42079525d8a..0dfda622d3b 100644
--- a/crates/router/src/services/kafka/authentication.rs
+++ b/crates/router/src/services/kafka/authentication.rs
@@ -37,7 +37,7 @@ pub struct KafkaAuthentication<'a> {
pub acs_signed_content: Option<&'a String>,
pub profile_id: &'a common_utils::id_type::ProfileId,
pub payment_id: Option<&'a String>,
- pub merchant_connector_id: &'a String,
+ pub merchant_connector_id: &'a common_utils::id_type::MerchantConnectorAccountId,
pub ds_trans_id: Option<&'a String>,
pub directory_server_id: Option<&'a String>,
pub acquirer_country_code: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/authentication_event.rs b/crates/router/src/services/kafka/authentication_event.rs
index 6213488a6d3..8d48e56a613 100644
--- a/crates/router/src/services/kafka/authentication_event.rs
+++ b/crates/router/src/services/kafka/authentication_event.rs
@@ -38,7 +38,7 @@ pub struct KafkaAuthenticationEvent<'a> {
pub acs_signed_content: Option<&'a String>,
pub profile_id: &'a common_utils::id_type::ProfileId,
pub payment_id: Option<&'a String>,
- pub merchant_connector_id: &'a String,
+ pub merchant_connector_id: &'a common_utils::id_type::MerchantConnectorAccountId,
pub ds_trans_id: Option<&'a String>,
pub directory_server_id: Option<&'a String>,
pub acquirer_country_code: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/dispute.rs b/crates/router/src/services/kafka/dispute.rs
index 6f789cbe94e..62a4310a640 100644
--- a/crates/router/src/services/kafka/dispute.rs
+++ b/crates/router/src/services/kafka/dispute.rs
@@ -31,7 +31,7 @@ pub struct KafkaDispute<'a> {
pub connector: &'a String,
pub evidence: &'a Secret<serde_json::Value>,
pub profile_id: Option<&'a common_utils::id_type::ProfileId>,
- pub merchant_connector_id: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,
}
impl<'a> KafkaDispute<'a> {
diff --git a/crates/router/src/services/kafka/dispute_event.rs b/crates/router/src/services/kafka/dispute_event.rs
index e4254912597..9b73cc2e510 100644
--- a/crates/router/src/services/kafka/dispute_event.rs
+++ b/crates/router/src/services/kafka/dispute_event.rs
@@ -32,7 +32,7 @@ pub struct KafkaDisputeEvent<'a> {
pub connector: &'a String,
pub evidence: &'a Secret<serde_json::Value>,
pub profile_id: Option<&'a common_utils::id_type::ProfileId>,
- pub merchant_connector_id: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,
}
impl<'a> KafkaDisputeEvent<'a> {
diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rs
index df566ad8a8d..08ec50f06b7 100644
--- a/crates/router/src/services/kafka/payment_attempt.rs
+++ b/crates/router/src/services/kafka/payment_attempt.rs
@@ -47,7 +47,7 @@ pub struct KafkaPaymentAttempt<'a> {
pub error_reason: Option<&'a String>,
pub multiple_capture_count: Option<i16>,
pub amount_capturable: MinorUnit,
- pub merchant_connector_id: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,
pub net_amount: MinorUnit,
pub unified_code: Option<&'a String>,
pub unified_message: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rs
index 95c5d9edd56..c6337a3b5f0 100644
--- a/crates/router/src/services/kafka/payment_attempt_event.rs
+++ b/crates/router/src/services/kafka/payment_attempt_event.rs
@@ -48,7 +48,7 @@ pub struct KafkaPaymentAttemptEvent<'a> {
pub error_reason: Option<&'a String>,
pub multiple_capture_count: Option<i16>,
pub amount_capturable: MinorUnit,
- pub merchant_connector_id: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,
pub net_amount: MinorUnit,
pub unified_code: Option<&'a String>,
pub unified_message: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rs
index 08733c46008..7a6254bd527 100644
--- a/crates/router/src/services/kafka/payout.rs
+++ b/crates/router/src/services/kafka/payout.rs
@@ -37,7 +37,7 @@ pub struct KafkaPayout<'a> {
pub error_code: Option<&'a String>,
pub business_country: Option<storage_enums::CountryAlpha2>,
pub business_label: Option<&'a String>,
- pub merchant_connector_id: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a id_type::MerchantConnectorAccountId>,
}
impl<'a> KafkaPayout<'a> {
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 775cc91ebef..681cd6fd110 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -201,7 +201,7 @@ pub struct ConnectorData {
pub connector: ConnectorEnum,
pub connector_name: types::Connector,
pub get_token: GetToken,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Clone)]
@@ -264,7 +264,7 @@ impl ConnectorData {
connectors: &Connectors,
name: &str,
connector_type: GetToken,
- connector_id: Option<String>,
+ connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
) -> CustomResult<Self, errors::ApiErrorResponse> {
let connector = Self::convert_connector(connectors, name)?;
let connector_name = api_enums::Connector::from_str(name)
@@ -284,7 +284,7 @@ impl ConnectorData {
connectors: &Connectors,
name: &str,
connector_type: GetToken,
- connector_id: Option<String>,
+ connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
) -> CustomResult<Self, errors::ApiErrorResponse> {
let connector = Self::convert_connector(connectors, name)?;
let payout_connector_name = api_enums::PayoutConnectors::from_str(name)
diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs
index c372a9c09bb..96656423897 100644
--- a/crates/router/src/types/storage.rs
+++ b/crates/router/src/types/storage.rs
@@ -74,7 +74,7 @@ use crate::types::api::routing;
pub struct RoutingData {
pub routed_through: Option<String>,
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub routing_info: PaymentRoutingInfo,
pub algorithm: Option<api_models::routing::StraightThroughAlgorithm>,
diff --git a/crates/router/src/types/storage/payment_method.rs b/crates/router/src/types/storage/payment_method.rs
index 31b039ab454..0e7bdb14d4a 100644
--- a/crates/router/src/types/storage/payment_method.rs
+++ b/crates/router/src/types/storage/payment_method.rs
@@ -95,10 +95,13 @@ pub struct PaymentsMandateReferenceRecord {
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-pub struct PaymentsMandateReference(pub HashMap<String, PaymentsMandateReferenceRecord>);
+pub struct PaymentsMandateReference(
+ pub HashMap<common_utils::id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>,
+);
impl Deref for PaymentsMandateReference {
- type Target = HashMap<String, PaymentsMandateReferenceRecord>;
+ type Target =
+ HashMap<common_utils::id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>;
fn deref(&self) -> &Self::Target {
&self.0
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 7e5f8571340..ce8419ad3c2 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -384,7 +384,10 @@ pub async fn find_mca_from_authentication_id_type(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: authentication.merchant_connector_id.to_string(),
+ id: authentication
+ .merchant_connector_id
+ .get_string_repr()
+ .to_string(),
},
)
}
@@ -430,7 +433,7 @@ pub async fn get_mca_from_payment_intent(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id,
+ id: merchant_connector_id.get_string_repr().to_string(),
},
)
}
@@ -528,7 +531,7 @@ pub async fn get_mca_from_payout_attempt(
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id,
+ id: merchant_connector_id.get_string_repr().to_string(),
},
)
}
diff --git a/crates/router/src/utils/connector_onboarding.rs b/crates/router/src/utils/connector_onboarding.rs
index 7813a7cb31f..3c1aea6f7a6 100644
--- a/crates/router/src/utils/connector_onboarding.rs
+++ b/crates/router/src/utils/connector_onboarding.rs
@@ -42,7 +42,7 @@ pub fn is_enabled(
pub async fn check_if_connector_exists(
state: &SessionState,
- connector_id: &str,
+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,
merchant_id: &common_utils::id_type::MerchantId,
) -> RouterResult<()> {
let key_manager_state = &state.into();
@@ -70,7 +70,7 @@ pub async fn check_if_connector_exists(
)
.await
.to_not_found_response(ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: connector_id.to_string(),
+ id: connector_id.get_string_repr().to_string(),
})?;
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
@@ -85,7 +85,7 @@ pub async fn check_if_connector_exists(
pub async fn set_tracking_id_in_configs(
state: &SessionState,
- connector_id: &str,
+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,
connector: enums::Connector,
) -> RouterResult<()> {
let timestamp = common_utils::date_time::now_unix_timestamp().to_string();
@@ -130,7 +130,7 @@ pub async fn set_tracking_id_in_configs(
pub async fn get_tracking_id_from_configs(
state: &SessionState,
- connector_id: &str,
+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,
connector: enums::Connector,
) -> RouterResult<String> {
let timestamp = state
@@ -144,14 +144,17 @@ pub async fn get_tracking_id_from_configs(
.attach_printable("Error getting data from configs table")?
.config;
- Ok(format!("{}_{}", connector_id, timestamp))
+ Ok(format!("{}_{}", connector_id.get_string_repr(), timestamp))
}
-fn build_key(connector_id: &str, connector: enums::Connector) -> String {
+fn build_key(
+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,
+ connector: enums::Connector,
+) -> String {
format!(
"{}_{}_{}",
consts::CONNECTOR_ONBOARDING_CONFIG_PREFIX,
connector,
- connector_id,
+ connector_id.get_string_repr(),
)
}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 16e1d6a7c22..b9be08c4354 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -47,7 +47,7 @@ pub fn construct_connector_data_old(
connector: types::api::BoxedConnector,
connector_name: types::Connector,
get_token: types::api::GetToken,
- merchant_connector_id: Option<String>,
+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
) -> types::api::ConnectorData {
types::api::ConnectorData {
connector: ConnectorEnum::Old(connector),
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index ed3c47b9c96..37e01cbbb5c 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -44,7 +44,7 @@ impl PaymentAttemptInterface for MockDb {
_payment_method: Option<Vec<PaymentMethod>>,
_payment_method_type: Option<Vec<PaymentMethodType>>,
_authentication_type: Option<Vec<AuthenticationType>>,
- _merchanat_connector_id: Option<Vec<String>>,
+ _merchanat_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<i64, StorageError> {
Err(StorageError::MockDbError)?
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index a599618615f..382abacfa78 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -295,7 +295,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
payment_method: Option<Vec<PaymentMethod>>,
payment_method_type: Option<Vec<PaymentMethodType>>,
authentication_type: Option<Vec<AuthenticationType>>,
- merchant_connector_id: Option<Vec<String>>,
+ merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
let conn = self
@@ -1064,7 +1064,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
payment_method: Option<Vec<PaymentMethod>>,
payment_method_type: Option<Vec<PaymentMethodType>>,
authentication_type: Option<Vec<AuthenticationType>>,
- merchant_connector_id: Option<Vec<String>>,
+ merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
|
refactor
|
add domain type for merchant_connector_account id (#5685)
|
ff430c983c56a2c4ecec13c78ccee020abd7a5d8
|
2024-08-12 05:48:33
|
github-actions
|
chore(version): 2024.08.12.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 071b214e797..7227e10cc65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,33 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.08.12.0
+
+### Features
+
+- **Connector:** Plaid connector configs ([#5545](https://github.com/juspay/hyperswitch/pull/5545)) ([`885428b`](https://github.com/juspay/hyperswitch/commit/885428bd1eee9fa2aad18eef1a1419702ebade75))
+- **core:** Use profile_id passed from auth layer within core functions ([#5553](https://github.com/juspay/hyperswitch/pull/5553)) ([`9fa631d`](https://github.com/juspay/hyperswitch/commit/9fa631d2b9df9a2ba429e197b8785885edd97798))
+- **events:** Add profile_id in payment_intents events and clickhouse ([#5573](https://github.com/juspay/hyperswitch/pull/5573)) ([`76b1460`](https://github.com/juspay/hyperswitch/commit/76b14601c843e328d168559840d8e22f78e59d3f))
+
+### Bug Fixes
+
+- **connector:** [Bambora Apac] failure on missing capture method and billing address requirement in mandates ([#5539](https://github.com/juspay/hyperswitch/pull/5539)) ([`3183a86`](https://github.com/juspay/hyperswitch/commit/3183a86ecde7192dcb3d4dd83105853344b04d61))
+- **docker:** Currency enum fix for docker config ([#5577](https://github.com/juspay/hyperswitch/pull/5577)) ([`920243e`](https://github.com/juspay/hyperswitch/commit/920243e1d41fd103cf4f20495e966dfd86a29d0f))
+- **payment_methods:** List cards on the basis of profiles ([#5584](https://github.com/juspay/hyperswitch/pull/5584)) ([`68574b2`](https://github.com/juspay/hyperswitch/commit/68574b28cd16c8f14f7a2fc9cb83836a509e174c))
+- Cache on multitenancy ([#5561](https://github.com/juspay/hyperswitch/pull/5561)) ([`74632ae`](https://github.com/juspay/hyperswitch/commit/74632aebea28b9f1b67c258eec995f7c0f4c99d0))
+
+### Refactors
+
+- **connector:** Connector template generation ([#5568](https://github.com/juspay/hyperswitch/pull/5568)) ([`8fdcabd`](https://github.com/juspay/hyperswitch/commit/8fdcabda3f2278f867d0e3acacbd02bae4951781))
+- **core:** Use hyperswitch_domain_models within the Payments Core instead of api_models ([#5511](https://github.com/juspay/hyperswitch/pull/5511)) ([`f81416e`](https://github.com/juspay/hyperswitch/commit/f81416e4df6fa430fd7f6eb910b55464cd72f3f0))
+- **merchant_account_v2:** Remove routing algorithms from merchant account and add version column ([#5527](https://github.com/juspay/hyperswitch/pull/5527)) ([`f1196be`](https://github.com/juspay/hyperswitch/commit/f1196be9055699421d5ec1148a4f0646da4b8fc7))
+- **openapi:** Add openapi support for generating v2 api-reference ([#5580](https://github.com/juspay/hyperswitch/pull/5580)) ([`92d76a3`](https://github.com/juspay/hyperswitch/commit/92d76a361a8babaa3433ead589f83268cb3d722f))
+- **payouts:** OpenAPI schemas and mintlify docs ([#5284](https://github.com/juspay/hyperswitch/pull/5284)) ([`942e63d`](https://github.com/juspay/hyperswitch/commit/942e63d9cd607913d4ef7d5a01493a1615a783c1))
+
+**Full Changelog:** [`2024.08.09.0...2024.08.12.0`](https://github.com/juspay/hyperswitch/compare/2024.08.09.0...2024.08.12.0)
+
+- - -
+
## 2024.08.09.0
### Features
|
chore
|
2024.08.12.0
|
e750a7332376a60843dde9e71adfa76ce48fd154
|
2023-07-07 18:31:21
|
DEEPANSHU BANSAL
|
fix(router): use `Connector` enum for `connector_name` field in `MerchantConnectorCreate` (#1637)
| false
|
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index e7164a2493f..895b137679c 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -391,8 +391,8 @@ pub struct MerchantConnectorCreate {
#[schema(value_type = ConnectorType, example = "payment_processor")]
pub connector_type: api_enums::ConnectorType,
/// Name of the Connector
- #[schema(example = "stripe")]
- pub connector_name: String,
+ #[schema(value_type = Connector, example = "stripe")]
+ pub connector_name: api_enums::Connector,
// /// Connector label for specific country and Business
#[serde(skip_deserializing)]
#[schema(example = "stripe_US_travel")]
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index d80744c83f8..9bb0d449a92 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -462,7 +462,7 @@ pub async fn create_payment_connector(
business_country,
&business_label,
req.business_sub_label.as_ref(),
- &req.connector_name,
+ &req.connector_name.to_string(),
);
let mut vec = Vec::new();
@@ -504,7 +504,7 @@ pub async fn create_payment_connector(
let merchant_connector_account = domain::MerchantConnectorAccount {
merchant_id: merchant_id.to_string(),
connector_type: req.connector_type.foreign_into(),
- connector_name: req.connector_name.clone(),
+ connector_name: req.connector_name.to_string(),
merchant_connector_id: utils::generate_id(consts::ID_LENGTH, "mca"),
connector_account_details: domain_types::encrypt(
req.connector_account_details.ok_or(
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 9b332e14ddf..abc252e2c9d 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -4986,9 +4986,7 @@
"$ref": "#/components/schemas/ConnectorType"
},
"connector_name": {
- "type": "string",
- "description": "Name of the Connector",
- "example": "stripe"
+ "$ref": "#/components/schemas/Connector"
},
"connector_label": {
"type": "string",
|
fix
|
use `Connector` enum for `connector_name` field in `MerchantConnectorCreate` (#1637)
|
1da411e67a2e30e773beb87228cd2fb1fd4b1507
|
2023-06-22 20:32:01
|
Narayan Bhat
|
fix(errors): use `format!()` for `RefundNotPossibleError` (#1518)
| false
|
diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs
index 75f12b7ec67..edbf2763fb5 100644
--- a/crates/router/src/core/errors/api_error_response.rs
+++ b/crates/router/src/core/errors/api_error_response.rs
@@ -411,7 +411,7 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
}
Self::ReturnUrlUnavailable => AER::NotFound(ApiError::new("HE", 3, "Return URL is not configured and not passed in payments request", None)),
Self::RefundNotPossible { connector } => {
- AER::BadRequest(ApiError::new("HE", 3, "This refund is not possible through Hyperswitch. Please raise the refund through {connector} dashboard", None))
+ AER::BadRequest(ApiError::new("HE", 3, format!("This refund is not possible through Hyperswitch. Please raise the refund through {connector} dashboard"), None))
}
Self::MandateValidationFailed { reason } => {
AER::BadRequest(ApiError::new("HE", 3, "Mandate Validation Failed", Some(Extra { reason: Some(reason.clone()), ..Default::default() })))
|
fix
|
use `format!()` for `RefundNotPossibleError` (#1518)
|
42cd769407f4a30e50d5b9826677a4dd310d97f4
|
2024-06-11 20:22:20
|
Chethan Rao
|
feat(metrics): add support for gauge metrics and include IMC metrics (#4939)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index f4a6a66cd61..81516ee8b6b 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -112,6 +112,7 @@ otel_exporter_otlp_endpoint = "http://localhost:4317" # endpoint to send metrics
otel_exporter_otlp_timeout = 5000 # timeout (in milliseconds) for sending metrics and traces
use_xray_generator = false # Set this to true for AWS X-ray compatible traces
route_to_trace = ["*/confirm"]
+bg_metrics_collection_interval_in_secs = 15 # Interval for collecting the metrics in background thread
# This section provides some secret values.
[secrets]
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index a097e1b66dc..9ab790b8ee8 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -139,6 +139,7 @@ otel_exporter_otlp_endpoint = "http://localhost:4317" # endpoint to send metrics
otel_exporter_otlp_timeout = 5000 # timeout (in milliseconds) for sending metrics and traces
use_xray_generator = false # Set this to true for AWS X-ray compatible traces
route_to_trace = ["*/confirm"]
+bg_metrics_collection_interval_in_secs = 15 # Interval for collecting the metrics in background thread
[lock_settings]
delay_between_retries_in_milliseconds = 500 # Delay between retries in milliseconds
diff --git a/config/development.toml b/config/development.toml
index 2a1ea746605..2fcac14fb1e 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -10,6 +10,7 @@ log_format = "default"
traces_enabled = false
metrics_enabled = false
use_xray_generator = false
+bg_metrics_collection_interval_in_secs = 15
# TODO: Update database credentials before running application
[master_database]
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 2a4fe369286..2cd93eade01 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -18,7 +18,8 @@ traces_enabled = false # Whether traces are
metrics_enabled = true # Whether metrics are enabled.
ignore_errors = false # Whether to ignore errors during traces or metrics pipeline setup.
otel_exporter_otlp_endpoint = "https://otel-collector:4317" # Endpoint to send metrics and traces to.
-use_xray_generator = false
+use_xray_generator = false # Set this to true for AWS X-ray compatible traces
+bg_metrics_collection_interval_in_secs = 15 # Interval for collecting the metrics in background thread
[master_database]
username = "db_user"
diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs
index 094f799cb27..8271e458b24 100644
--- a/crates/router/src/bin/router.rs
+++ b/crates/router/src/bin/router.rs
@@ -2,6 +2,7 @@ use router::{
configs::settings::{CmdLineConf, Settings},
core::errors::{ApplicationError, ApplicationResult},
logger,
+ routes::metrics,
};
#[tokio::main]
@@ -27,6 +28,11 @@ async fn main() -> ApplicationResult<()> {
logger::info!("Application started [{:?}] [{:?}]", conf.server, conf.log);
+ // Spawn a thread for collecting metrics at fixed intervals
+ metrics::bg_metrics_collector::spawn_metrics_collector(
+ &conf.log.telemetry.bg_metrics_collection_interval_in_secs,
+ );
+
#[allow(clippy::expect_used)]
let server = Box::pin(router::start_server(conf))
.await
diff --git a/crates/router/src/routes/metrics.rs b/crates/router/src/routes/metrics.rs
index 1123be1a874..18014c6e193 100644
--- a/crates/router/src/routes/metrics.rs
+++ b/crates/router/src/routes/metrics.rs
@@ -1,4 +1,8 @@
-use router_env::{counter_metric, global_meter, histogram_metric, metrics_context};
+pub mod bg_metrics_collector;
+pub mod request;
+pub mod utils;
+
+use router_env::{counter_metric, gauge_metric, global_meter, histogram_metric, metrics_context};
metrics_context!(CONTEXT);
global_meter!(GLOBAL_METER, "ROUTER_API");
@@ -133,5 +137,5 @@ counter_metric!(ACCESS_TOKEN_CACHE_HIT, GLOBAL_METER);
// A counter to indicate the access token cache miss
counter_metric!(ACCESS_TOKEN_CACHE_MISS, GLOBAL_METER);
-pub mod request;
-pub mod utils;
+// Metrics for In-memory cache
+gauge_metric!(CACHE_ENTRY_COUNT, GLOBAL_METER);
diff --git a/crates/router/src/routes/metrics/bg_metrics_collector.rs b/crates/router/src/routes/metrics/bg_metrics_collector.rs
new file mode 100644
index 00000000000..65cb7a13e5e
--- /dev/null
+++ b/crates/router/src/routes/metrics/bg_metrics_collector.rs
@@ -0,0 +1,46 @@
+use storage_impl::redis::cache;
+
+const DEFAULT_BG_METRICS_COLLECTION_INTERVAL_IN_SECS: u16 = 15;
+
+macro_rules! gauge_metrics_for_imc {
+ ($($cache:ident),*) => {
+ $(
+ {
+ cache::$cache.run_pending_tasks().await;
+
+ super::CACHE_ENTRY_COUNT.observe(
+ &super::CONTEXT,
+ cache::$cache.get_entry_count(),
+ &[super::request::add_attributes(
+ "cache_type",
+ stringify!($cache),
+ )],
+ );
+ }
+ )*
+ };
+}
+
+pub fn spawn_metrics_collector(metrics_collection_interval_in_secs: &Option<u16>) {
+ let metrics_collection_interval = metrics_collection_interval_in_secs
+ .unwrap_or(DEFAULT_BG_METRICS_COLLECTION_INTERVAL_IN_SECS);
+
+ tokio::spawn(async move {
+ loop {
+ gauge_metrics_for_imc!(
+ CONFIG_CACHE,
+ ACCOUNTS_CACHE,
+ ROUTING_CACHE,
+ CGRAPH_CACHE,
+ PM_FILTERS_CGRAPH_CACHE,
+ DECISION_MANAGER_CACHE,
+ SURCHARGE_CACHE
+ );
+
+ tokio::time::sleep(std::time::Duration::from_secs(
+ metrics_collection_interval.into(),
+ ))
+ .await
+ }
+ });
+}
diff --git a/crates/router_env/src/logger/config.rs b/crates/router_env/src/logger/config.rs
index 09d285a8628..135451f266e 100644
--- a/crates/router_env/src/logger/config.rs
+++ b/crates/router_env/src/logger/config.rs
@@ -103,6 +103,8 @@ pub struct LogTelemetry {
pub use_xray_generator: bool,
/// Route Based Tracing
pub route_to_trace: Option<Vec<String>>,
+ /// Interval for collecting the metrics (such as gauge) in background thread
+ pub bg_metrics_collection_interval_in_secs: Option<u16>,
}
/// Telemetry / tracing.
diff --git a/crates/router_env/src/metrics.rs b/crates/router_env/src/metrics.rs
index e145caace00..e75cacaa3c9 100644
--- a/crates/router_env/src/metrics.rs
+++ b/crates/router_env/src/metrics.rs
@@ -101,3 +101,22 @@ macro_rules! histogram_metric_i64 {
> = once_cell::sync::Lazy::new(|| $meter.i64_histogram($description).init());
};
}
+
+/// Create a [`ObservableGauge`][ObservableGauge] metric with the specified name and an optional description,
+/// associated with the specified meter. Note that the meter must be to a valid [`Meter`][Meter].
+///
+/// [ObservableGauge]: opentelemetry::metrics::ObservableGauge
+/// [Meter]: opentelemetry::metrics::Meter
+#[macro_export]
+macro_rules! gauge_metric {
+ ($name:ident, $meter:ident) => {
+ pub(crate) static $name: once_cell::sync::Lazy<
+ $crate::opentelemetry::metrics::ObservableGauge<u64>,
+ > = once_cell::sync::Lazy::new(|| $meter.u64_observable_gauge(stringify!($name)).init());
+ };
+ ($name:ident, $meter:ident, description:literal) => {
+ pub(crate) static $name: once_cell::sync::Lazy<
+ $crate::opentelemetry::metrics::ObservableGauge<u64>,
+ > = once_cell::sync::Lazy::new(|| $meter.u64_observable_gauge($description).init());
+ };
+}
diff --git a/crates/storage_impl/src/redis/cache.rs b/crates/storage_impl/src/redis/cache.rs
index e4efab0da33..6ad96be2795 100644
--- a/crates/storage_impl/src/redis/cache.rs
+++ b/crates/storage_impl/src/redis/cache.rs
@@ -207,6 +207,16 @@ impl Cache {
pub async fn remove(&self, key: CacheKey) {
self.inner.invalidate::<String>(&key.into()).await;
}
+
+ /// Performs any pending maintenance operations needed by the cache.
+ pub async fn run_pending_tasks(&self) {
+ self.inner.run_pending_tasks().await;
+ }
+
+ /// Returns an approximate number of entries in this cache.
+ pub fn get_entry_count(&self) -> u64 {
+ self.inner.entry_count()
+ }
}
#[instrument(skip_all)]
|
feat
|
add support for gauge metrics and include IMC metrics (#4939)
|
c35a5719eb08ff76a10d554a0e61d0af81ff26e6
|
2023-08-09 19:07:33
|
AkshayaFoiger
|
fix(connector): [Adyen] Response Handling in case of RefusalResponse (#1877)
| false
|
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 2471beba32a..ba4e83f4142 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -385,6 +385,17 @@ impl
),
}
}
+ adyen::AdyenRedirectRequestTypes::AdyenRefusal(req) => {
+ adyen::AdyenRedirectRequest {
+ details: adyen::AdyenRedirectRequestTypes::AdyenRefusal(
+ adyen::AdyenRefusal {
+ payload: req.payload,
+ type_of_redirection_result: None,
+ result_code: None,
+ },
+ ),
+ }
+ }
};
let adyen_request = types::RequestBody::log_and_get_request_body(
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 5bb232fdb1a..02f1b570ca9 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -226,6 +226,16 @@ pub struct AdyenRedirectRequest {
pub enum AdyenRedirectRequestTypes {
AdyenRedirection(AdyenRedirection),
AdyenThreeDS(AdyenThreeDS),
+ AdyenRefusal(AdyenRefusal),
+}
+
+#[derive(Debug, Clone, Serialize, serde::Deserialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenRefusal {
+ pub payload: String,
+ #[serde(rename = "type")]
+ pub type_of_redirection_result: Option<String>,
+ pub result_code: Option<String>,
}
#[derive(Debug, Clone, Serialize, serde::Deserialize, Eq, PartialEq)]
|
fix
|
[Adyen] Response Handling in case of RefusalResponse (#1877)
|
71315097dd01ee675b0e4df3087b930637de416c
|
2023-06-02 15:30:37
|
ItsMeShashank
|
fix(router/webhooks): correct webhook error mapping and make source verification optional for all connectors (#1333)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 3690b937999..fd55c2dc31b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3058,7 +3058,7 @@ dependencies = [
[[package]]
name = "opentelemetry"
version = "0.18.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"opentelemetry_api",
"opentelemetry_sdk",
@@ -3067,7 +3067,7 @@ dependencies = [
[[package]]
name = "opentelemetry-otlp"
version = "0.11.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"async-trait",
"futures",
@@ -3084,7 +3084,7 @@ dependencies = [
[[package]]
name = "opentelemetry-proto"
version = "0.1.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"futures",
"futures-util",
@@ -3096,7 +3096,7 @@ dependencies = [
[[package]]
name = "opentelemetry_api"
version = "0.18.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"fnv",
"futures-channel",
@@ -3111,7 +3111,7 @@ dependencies = [
[[package]]
name = "opentelemetry_sdk"
version = "0.18.0"
-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
dependencies = [
"async-trait",
"crossbeam-channel",
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index c5d160adc6d..380a96c6b57 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -11,6 +11,7 @@ use storage_models::enums as storage_enums;
use self::transformers as adyen;
use crate::{
configs::settings,
+ connector::utils as conn_utils,
consts,
core::errors::{self, CustomResult},
db::StorageInterface,
@@ -797,13 +798,17 @@ impl api::IncomingWebhook for Adyen {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/airwallex.rs b/crates/router/src/connector/airwallex.rs
index 36fef0c5dea..b508424d191 100644
--- a/crates/router/src/connector/airwallex.rs
+++ b/crates/router/src/connector/airwallex.rs
@@ -9,6 +9,7 @@ use transformers as airwallex;
use super::utils::{AccessTokenRequestInfo, RefundsRequestData};
use crate::{
configs::settings,
+ connector::utils as conn_utils,
core::{
errors::{self, CustomResult},
payments,
@@ -947,12 +948,17 @@ impl api::IncomingWebhook for Airwallex {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .find_config_by_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
- Ok(secret.config.into_bytes())
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rs
index c6bc558e9bc..419cee8f260 100644
--- a/crates/router/src/connector/authorizedotnet.rs
+++ b/crates/router/src/connector/authorizedotnet.rs
@@ -9,6 +9,7 @@ use transformers as authorizedotnet;
use crate::{
configs::settings,
+ connector::utils as conn_utils,
consts,
core::errors::{self, CustomResult},
db::StorageInterface,
@@ -684,7 +685,7 @@ impl api::IncomingWebhook for Authorizedotnet {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
let secret = match db.find_config_by_key(&key).await {
Ok(config) => Some(config),
Err(e) => {
diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rs
index 1a394a8d14e..a24b24a1901 100644
--- a/crates/router/src/connector/bluesnap.rs
+++ b/crates/router/src/connector/bluesnap.rs
@@ -15,6 +15,7 @@ use super::utils::{
};
use crate::{
configs::settings,
+ connector::utils as conn_utils,
consts,
core::{
errors::{self, CustomResult},
@@ -975,13 +976,17 @@ impl api::IncomingWebhook for Bluesnap {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .find_config_by_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret.config.into_bytes())
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
async fn verify_webhook_source(
diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs
index 8e1f6d2c053..d7f8335f25f 100644
--- a/crates/router/src/connector/braintree.rs
+++ b/crates/router/src/connector/braintree.rs
@@ -2,7 +2,7 @@ mod transformers;
use std::fmt::Debug;
-use error_stack::ResultExt;
+use error_stack::{IntoReport, ResultExt};
use self::transformers as braintree;
use crate::{
@@ -688,20 +688,20 @@ impl api::IncomingWebhook for Braintree {
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("braintree".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
fn get_webhook_event_type(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("braintree".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
fn get_webhook_resource_object(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<serde_json::Value, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("braintree".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
}
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index cc45ef619c5..74c2a32b274 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -1079,7 +1079,7 @@ impl api::IncomingWebhook for Checkout {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
let secret = match db.find_config_by_key(&key).await {
Ok(config) => Some(config),
Err(e) => {
diff --git a/crates/router/src/connector/coinbase.rs b/crates/router/src/connector/coinbase.rs
index 20805ced1d9..0fe23c244aa 100644
--- a/crates/router/src/connector/coinbase.rs
+++ b/crates/router/src/connector/coinbase.rs
@@ -523,13 +523,17 @@ impl api::IncomingWebhook for Coinbase {
db: &dyn db::StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs
index 301394c2afe..829c6e13b71 100644
--- a/crates/router/src/connector/cybersource.rs
+++ b/crates/router/src/connector/cybersource.rs
@@ -717,20 +717,20 @@ impl api::IncomingWebhook for Cybersource {
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("cybersource".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
fn get_webhook_event_type(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("cybersource".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
fn get_webhook_resource_object(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<serde_json::Value, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("cybersource".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
}
diff --git a/crates/router/src/connector/fiserv.rs b/crates/router/src/connector/fiserv.rs
index deb0371d370..463f37d0a89 100644
--- a/crates/router/src/connector/fiserv.rs
+++ b/crates/router/src/connector/fiserv.rs
@@ -3,7 +3,7 @@ mod transformers;
use std::fmt::Debug;
use base64::Engine;
-use error_stack::ResultExt;
+use error_stack::{IntoReport, ResultExt};
use ring::hmac;
use time::OffsetDateTime;
use transformers as fiserv;
@@ -684,20 +684,20 @@ impl api::IncomingWebhook for Fiserv {
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("fiserv".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
fn get_webhook_event_type(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("fiserv".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
fn get_webhook_resource_object(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<serde_json::Value, errors::ConnectorError> {
- Err(errors::ConnectorError::NotImplemented("fiserv".to_string()).into())
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
}
diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rs
index c2ba0745846..2986123952c 100644
--- a/crates/router/src/connector/globalpay.rs
+++ b/crates/router/src/connector/globalpay.rs
@@ -808,12 +808,17 @@ impl api::IncomingWebhook for Globalpay {
db: &dyn db::StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .find_config_by_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
- Ok(secret.config.into_bytes())
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_source_verification_signature(
diff --git a/crates/router/src/connector/iatapay.rs b/crates/router/src/connector/iatapay.rs
index 4e7306cbe84..271e37e1f6c 100644
--- a/crates/router/src/connector/iatapay.rs
+++ b/crates/router/src/connector/iatapay.rs
@@ -633,13 +633,17 @@ impl api::IncomingWebhook for Iatapay {
db: &dyn db::StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rs
index 97f26f6c970..43b6f6dc41e 100644
--- a/crates/router/src/connector/nuvei.rs
+++ b/crates/router/src/connector/nuvei.rs
@@ -852,12 +852,17 @@ impl api::IncomingWebhook for Nuvei {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("wh_mer_sec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
- Ok(secret)
+ let key = utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_source_verification_message(
diff --git a/crates/router/src/connector/opennode.rs b/crates/router/src/connector/opennode.rs
index fa66aa5e126..09bcf15b87e 100644
--- a/crates/router/src/connector/opennode.rs
+++ b/crates/router/src/connector/opennode.rs
@@ -9,6 +9,7 @@ use transformers as opennode;
use self::opennode::OpennodeWebhookDetails;
use crate::{
configs::settings,
+ connector::utils as conn_utils,
core::errors::{self, CustomResult},
db, headers,
services::{self, ConnectorIntegration},
@@ -527,13 +528,17 @@ impl api::IncomingWebhook for Opennode {
db: &dyn db::StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/rapyd.rs b/crates/router/src/connector/rapyd.rs
index 05c28efba53..65c131b71fb 100644
--- a/crates/router/src/connector/rapyd.rs
+++ b/crates/router/src/connector/rapyd.rs
@@ -702,13 +702,17 @@ impl api::IncomingWebhook for Rapyd {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("wh_mer_sec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_source_verification_message(
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 7190397ca78..fa56cc155fe 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -10,6 +10,7 @@ use self::transformers as stripe;
use super::utils::RefundsRequestData;
use crate::{
configs::settings,
+ connector::utils as conn_utils,
consts,
core::{
errors::{self, CustomResult},
@@ -1620,13 +1621,17 @@ impl api::IncomingWebhook for Stripe {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index af0a3345615..ce61f5620b1 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -10,6 +10,7 @@ use transformers as trustpay;
use super::utils::collect_and_sort_values_by_removing_signature;
use crate::{
configs::settings,
+ connector::utils as conn_utils,
consts,
core::{
errors::{self, CustomResult},
@@ -729,12 +730,17 @@ impl api::IncomingWebhook for Trustpay {
db: &dyn crate::db::StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
- Ok(secret)
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_dispute_details(
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 5c312dc5d9d..758839287ed 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -793,3 +793,8 @@ pub fn collect_and_sort_values_by_removing_signature(
values.sort();
values
}
+
+#[inline]
+pub fn get_webhook_merchant_secret_key(connector: &str, merchant_id: &str) -> String {
+ format!("whsec_verification_{connector}_{merchant_id}")
+}
diff --git a/crates/router/src/connector/worldline.rs b/crates/router/src/connector/worldline.rs
index f4d17b0af32..b5568bf22e8 100644
--- a/crates/router/src/connector/worldline.rs
+++ b/crates/router/src/connector/worldline.rs
@@ -713,13 +713,17 @@ impl api::IncomingWebhook for Worldline {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret)
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
diff --git a/crates/router/src/connector/worldpay.rs b/crates/router/src/connector/worldpay.rs
index 6839636d8a7..4469142c5cf 100644
--- a/crates/router/src/connector/worldpay.rs
+++ b/crates/router/src/connector/worldpay.rs
@@ -641,12 +641,17 @@ impl api::IncomingWebhook for Worldpay {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("wh_mer_sec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .get_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
- Ok(secret)
+ let key = utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_source_verification_message(
diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rs
index c4ee6d1e9c5..9e80f556540 100644
--- a/crates/router/src/connector/zen.rs
+++ b/crates/router/src/connector/zen.rs
@@ -11,6 +11,7 @@ use self::transformers::{ZenPaymentStatus, ZenWebhookTxnType};
use super::utils::RefundsRequestData;
use crate::{
configs::settings,
+ connector::utils as conn_utils,
core::{
errors::{self, CustomResult},
payments,
@@ -477,13 +478,17 @@ impl api::IncomingWebhook for Zen {
db: &dyn StorageInterface,
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .find_config_by_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
-
- Ok(secret.config.into_bytes())
+ let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
async fn verify_webhook_source(
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index e4ad140cf9c..cf328ba213c 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -629,7 +629,9 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>(
connector_name,
api::GetToken::Connector,
)
- .change_context(errors::ApiErrorResponse::InternalServerError)
+ .change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "invalid connnector name received".to_string(),
+ })
.attach_printable("Failed construction of ConnectorData")?;
let connector = connector.connector;
@@ -654,7 +656,7 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>(
let event_type = connector
.get_webhook_event_type(&request_details)
- .change_context(errors::ApiErrorResponse::InternalServerError)
+ .switch()
.attach_printable("Could not find event type in incoming webhook body")?;
let process_webhook_further = utils::lookup_webhook_event(
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index bec61f7e2a9..647d06de197 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -66,7 +66,8 @@ impl<T> WebhookApiErrorSwitch<T> for errors::CustomResult<T, errors::ConnectorEr
| errors::ConnectorError::WebhookReferenceIdNotFound
| errors::ConnectorError::WebhookEventTypeNotFound
| errors::ConnectorError::WebhookResourceObjectNotFound
- | errors::ConnectorError::WebhookBodyDecodingFailed => {
+ | errors::ConnectorError::WebhookBodyDecodingFailed
+ | errors::ConnectorError::WebhooksNotImplemented => {
Err(e).change_context(errors::ApiErrorResponse::WebhookBadRequest)
}
|
fix
|
correct webhook error mapping and make source verification optional for all connectors (#1333)
|
8223f8b29a3b236bf310986013aa0b0b1c9bd7d4
|
2023-07-25 18:42:10
|
SamraatBansal
|
fix(connector): [Tsys] Update endpoint and unit tests (#1730)
| false
|
diff --git a/crates/router/src/connector/tsys.rs b/crates/router/src/connector/tsys.rs
index 02a19395eef..222e20926de 100644
--- a/crates/router/src/connector/tsys.rs
+++ b/crates/router/src/connector/tsys.rs
@@ -197,7 +197,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
- "{}servlets/Transnox_API_server",
+ "{}servlets/transnox_api_server",
self.base_url(connectors)
))
}
@@ -276,7 +276,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
- "{}servlets/Transnox_API_server",
+ "{}servlets/transnox_api_server",
self.base_url(connectors)
))
}
@@ -357,7 +357,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
- "{}servlets/Transnox_API_server",
+ "{}servlets/transnox_api_server",
self.base_url(connectors),
))
}
@@ -431,7 +431,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
- "{}servlets/Transnox_API_server",
+ "{}servlets/transnox_api_server",
self.base_url(connectors)
))
}
@@ -509,7 +509,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
- "{}servlets/Transnox_API_server",
+ "{}servlets/transnox_api_server",
self.base_url(connectors),
))
}
diff --git a/crates/router/src/connector/tsys/transformers.rs b/crates/router/src/connector/tsys/transformers.rs
index fd555e67688..536f6d02eff 100644
--- a/crates/router/src/connector/tsys/transformers.rs
+++ b/crates/router/src/connector/tsys/transformers.rs
@@ -464,6 +464,7 @@ impl From<TsysTransactionDetails> for enums::RefundStatus {
fn from(item: TsysTransactionDetails) -> Self {
match item.transaction_status {
TsysTransactionStatus::Approved => Self::Pending,
+ //Connector calls refunds as Void
TsysTransactionStatus::Void => Self::Success,
TsysTransactionStatus::Declined => Self::Failure,
}
diff --git a/crates/router/tests/connectors/tsys.rs b/crates/router/tests/connectors/tsys.rs
index d744fedd059..51112b47245 100644
--- a/crates/router/tests/connectors/tsys.rs
+++ b/crates/router/tests/connectors/tsys.rs
@@ -1,4 +1,4 @@
-use std::str::FromStr;
+use std::{str::FromStr, time::Duration};
use cards::CardNumber;
use masking::Secret;
@@ -41,8 +41,9 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
-fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+fn payment_method_details(amount: i64) -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
+ amount,
payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_number: CardNumber::from_str("4111111111111111").unwrap(),
..utils::CCardType::default().0
@@ -56,7 +57,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
#[actix_web::test]
async fn should_only_authorize_payment() {
let response = CONNECTOR
- .authorize_payment(payment_method_details(), get_default_payment_info())
+ .authorize_payment(payment_method_details(101), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
@@ -66,7 +67,11 @@ async fn should_only_authorize_payment() {
#[actix_web::test]
async fn should_capture_authorized_payment() {
let response = CONNECTOR
- .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .authorize_and_capture_payment(
+ payment_method_details(100),
+ None,
+ get_default_payment_info(),
+ )
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
@@ -77,7 +82,7 @@ async fn should_capture_authorized_payment() {
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
- payment_method_details(),
+ payment_method_details(130),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
@@ -93,7 +98,7 @@ async fn should_partially_capture_authorized_payment() {
#[actix_web::test]
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
- .authorize_payment(payment_method_details(), get_default_payment_info())
+ .authorize_payment(payment_method_details(140), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
@@ -118,7 +123,7 @@ async fn should_sync_authorized_payment() {
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
- payment_method_details(),
+ payment_method_details(150),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
@@ -136,9 +141,15 @@ async fn should_void_authorized_payment() {
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
- payment_method_details(),
- None,
- None,
+ payment_method_details(160),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 160,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ Some(types::RefundsData {
+ refund_amount: 160,
+ ..utils::PaymentRefundType::default().0
+ }),
get_default_payment_info(),
)
.await
@@ -154,8 +165,11 @@ async fn should_refund_manually_captured_payment() {
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
- payment_method_details(),
- None,
+ payment_method_details(170),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 170,
+ ..utils::PaymentCaptureType::default().0
+ }),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
@@ -175,13 +189,20 @@ async fn should_partially_refund_manually_captured_payment() {
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
- payment_method_details(),
- None,
- None,
+ payment_method_details(180),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 180,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ Some(types::RefundsData {
+ refund_amount: 180,
+ ..utils::PaymentRefundType::default().0
+ }),
get_default_payment_info(),
)
.await
.unwrap();
+ tokio::time::sleep(Duration::from_secs(10)).await;
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
@@ -201,7 +222,7 @@ async fn should_sync_manually_captured_refund() {
#[actix_web::test]
async fn should_make_payment() {
let authorize_response = CONNECTOR
- .make_payment(payment_method_details(), get_default_payment_info())
+ .make_payment(payment_method_details(200), get_default_payment_info())
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
@@ -211,7 +232,7 @@ async fn should_make_payment() {
#[actix_web::test]
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR
- .make_payment(payment_method_details(), get_default_payment_info())
+ .make_payment(payment_method_details(210), get_default_payment_info())
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
@@ -238,7 +259,14 @@ async fn should_sync_auto_captured_payment() {
#[actix_web::test]
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
- .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .make_payment_and_refund(
+ payment_method_details(220),
+ Some(types::RefundsData {
+ refund_amount: 220,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
.await
.unwrap();
assert_eq!(
@@ -252,7 +280,7 @@ async fn should_refund_auto_captured_payment() {
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
- payment_method_details(),
+ payment_method_details(230),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
@@ -272,7 +300,7 @@ async fn should_partially_refund_succeeded_payment() {
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
- payment_method_details(),
+ payment_method_details(250),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
@@ -286,9 +314,14 @@ async fn should_refund_succeeded_payment_multiple_times() {
#[actix_web::test]
async fn should_sync_refund() {
let refund_response = CONNECTOR
- .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .make_payment_and_refund(
+ payment_method_details(100),
+ None,
+ get_default_payment_info(),
+ )
.await
.unwrap();
+ tokio::time::sleep(Duration::from_secs(10)).await;
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
@@ -376,7 +409,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
#[ignore = "Connector Refunds the payment on Void call for Auto Captured Payment"]
async fn should_fail_void_payment_for_auto_capture() {
let authorize_response = CONNECTOR
- .make_payment(payment_method_details(), get_default_payment_info())
+ .make_payment(payment_method_details(500), get_default_payment_info())
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
@@ -410,7 +443,7 @@ async fn should_fail_capture_for_invalid_payment() {
async fn should_fail_for_refund_amount_higher_than_payment_amount() {
let response = CONNECTOR
.make_payment_and_refund(
- payment_method_details(),
+ payment_method_details(100),
Some(types::RefundsData {
refund_amount: 150,
..utils::PaymentRefundType::default().0
|
fix
|
[Tsys] Update endpoint and unit tests (#1730)
|
0efeaa890f7dbcfa9440229d66d1a4f6b0f8b664
|
2025-03-21 05:58:52
|
github-actions
|
chore(version): 2025.03.21.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f0f2d1407f4..e55942911a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,32 @@
All notable changes to HyperSwitch will be documented here.
+- - -
+
+## 2025.03.21.0
+
+### Features
+
+- **router:** Return psp_tokenization_enabled in Customer PML ([#7519](https://github.com/juspay/hyperswitch/pull/7519)) ([`a341e82`](https://github.com/juspay/hyperswitch/commit/a341e82d4a2c7d3f3e44ce30cfe137b43b7993ee))
+
+### Bug Fixes
+
+- **analytics:** Retry implementation for forex crate call ([#7280](https://github.com/juspay/hyperswitch/pull/7280)) ([`e93fce2`](https://github.com/juspay/hyperswitch/commit/e93fce26b60b24301aa3fc3a0e87e56ec347816a))
+- **connector:**
+ - [CYBERSOURCE] send xid as none for external 3ds payments ([#7577](https://github.com/juspay/hyperswitch/pull/7577)) ([`a5be114`](https://github.com/juspay/hyperswitch/commit/a5be11498feb6553b995e35dee41d3908e18aebc))
+ - [SHIFT4, WORLDLINE] removed currencies CUC, STD, VEF from sandbox configs ([#7572](https://github.com/juspay/hyperswitch/pull/7572)) ([`97629ad`](https://github.com/juspay/hyperswitch/commit/97629ad18323976ab939f52afbe97c66f4e02949))
+
+### Refactors
+
+- **dynamic_fields:** Multiple SDK queries fixed ([#7380](https://github.com/juspay/hyperswitch/pull/7380)) ([`cbc262f`](https://github.com/juspay/hyperswitch/commit/cbc262fbdfe59a3984864be91325f3bb942736ae))
+
+### Miscellaneous Tasks
+
+- Update payment method configs for globalpay ([#7512](https://github.com/juspay/hyperswitch/pull/7512)) ([`23a2a0c`](https://github.com/juspay/hyperswitch/commit/23a2a0cf27d87fade674f342550a3ade4a2174ce))
+
+**Full Changelog:** [`2025.03.20.0...2025.03.21.0`](https://github.com/juspay/hyperswitch/compare/2025.03.20.0...2025.03.21.0)
+
+
- - -
## 2025.03.20.0
|
chore
|
2025.03.21.0
|
160acc8d49a08d23989a5653205646ae2e329bea
|
2023-11-22 19:59:27
|
Gnanasundari24
|
ci(Postman): Fix for automation test failure (#2949)
| false
|
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/request.json
index fb25f7ceebf..13a48ea7de3 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Recurring Payments - Create/request.json
@@ -23,7 +23,7 @@
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
- "amount_to_capture": 6540,
+ "amount_to_capture": 6570,
"customer_id": "StripeCustomer",
"email": "[email protected]",
"name": "John Doe",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
index 8fc4831ccc3..1cc1bce9807 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json
@@ -23,7 +23,7 @@
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
- "amount_to_capture": 6540,
+ "amount_to_capture": 8040,
"customer_id": "StripeCustomer",
"email": "[email protected]",
"name": "John Doe",
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/event.test.js
index 40445db0fb3..b06e6c3e115 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/event.test.js
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/event.test.js
@@ -88,22 +88,22 @@ if (jsonData?.amount) {
);
}
-// Response body should have value "6000" for "amount_received"
+// Response body should have value "6540" for "amount_received"
if (jsonData?.amount_received) {
pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'",
function () {
- pm.expect(jsonData.amount_received).to.eql(6000);
+ pm.expect(jsonData.amount_received).to.eql(6540);
},
);
}
-// Response body should have value "6540" for "amount_capturable"
+// Response body should have value "0" for "amount_capturable"
if (jsonData?.amount_capturable) {
pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'",
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
function () {
- pm.expect(jsonData.amount_capturable).to.eql(6540);
+ pm.expect(jsonData.amount_capturable).to.eql(0);
},
);
}
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/request.json
index 8975575ca40..8efb99d3c90 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/request.json
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Capture/request.json
@@ -18,7 +18,7 @@
}
},
"raw_json_formatted": {
- "amount_to_capture": 6000,
+ "amount_to_capture": 6540,
"statement_descriptor_name": "Joseph",
"statement_descriptor_suffix": "JS"
}
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Retrieve-copy/event.test.js
index 0bf6890ea3b..01f51559ed1 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Retrieve-copy/event.test.js
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Retrieve-copy/event.test.js
@@ -85,20 +85,20 @@ if (jsonData?.amount) {
);
}
-// Response body should have value "6000" for "amount_received"
+// Response body should have value "6540" for "amount_received"
if (jsonData?.amount_received) {
pm.test(
- "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'",
function () {
- pm.expect(jsonData.amount_received).to.eql(6000);
+ pm.expect(jsonData.amount_received).to.eql(6540);
},
);
}
-// Response body should have value "6540" for "amount_capturable"
+// Response body should have value "0" for "amount_capturable"
if (jsonData?.amount) {
pm.test(
- "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'",
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
function () {
pm.expect(jsonData.amount_capturable).to.eql(0);
},
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
index 2d7dbc507fb..f560d84ea73 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
@@ -66,9 +66,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
index 5c7196baa4f..ca68dd7045b 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/stripe/Payments/Payments - Update/request.json b/postman/collection-dir/stripe/Payments/Payments - Update/request.json
index 09e3dbb307e..1809770bd35 100644
--- a/postman/collection-dir/stripe/Payments/Payments - Update/request.json
+++ b/postman/collection-dir/stripe/Payments/Payments - Update/request.json
@@ -49,7 +49,9 @@
"city": "San Fransico",
"state": "California",
"zip": "94122",
- "country": "US"
+ "country": "US",
+ "first_name": "John",
+ "last_name": "Doe"
}
},
"shipping": {
@@ -60,7 +62,9 @@
"city": "San Fransico",
"state": "California",
"zip": "94122",
- "country": "US"
+ "country": "US",
+ "first_name": "John",
+ "last_name": "Doe"
}
},
"statement_descriptor_name": "joseph",
|
ci
|
Fix for automation test failure (#2949)
|
9112417caee51117c170af6096825c5b1b2bd0e0
|
2023-07-13 18:28:22
|
Swangi Kumari
|
test(connector): [Multisafepay] Add ui test for card 3ds (#1688)
| false
|
diff --git a/.github/testcases/ui_tests.json b/.github/testcases/ui_tests.json
index 40cb95f5d9e..ec36f5bdf11 100644
--- a/.github/testcases/ui_tests.json
+++ b/.github/testcases/ui_tests.json
@@ -1077,7 +1077,7 @@
"id": 180,
"name": "ACI Intial Mandate Payment",
"connector": "aci",
- "request": "{\"amount\":6540,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"05\",\"card_exp_year\":\"2034\",\"card_holder_name\":\"Jane Jones\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"167.85.214.112\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":1000,\"currency\":\"EUR\"}}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "request": "{\"amount\":6540,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"05\",\"card_exp_year\":\"2034\",\"card_holder_name\":\"Jane Jones\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"167.85.214.112\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":6500,\"currency\":\"EUR\"}}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"181": {
"id": 181,
@@ -1189,13 +1189,13 @@
},
"199": {
"id": 199,
- "name": "bluesnap card no three ds success",
+ "name": "bluesnap card no three ds success\" working fine",
"connector": "bluesnap",
"request": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"setup_future_usage\":\"off_session\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4263982640269299\",\"card_exp_month\":\"02\",\"card_exp_year\":\"2026\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"887\"}}}"
},
"200": {
"id": 200,
- "name": "blusnap 3ds card success",
+ "name": "blusnap 3ds card sucess >>>>.",
"connector": "bluesnap",
"request": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"off_session\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"5200000000001096\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2026\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"123\"}}}"
},
@@ -1210,5 +1210,35 @@
"name": "ADYEN PAYPAL",
"connector": "adyen_uk",
"request": "{\"amount\":1000,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":1000,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"payment_method\":\"wallet\",\"payment_method_type\":\"paypal\",\"payment_method_data\":{\"wallet\":{\"paypal_redirect\":{}}}}"
+ },
+ "203": {
+ "id": 203,
+ "name": "Adyen cards mandates",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":6000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":2000,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"3700 0000 0000 002\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"in sit\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NL\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NL\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "204": {
+ "id": 204,
+ "name": "adyen card mandate 0 dollar",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":0,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"3700 0000 0000 002\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"in sit\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NL\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"NL\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "205": {
+ "id": 205,
+ "name": "Adyen Afterpay success",
+ "connector": "adyen_uk",
+ "request": "{\"amount\":7000,\"currency\":\"AUD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"AU\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"AU\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"payment_method\":\"pay_later\",\"payment_method_type\":\"afterpay_clearpay\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"afterpay_clearpay_redirect\":{\"billing_name\":\"Swangi\",\"billing_email\":\"[email protected]\"}}}}"
+ },
+ "206": {
+ "id": 206,
+ "name": "card 3ds trustpay",
+ "connector": "trustpay_3ds",
+ "request": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"walley\",\"payment_method_data\":{\"card\":{\"card_number\":\"4200 0000 0000 0067\",\"card_exp_month\":\"03\",\"card_exp_year\":\"30\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"737\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"}}"
+ },
+ "207": {
+ "id": 207,
+ "name": "card 3ds success multisafepay",
+ "connector": "multisafepay",
+ "request": "{\"amount\":10000,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"setup_future_usage\":\"off_session\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"5500000000000004\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"CL-BRW1\",\"card_cvc\":\"123\"}}}"
}
-}
\ No newline at end of file
+}
diff --git a/.github/workflows/connector-ui-sanity-tests.yml b/.github/workflows/connector-ui-sanity-tests.yml
index ef914a21be5..c72e0ea8ee3 100644
--- a/.github/workflows/connector-ui-sanity-tests.yml
+++ b/.github/workflows/connector-ui-sanity-tests.yml
@@ -72,9 +72,9 @@ jobs:
connector:
# do not use more than 8 runners, try to group less time taking connectors together
- stripe
- - adyen_uk,shift4,worldline
+ - adyen_uk,shift4,worldline,multisafepay
- airwallex,bluesnap,checkout
- - paypal,mollie,payu
+ - paypal,mollie,payu,trustpay_3ds
steps:
- name: Checkout repository
diff --git a/crates/router/tests/connectors/multisafepay_ui.rs b/crates/router/tests/connectors/multisafepay_ui.rs
index 7866fb63d99..6126ce5fa8b 100644
--- a/crates/router/tests/connectors/multisafepay_ui.rs
+++ b/crates/router/tests/connectors/multisafepay_ui.rs
@@ -11,6 +11,38 @@ impl SeleniumTest for MultisafepaySeleniumTest {
}
}
+async fn should_make_multisafepay_3ds_payment_success(
+ web_driver: WebDriver,
+) -> Result<(), WebDriverError> {
+ let conn = MultisafepaySeleniumTest {};
+ conn.make_redirection_payment(
+ web_driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/207"))),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+async fn should_make_multisafepay_3ds_payment_failed(
+ web_driver: WebDriver,
+) -> Result<(), WebDriverError> {
+ let conn = MultisafepaySeleniumTest {};
+ conn.make_redirection_payment(
+ web_driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/93"))),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Assert(Assert::IsPresent("failed")),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
async fn should_make_gpay_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {
let conn = MultisafepaySeleniumTest {};
conn.make_redirection_payment(
@@ -45,6 +77,19 @@ async fn should_make_paypal_payment(web_driver: WebDriver) -> Result<(), WebDriv
#[test]
#[serial]
+fn should_make_multisafepay_3ds_payment_success_test() {
+ tester!(should_make_multisafepay_3ds_payment_success);
+}
+
+#[test]
+#[serial]
+fn should_make_multisafepay_3ds_payment_failed_test() {
+ tester!(should_make_multisafepay_3ds_payment_failed);
+}
+
+#[test]
+#[serial]
+#[ignore]
fn should_make_gpay_payment_test() {
tester!(should_make_gpay_payment);
}
|
test
|
[Multisafepay] Add ui test for card 3ds (#1688)
|
93d61d1053a834ac1e7bf6d5dd70053d28f3e7d5
|
2024-05-30 16:19:10
|
Narayan Bhat
|
feat: add a domain type for `customer_id` (#4705)
| false
|
diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs
index eeb10e62286..bdc1f894d92 100644
--- a/crates/api_models/src/customers.rs
+++ b/crates/api_models/src/customers.rs
@@ -1,4 +1,4 @@
-use common_utils::{consts, crypto, custom_serde, pii};
+use common_utils::{crypto, custom_serde, id_type, pii};
use masking::Secret;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
@@ -9,9 +9,8 @@ use crate::payments;
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
pub struct CustomerRequest {
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
- #[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- #[serde(default = "generate_customer_id")]
- pub customer_id: String,
+ #[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
#[serde(default = "unknown_merchant", skip)]
@@ -43,9 +42,9 @@ pub struct CustomerRequest {
#[derive(Debug, Clone, Serialize, ToSchema)]
pub struct CustomerResponse {
- /// The identifier for the customer object. If not provided the customer ID will be autogenerated.
- #[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: String,
+ /// The identifier for the customer object
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: id_type::CustomerId,
/// The customer's name
#[schema(max_length = 255, value_type = Option<String>, example = "Jon Test")]
pub name: crypto::OptionalEncryptableName,
@@ -78,16 +77,16 @@ pub struct CustomerResponse {
pub default_payment_method_id: Option<String>,
}
-#[derive(Default, Clone, Debug, Deserialize, Serialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CustomerId {
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
}
-#[derive(Default, Debug, Deserialize, Serialize, ToSchema)]
+#[derive(Debug, Deserialize, Serialize, ToSchema)]
pub struct CustomerDeleteResponse {
/// The identifier for the customer object
- #[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: String,
+ #[schema(value_type = String, max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: id_type::CustomerId,
/// Whether customer was deleted or not
#[schema(example = false)]
pub customer_deleted: bool,
@@ -99,10 +98,6 @@ pub struct CustomerDeleteResponse {
pub payment_methods_deleted: bool,
}
-pub fn generate_customer_id() -> String {
- common_utils::generate_id(consts::ID_LENGTH, "cus")
-}
-
fn unknown_merchant() -> String {
String::from("merchant_unknown")
}
diff --git a/crates/api_models/src/ephemeral_key.rs b/crates/api_models/src/ephemeral_key.rs
index 4df55db0587..42f5a087767 100644
--- a/crates/api_models/src/ephemeral_key.rs
+++ b/crates/api_models/src/ephemeral_key.rs
@@ -1,10 +1,12 @@
+use common_utils::id_type;
use serde;
use utoipa::ToSchema;
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Eq, PartialEq, ToSchema)]
pub struct EphemeralKeyCreateResponse {
/// customer_id to which this ephemeral key belongs to
- pub customer_id: String,
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: id_type::CustomerId,
/// time at which this ephemeral key was created
pub created_at: i64,
/// time at which this ephemeral key would expire
diff --git a/crates/api_models/src/events/customer.rs b/crates/api_models/src/events/customer.rs
index 29f56504218..f98061a2d8d 100644
--- a/crates/api_models/src/events/customer.rs
+++ b/crates/api_models/src/events/customer.rs
@@ -12,9 +12,9 @@ impl ApiEventMetric for CustomerDeleteResponse {
impl ApiEventMetric for CustomerRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
- Some(ApiEventsType::Customer {
- customer_id: self.customer_id.clone(),
- })
+ self.customer_id
+ .clone()
+ .map(|customer_id| ApiEventsType::Customer { customer_id })
}
}
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index d63d2b085b6..3d996ec05b0 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -4,7 +4,7 @@ use cards::CardNumber;
use common_utils::{
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
crypto::OptionalEncryptableName,
- pii,
+ id_type, pii,
types::{MinorUnit, Percentage, Surcharge},
};
use serde::de;
@@ -49,8 +49,8 @@ pub struct PaymentMethodCreate {
pub metadata: Option<pii::SecretSerdeValue>,
/// The unique identifier of the customer.
- #[schema(example = "cus_meowerunwiuwiwqw")]
- pub customer_id: Option<String>,
+ #[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// The card network
#[schema(example = "Visa")]
@@ -194,8 +194,8 @@ pub struct PaymentMethodResponse {
pub merchant_id: String,
/// The unique identifier of the customer.
- #[schema(example = "cus_meowerunwiuwiwqw")]
- pub customer_id: Option<String>,
+ #[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// The unique identifier of the Payment method
#[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")]
@@ -846,8 +846,8 @@ pub struct CustomerDefaultPaymentMethodResponse {
#[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")]
pub default_payment_method_id: Option<String>,
/// The unique identifier of the customer.
- #[schema(example = "cus_meowerunwiuwiwqw")]
- pub customer_id: String,
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: id_type::CustomerId,
/// The type of payment method use for the payment.
#[schema(value_type = PaymentMethod,example = "card")]
pub payment_method: api_enums::PaymentMethod,
@@ -866,8 +866,8 @@ pub struct CustomerPaymentMethod {
pub payment_method_id: String,
/// The unique identifier of the customer.
- #[schema(example = "cus_meowerunwiuwiwqw")]
- pub customer_id: String,
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: id_type::CustomerId,
/// The type of payment method use for the payment.
#[schema(value_type = PaymentMethod,example = "card")]
@@ -952,7 +952,8 @@ pub struct PaymentMethodId {
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
pub struct DefaultPaymentMethod {
- pub customer_id: String,
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: id_type::CustomerId,
pub payment_method_id: String,
}
//------------------------------------------------TokenizeService------------------------------------------------
@@ -1034,7 +1035,7 @@ pub struct TokenizedCardValue2 {
pub card_security_code: Option<String>,
pub card_fingerprint: Option<String>,
pub external_id: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub payment_method_id: Option<String>,
}
@@ -1045,7 +1046,7 @@ pub struct TokenizedWalletValue1 {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedWalletValue2 {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
@@ -1055,7 +1056,7 @@ pub struct TokenizedBankTransferValue1 {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedBankTransferValue2 {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
@@ -1065,5 +1066,5 @@ pub struct TokenizedBankRedirectValue1 {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedBankRedirectValue2 {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
}
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index c24193ef38b..30329e132b8 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -9,6 +9,7 @@ use common_utils::{
consts::default_payments_list_limit,
crypto,
ext_traits::{ConfigExt, Encode},
+ id_type,
pii::{self, Email},
types::MinorUnit,
};
@@ -177,10 +178,34 @@ mod client_secret_tests {
}
}
-#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema, PartialEq)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema, PartialEq)]
pub struct CustomerDetails {
/// The identifier for the customer.
- pub id: String,
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub id: id_type::CustomerId,
+
+ /// The customer's name
+ #[schema(max_length = 255, value_type = Option<String>, example = "John Doe")]
+ pub name: Option<Secret<String>>,
+
+ /// The customer's email address
+ #[schema(max_length = 255, value_type = Option<String>, example = "[email protected]")]
+ pub email: Option<Email>,
+
+ /// The customer's phone number
+ #[schema(value_type = Option<String>, max_length = 10, example = "3141592653")]
+ pub phone: Option<Secret<String>>,
+
+ /// The country code for the customer's phone number
+ #[schema(max_length = 2, example = "+1")]
+ pub phone_country_code: Option<String>,
+}
+
+#[derive(Debug, serde::Serialize, Clone, ToSchema, PartialEq)]
+pub struct CustomerDetailsResponse {
+ /// The identifier for the customer.
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub id: id_type::CustomerId,
/// The customer's name
#[schema(max_length = 255, value_type = Option<String>, example = "John Doe")]
@@ -277,9 +302,9 @@ pub struct PaymentsRequest {
/// Passing this object creates a new customer or attaches an existing customer to the payment
pub customer: Option<CustomerDetails>,
- /// The identifier for the customer object.
- #[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: Option<String>,
+ /// The identifier for the customer
+ #[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// The customer's email address.
/// This field will be deprecated soon, use the customer object instead
@@ -762,7 +787,7 @@ pub struct VerifyRequest {
// The merchant_id is generated through api key
// and is later passed in the struct
pub merchant_id: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub email: Option<Email>,
pub name: Option<Secret<String>>,
pub phone: Option<Secret<String>>,
@@ -3239,14 +3264,16 @@ pub struct PaymentsResponse {
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
/// This field will be deprecated soon. Please refer to `customer.id`
#[schema(
- max_length = 255,
+ max_length = 64,
+ min_length = 1,
example = "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- deprecated
+ deprecated,
+ value_type = Option<String>,
)]
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
/// Details of customer attached to this payment
- pub customer: Option<CustomerDetails>,
+ pub customer: Option<CustomerDetailsResponse>,
/// A description of the payment
#[schema(example = "It's my first payment request")]
@@ -3534,8 +3561,13 @@ pub struct ExternalAuthenticationDetailsResponse {
#[serde(deny_unknown_fields)]
pub struct PaymentListConstraints {
/// The identifier for customer
- #[schema(example = "cus_meowuwunwiuwiwqw")]
- pub customer_id: Option<String>,
+ #[schema(
+ max_length = 64,
+ min_length = 1,
+ example = "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ value_type = Option<String>,
+ )]
+ pub customer_id: Option<id_type::CustomerId>,
/// A cursor for use in pagination, fetch the next list after some object
#[schema(example = "pay_fafa124123")]
@@ -3632,7 +3664,7 @@ pub struct PaymentListFilterConstraints {
/// The identifier for business profile
pub profile_id: Option<String>,
/// The identifier for customer
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
/// The limit on the number of objects. The default limit is 10 and max limit is 20
#[serde(default = "default_payments_list_limit")]
pub limit: u32,
@@ -3716,7 +3748,7 @@ pub struct VerifyResponse {
pub merchant_id: Option<String>,
// pub status: enums::VerifyStatus,
pub client_secret: Option<Secret<String>>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub email: crypto::OptionalEncryptableEmail,
pub name: crypto::OptionalEncryptableName,
pub phone: crypto::OptionalEncryptablePhone,
@@ -3738,7 +3770,7 @@ pub struct PaymentsRedirectionResponse {
pub struct MandateValidationFields {
pub recurring_details: Option<RecurringDetails>,
pub confirm: Option<bool>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub mandate_data: Option<MandateData>,
pub setup_future_usage: Option<api_enums::FutureUsage>,
pub off_session: Option<bool>,
@@ -3847,7 +3879,7 @@ pub struct PgRedirectResponse {
pub payment_id: String,
pub status: api_enums::IntentStatus,
pub gateway_id: String,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub amount: Option<MinorUnit>,
}
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 815234d57ed..69c50da79c2 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -1,7 +1,7 @@
use cards::CardNumber;
use common_utils::{
consts::default_payouts_list_limit,
- crypto,
+ crypto, id_type,
pii::{self, Email},
};
use masking::Secret;
@@ -86,8 +86,8 @@ pub struct PayoutCreateRequest {
pub billing: Option<payments::Address>,
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
- #[schema(value_type = String, max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: Option<String>,
+ #[schema(value_type = Option<String>, max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// Set to true to confirm the payout without review, no further action required
#[schema(value_type = bool, example = true, default = false)]
@@ -314,7 +314,7 @@ pub struct Venmo {
pub telephone_number: Option<Secret<String>>,
}
-#[derive(Debug, Default, ToSchema, Clone, Serialize)]
+#[derive(Debug, ToSchema, Clone, Serialize)]
#[serde(deny_unknown_fields)]
pub struct PayoutCreateResponse {
/// Unique identifier for the payout. This ensures idempotency for multiple payouts
@@ -367,7 +367,7 @@ pub struct PayoutCreateResponse {
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
#[schema(value_type = String, max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
/// Set to true to confirm the payout without review, no further action required
#[schema(value_type = bool, example = true, default = false)]
@@ -564,8 +564,8 @@ pub struct PayoutIndividualDetails {
#[serde(deny_unknown_fields)]
pub struct PayoutListConstraints {
/// The identifier for customer
- #[schema(example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: Option<String>,
+ #[schema(value_type = Option<String>, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// A cursor for use in pagination, fetch the next list after some object
#[schema(example = "pay_fafa124123")]
@@ -605,8 +605,8 @@ pub struct PayoutListFilterConstraints {
/// The identifier for business profile
pub profile_id: Option<String>,
/// The identifier for customer
- #[schema(example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
- pub customer_id: Option<String>,
+ #[schema(value_type = Option<String>,example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
+ pub customer_id: Option<id_type::CustomerId>,
/// The limit on the number of objects. The default limit is 10 and max limit is 20
#[serde(default = "default_payouts_list_limit")]
pub limit: u32,
diff --git a/crates/cards/tests/basic.rs b/crates/cards/tests/basic.rs
index 709da760c1b..0f27c9e0288 100644
--- a/crates/cards/tests/basic.rs
+++ b/crates/cards/tests/basic.rs
@@ -78,7 +78,7 @@ fn test_card_expiration() {
// will panic on unwrap
let invalid_card_exp = CardExpiration::try_from((13, curr_year));
- assert_eq!(*card_exp.get_month().peek(), 3);
+ assert_eq!(*card_exp.get_month().peek(), curr_month);
assert_eq!(*card_exp.get_year().peek(), curr_year);
assert!(!card_exp.is_expired().unwrap());
diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs
index 94b53766db0..0ea826d15cd 100644
--- a/crates/common_utils/src/consts.rs
+++ b/crates/common_utils/src/consts.rs
@@ -83,3 +83,9 @@ pub const DEFAULT_TTL_FOR_EXTENDED_CARD_INFO: u16 = 15 * 60;
/// Max ttl for Extended card info in redis (in seconds)
pub const MAX_TTL_FOR_EXTENDED_CARD_INFO: u16 = 60 * 60 * 2;
+
+/// Max Length for MerchantReferenceId
+pub const MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH: u8 = 64;
+
+/// Minimum allowed length for MerchantReferenceId
+pub const MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH: u8 = 1;
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index c51749cf202..8939e07a76c 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -1,6 +1,8 @@
use common_enums::{PaymentMethod, PaymentMethodType};
use serde::Serialize;
+use crate::id_type;
+
pub trait ApiEventMetric {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
None
@@ -24,7 +26,7 @@ pub enum ApiEventsType {
payment_method_type: Option<PaymentMethodType>,
},
Customer {
- customer_id: String,
+ customer_id: id_type::CustomerId,
},
User {
//specified merchant_id will overridden on global defined
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
new file mode 100644
index 00000000000..5edbed799ff
--- /dev/null
+++ b/crates/common_utils/src/id_type.rs
@@ -0,0 +1,299 @@
+//! Common ID types
+
+use std::{
+ borrow::Cow,
+ fmt::{Debug, Display},
+};
+
+mod customer;
+
+pub use customer::CustomerId;
+use diesel::{
+ backend::Backend,
+ deserialize::FromSql,
+ expression::AsExpression,
+ serialize::{Output, ToSql},
+ sql_types,
+};
+use serde::{Deserialize, Serialize};
+use thiserror::Error;
+
+use crate::{fp_utils::when, generate_id_with_default_len};
+
+/// This functions checks for the input string to contain valid characters
+/// Returns Some(char) if there are any invalid characters, else None
+fn get_invalid_input_character(input_string: Cow<'static, str>) -> Option<char> {
+ input_string
+ .trim()
+ .chars()
+ .find(|char| !char.is_ascii_alphanumeric() && !matches!(char, '_' | '-'))
+}
+
+#[derive(Debug, PartialEq, Serialize, Clone, Eq)]
+/// A type for alphanumeric ids
+pub(crate) struct AlphaNumericId(String);
+
+#[derive(Debug, Deserialize, Serialize, Error, Eq, PartialEq)]
+#[error("value `{0}` contains invalid character `{1}`")]
+/// The error type for alphanumeric id
+pub(crate) struct AlphaNumericIdError(String, char);
+
+impl<'de> Deserialize<'de> for AlphaNumericId {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let deserialized_string = String::deserialize(deserializer)?;
+ Self::from(deserialized_string.into()).map_err(serde::de::Error::custom)
+ }
+}
+
+impl AlphaNumericId {
+ /// Creates a new alphanumeric id from string by applying validation checks
+ pub fn from(input_string: Cow<'static, str>) -> Result<Self, AlphaNumericIdError> {
+ let invalid_character = get_invalid_input_character(input_string.clone());
+
+ if let Some(invalid_character) = invalid_character {
+ Err(AlphaNumericIdError(
+ input_string.to_string(),
+ invalid_character,
+ ))?
+ }
+
+ Ok(Self(input_string.to_string()))
+ }
+
+ /// Create a new alphanumeric id without any validations
+ pub(crate) fn new_unchecked(input_string: String) -> Self {
+ Self(input_string)
+ }
+
+ /// Generate a new alphanumeric id of default length
+ pub(crate) fn new(prefix: &str) -> Self {
+ Self(generate_id_with_default_len(prefix))
+ }
+}
+
+/// A common type of id that can be used for merchant reference ids
+#[derive(Debug, Clone, Serialize, PartialEq, Eq, AsExpression)]
+#[diesel(sql_type = sql_types::Text)]
+pub(crate) struct MerchantReferenceId<const MAX_LENGTH: u8, const MIN_LENGTH: u8>(AlphaNumericId);
+
+/// Error generated from violation of constraints for MerchantReferenceId
+#[derive(Debug, Deserialize, Serialize, Error, PartialEq, Eq)]
+pub(crate) enum MerchantReferenceIdError<const MAX_LENGTH: u8, const MIN_LENGTH: u8> {
+ #[error("the maximum allowed length for this field is {MAX_LENGTH}")]
+ /// Maximum length of string violated
+ MaxLengthViolated,
+
+ #[error("the minimum required length for this field is {MIN_LENGTH}")]
+ /// Minimum length of string violated
+ MinLengthViolated,
+
+ #[error("{0}")]
+ /// Input contains invalid characters
+ AlphanumericIdError(AlphaNumericIdError),
+}
+
+impl From<AlphaNumericIdError> for MerchantReferenceIdError<0, 0> {
+ fn from(alphanumeric_id_error: AlphaNumericIdError) -> Self {
+ Self::AlphanumericIdError(alphanumeric_id_error)
+ }
+}
+
+impl<const MAX_LENGTH: u8, const MIN_LENGTH: u8> MerchantReferenceId<MAX_LENGTH, MIN_LENGTH> {
+ /// Generates new [MerchantReferenceId] from the given input string
+ pub fn from(
+ input_string: Cow<'static, str>,
+ ) -> Result<Self, MerchantReferenceIdError<MAX_LENGTH, MIN_LENGTH>> {
+ let trimmed_input_string = input_string.trim().to_string();
+ let length_of_input_string = u8::try_from(trimmed_input_string.len())
+ .map_err(|_| MerchantReferenceIdError::MaxLengthViolated)?;
+
+ when(length_of_input_string > MAX_LENGTH, || {
+ Err(MerchantReferenceIdError::MaxLengthViolated)
+ })?;
+
+ when(length_of_input_string < MIN_LENGTH, || {
+ Err(MerchantReferenceIdError::MinLengthViolated)
+ })?;
+
+ let alphanumeric_id = match AlphaNumericId::from(trimmed_input_string.into()) {
+ Ok(valid_alphanumeric_id) => valid_alphanumeric_id,
+ Err(error) => Err(MerchantReferenceIdError::AlphanumericIdError(error))?,
+ };
+
+ Ok(Self(alphanumeric_id))
+ }
+
+ /// Generate a new MerchantRefId of default length with the given prefix
+ pub fn new(prefix: &str) -> Self {
+ Self(AlphaNumericId::new(prefix))
+ }
+}
+
+impl<'de, const MAX_LENGTH: u8, const MIN_LENGTH: u8> Deserialize<'de>
+ for MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>
+{
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let deserialized_string = String::deserialize(deserializer)?;
+ Self::from(deserialized_string.into()).map_err(serde::de::Error::custom)
+ }
+}
+
+impl<DB, const MAX_LENGTH: u8, const MIN_LENGTH: u8> ToSql<sql_types::Text, DB>
+ for MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>
+where
+ DB: Backend,
+ String: ToSql<sql_types::Text, DB>,
+{
+ fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, DB>) -> diesel::serialize::Result {
+ self.0 .0.to_sql(out)
+ }
+}
+
+impl<const MAX_LENGTH: u8, const MIN_LENGTH: u8> Display
+ for MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>
+{
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", self.0 .0)
+ }
+}
+
+impl<DB, const MAX_LENGTH: u8, const MIN_LENGTH: u8> FromSql<sql_types::Text, DB>
+ for MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>
+where
+ DB: Backend,
+ String: FromSql<sql_types::Text, DB>,
+{
+ fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> {
+ let string_val = String::from_sql(value)?;
+ Ok(Self(AlphaNumericId::new_unchecked(string_val)))
+ }
+}
+
+#[cfg(test)]
+mod alphanumeric_id_tests {
+ #![allow(clippy::unwrap_used)]
+ use super::*;
+
+ const VALID_UNDERSCORE_ID_JSON: &str = r#""cus_abcdefghijklmnopqrstuv""#;
+ const EXPECTED_VALID_UNDERSCORE_ID: &str = "cus_abcdefghijklmnopqrstuv";
+
+ const VALID_HYPHEN_ID_JSON: &str = r#""cus-abcdefghijklmnopqrstuv""#;
+ const VALID_HYPHEN_ID_STRING: &str = "cus-abcdefghijklmnopqrstuv";
+
+ const INVALID_ID_WITH_SPACES: &str = r#""cus abcdefghijklmnopqrstuv""#;
+ const INVALID_ID_WITH_EMOJIS: &str = r#""cus_abc🦀""#;
+
+ #[test]
+ fn test_id_deserialize_underscore() {
+ let parsed_alphanumeric_id =
+ serde_json::from_str::<AlphaNumericId>(VALID_UNDERSCORE_ID_JSON);
+ let alphanumeric_id = AlphaNumericId::from(EXPECTED_VALID_UNDERSCORE_ID.into()).unwrap();
+
+ assert_eq!(parsed_alphanumeric_id.unwrap(), alphanumeric_id);
+ }
+
+ #[test]
+ fn test_id_deserialize_hyphen() {
+ let parsed_alphanumeric_id = serde_json::from_str::<AlphaNumericId>(VALID_HYPHEN_ID_JSON);
+ let alphanumeric_id = AlphaNumericId::from(VALID_HYPHEN_ID_STRING.into()).unwrap();
+
+ assert_eq!(parsed_alphanumeric_id.unwrap(), alphanumeric_id);
+ }
+
+ #[test]
+ fn test_id_deserialize_with_spaces() {
+ let parsed_alphanumeric_id = serde_json::from_str::<AlphaNumericId>(INVALID_ID_WITH_SPACES);
+
+ assert!(parsed_alphanumeric_id.is_err());
+ }
+
+ #[test]
+ fn test_id_deserialize_with_emojis() {
+ let parsed_alphanumeric_id = serde_json::from_str::<AlphaNumericId>(INVALID_ID_WITH_EMOJIS);
+
+ assert!(parsed_alphanumeric_id.is_err());
+ }
+}
+
+#[cfg(test)]
+mod merchant_reference_id_tests {
+ use super::*;
+
+ const VALID_REF_ID_JSON: &str = r#""cus_abcdefghijklmnopqrstuv""#;
+ const MAX_LENGTH: u8 = 36;
+ const MIN_LENGTH: u8 = 6;
+
+ const INVALID_REF_ID_JSON: &str = r#""cus abcdefghijklmnopqrstuv""#;
+ const INVALID_REF_ID_LENGTH: &str = r#""cus_abcdefghijklmnopqrstuvwxyzabcdefghij""#;
+
+ #[test]
+ fn test_valid_reference_id() {
+ let parsed_merchant_reference_id =
+ serde_json::from_str::<MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>>(VALID_REF_ID_JSON);
+
+ dbg!(&parsed_merchant_reference_id);
+
+ assert!(parsed_merchant_reference_id.is_ok());
+ }
+
+ #[test]
+ fn test_invalid_ref_id() {
+ let parsed_merchant_reference_id = serde_json::from_str::<
+ MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>,
+ >(INVALID_REF_ID_JSON);
+
+ assert!(parsed_merchant_reference_id.is_err());
+ }
+
+ #[test]
+ fn test_invalid_ref_id_error_message() {
+ let parsed_merchant_reference_id = serde_json::from_str::<
+ MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>,
+ >(INVALID_REF_ID_JSON);
+
+ let expected_error_message =
+ r#"value `cus abcdefghijklmnopqrstuv` contains invalid character ` `"#.to_string();
+
+ let error_message = parsed_merchant_reference_id
+ .err()
+ .map(|error| error.to_string());
+
+ assert_eq!(error_message, Some(expected_error_message));
+ }
+
+ #[test]
+ fn test_invalid_ref_id_length() {
+ let parsed_merchant_reference_id = serde_json::from_str::<
+ MerchantReferenceId<MAX_LENGTH, MIN_LENGTH>,
+ >(INVALID_REF_ID_LENGTH);
+
+ dbg!(&parsed_merchant_reference_id);
+
+ let expected_error_message =
+ format!("the maximum allowed length for this field is {MAX_LENGTH}");
+
+ assert!(parsed_merchant_reference_id
+ .is_err_and(|error_string| error_string.to_string().eq(&expected_error_message)));
+ }
+
+ #[test]
+ fn test_invalid_ref_id_length_error_type() {
+ let parsed_merchant_reference_id =
+ MerchantReferenceId::<MAX_LENGTH, MIN_LENGTH>::from(INVALID_REF_ID_LENGTH.into());
+
+ dbg!(&parsed_merchant_reference_id);
+
+ assert!(
+ parsed_merchant_reference_id.is_err_and(|error_type| matches!(
+ error_type,
+ MerchantReferenceIdError::MaxLengthViolated
+ ))
+ );
+ }
+}
diff --git a/crates/common_utils/src/id_type/customer.rs b/crates/common_utils/src/id_type/customer.rs
new file mode 100644
index 00000000000..4e1256504ff
--- /dev/null
+++ b/crates/common_utils/src/id_type/customer.rs
@@ -0,0 +1,111 @@
+use std::{borrow::Cow, fmt::Debug};
+
+use diesel::{
+ backend::Backend,
+ deserialize::FromSql,
+ expression::AsExpression,
+ serialize::{Output, ToSql},
+ sql_types, Queryable,
+};
+use error_stack::{Result, ResultExt};
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ consts::{MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH, MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH},
+ errors, generate_customer_id_of_default_length,
+ id_type::MerchantReferenceId,
+};
+
+/// A type for customer_id that can be used for customer ids
+#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, AsExpression)]
+#[diesel(sql_type = sql_types::Text)]
+pub struct CustomerId(
+ MerchantReferenceId<
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH,
+ MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ >,
+);
+
+impl Default for CustomerId {
+ fn default() -> Self {
+ generate_customer_id_of_default_length()
+ }
+}
+
+/// This is to display the `CustomerId` as CustomerId(abcd)
+impl Debug for CustomerId {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_tuple("CustomerId").field(&self.0 .0 .0).finish()
+ }
+}
+
+impl<DB> Queryable<sql_types::Text, DB> for CustomerId
+where
+ DB: Backend,
+ Self: FromSql<sql_types::Text, DB>,
+{
+ type Row = Self;
+
+ fn build(row: Self::Row) -> diesel::deserialize::Result<Self> {
+ Ok(row)
+ }
+}
+
+impl CustomerId {
+ pub(crate) fn new(
+ merchant_ref_id: MerchantReferenceId<
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH,
+ MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ >,
+ ) -> Self {
+ Self(merchant_ref_id)
+ }
+
+ /// Get the string representation of customer id
+ pub fn get_string_repr(&self) -> &str {
+ &self.0 .0 .0
+ }
+
+ /// Create a Customer id from string
+ pub fn from(input_string: Cow<'static, str>) -> Result<Self, errors::ValidationError> {
+ let merchant_ref_id = MerchantReferenceId::from(input_string).change_context(
+ errors::ValidationError::IncorrectValueProvided {
+ field_name: "customer_id",
+ },
+ )?;
+
+ Ok(Self(merchant_ref_id))
+ }
+}
+
+impl masking::SerializableSecret for CustomerId {}
+
+impl<DB> ToSql<sql_types::Text, DB> for CustomerId
+where
+ DB: Backend,
+ MerchantReferenceId<
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH,
+ MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ >: ToSql<sql_types::Text, DB>,
+{
+ fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, DB>) -> diesel::serialize::Result {
+ self.0.to_sql(out)
+ }
+}
+
+impl<DB> FromSql<sql_types::Text, DB> for CustomerId
+where
+ DB: Backend,
+ MerchantReferenceId<
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH,
+ MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ >: FromSql<sql_types::Text, DB>,
+{
+ fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> {
+ MerchantReferenceId::<
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH,
+ MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ >::from_sql(value)
+ .map(Self)
+ }
+}
diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs
index f24b67fde1b..d77442ad40f 100644
--- a/crates/common_utils/src/lib.rs
+++ b/crates/common_utils/src/lib.rs
@@ -2,6 +2,11 @@
#![warn(missing_docs, missing_debug_implementations)]
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]
+use crate::{
+ consts::ID_LENGTH,
+ id_type::{CustomerId, MerchantReferenceId},
+};
+
pub mod access_token;
pub mod consts;
pub mod crypto;
@@ -11,6 +16,7 @@ pub mod errors;
pub mod events;
pub mod ext_traits;
pub mod fp_utils;
+pub mod id_type;
pub mod macros;
pub mod pii;
#[allow(missing_docs)] // Todo: add docs
@@ -193,10 +199,22 @@ pub fn generate_id(length: usize, prefix: &str) -> String {
format!("{}_{}", prefix, nanoid::nanoid!(length, &consts::ALPHABETS))
}
+/// Generate a MerchantRefId with the default length
+fn generate_merchant_ref_id_with_default_length<const MAX_LENGTH: u8, const MIN_LENGTH: u8>(
+ prefix: &str,
+) -> MerchantReferenceId<MAX_LENGTH, MIN_LENGTH> {
+ MerchantReferenceId::<MAX_LENGTH, MIN_LENGTH>::new(prefix)
+}
+
+/// Generate a customer id with default length
+pub fn generate_customer_id_of_default_length() -> CustomerId {
+ CustomerId::new(generate_merchant_ref_id_with_default_length("cus"))
+}
+
/// Generate a nanoid with the given prefix and a default length
#[inline]
pub fn generate_id_with_default_len(prefix: &str) -> String {
- let len = consts::ID_LENGTH;
+ let len = ID_LENGTH;
format!("{}_{}", prefix, nanoid::nanoid!(len, &consts::ALPHABETS))
}
@@ -205,3 +223,31 @@ pub fn generate_id_with_default_len(prefix: &str) -> String {
pub fn generate_time_ordered_id(prefix: &str) -> String {
format!("{prefix}_{}", uuid::Uuid::now_v7().as_simple())
}
+
+#[cfg(test)]
+mod nanoid_tests {
+ #![allow(clippy::unwrap_used)]
+ use super::*;
+ use crate::{
+ consts::{
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH, MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ },
+ id_type::AlphaNumericId,
+ };
+
+ #[test]
+ fn test_generate_id_with_alphanumeric_id() {
+ let alphanumeric_id = AlphaNumericId::from(generate_id(10, "def").into());
+ assert!(alphanumeric_id.is_ok())
+ }
+
+ #[test]
+ fn test_generate_merchant_ref_id_with_default_length() {
+ let ref_id = MerchantReferenceId::<
+ MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH,
+ MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH,
+ >::from(generate_id_with_default_len("def").into());
+
+ assert!(ref_id.is_ok())
+ }
+}
diff --git a/crates/diesel_models/src/address.rs b/crates/diesel_models/src/address.rs
index e3d5ed73992..aa1d397797d 100644
--- a/crates/diesel_models/src/address.rs
+++ b/crates/diesel_models/src/address.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
@@ -19,7 +20,7 @@ pub struct AddressNew {
pub last_name: Option<Encryption>,
pub phone_number: Option<Encryption>,
pub country_code: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub merchant_id: String,
pub payment_id: Option<String>,
pub created_at: PrimitiveDateTime,
@@ -46,7 +47,7 @@ pub struct Address {
pub country_code: Option<String>,
pub created_at: PrimitiveDateTime,
pub modified_at: PrimitiveDateTime,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub merchant_id: String,
pub payment_id: Option<String>,
pub updated_by: String,
diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rs
index 0d1657136e0..63be0351a0c 100644
--- a/crates/diesel_models/src/customers.rs
+++ b/crates/diesel_models/src/customers.rs
@@ -1,5 +1,4 @@
-use common_enums::MerchantStorageScheme;
-use common_utils::pii;
+use common_utils::{id_type, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use time::PrimitiveDateTime;
@@ -10,7 +9,7 @@ use crate::{encryption::Encryption, schema::customers};
)]
#[diesel(table_name = customers)]
pub struct CustomerNew {
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub name: Option<Encryption>,
pub email: Option<Encryption>,
@@ -26,7 +25,7 @@ pub struct CustomerNew {
}
impl CustomerNew {
- pub fn update_storage_scheme(&mut self, storage_scheme: MerchantStorageScheme) {
+ pub fn update_storage_scheme(&mut self, storage_scheme: common_enums::MerchantStorageScheme) {
self.updated_by = Some(storage_scheme.to_string());
}
}
@@ -57,7 +56,7 @@ impl From<CustomerNew> for Customer {
#[diesel(table_name = customers)]
pub struct Customer {
pub id: i32,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub name: Option<Encryption>,
pub email: Option<Encryption>,
diff --git a/crates/diesel_models/src/ephemeral_key.rs b/crates/diesel_models/src/ephemeral_key.rs
index 77b9c647e43..1cf15e9bfda 100644
--- a/crates/diesel_models/src/ephemeral_key.rs
+++ b/crates/diesel_models/src/ephemeral_key.rs
@@ -1,7 +1,9 @@
+use common_utils::id_type;
+
pub struct EphemeralKeyNew {
pub id: String,
pub merchant_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub secret: String,
}
@@ -9,7 +11,7 @@ pub struct EphemeralKeyNew {
pub struct EphemeralKey {
pub id: String,
pub merchant_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub created_at: i64,
pub expires: i64,
pub secret: String,
diff --git a/crates/diesel_models/src/locker_mock_up.rs b/crates/diesel_models/src/locker_mock_up.rs
index eefaea86abd..e078b272cba 100644
--- a/crates/diesel_models/src/locker_mock_up.rs
+++ b/crates/diesel_models/src/locker_mock_up.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel::{Identifiable, Insertable, Queryable};
use crate::schema::locker_mock_up;
@@ -16,7 +17,7 @@ pub struct LockerMockUp {
pub card_exp_month: String,
pub name_on_card: Option<String>,
pub nickname: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub duplicate: Option<bool>,
pub card_cvc: Option<String>,
pub payment_method_id: Option<String>,
@@ -37,7 +38,7 @@ pub struct LockerMockUpNew {
pub name_on_card: Option<String>,
pub card_cvc: Option<String>,
pub payment_method_id: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub nickname: Option<String>,
pub enc_card_data: Option<String>,
}
diff --git a/crates/diesel_models/src/mandate.rs b/crates/diesel_models/src/mandate.rs
index 65576b08f23..9a32e1049d5 100644
--- a/crates/diesel_models/src/mandate.rs
+++ b/crates/diesel_models/src/mandate.rs
@@ -1,5 +1,5 @@
use common_enums::MerchantStorageScheme;
-use common_utils::pii;
+use common_utils::{id_type, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use masking::Secret;
use time::PrimitiveDateTime;
@@ -11,7 +11,7 @@ use crate::{enums as storage_enums, schema::mandate};
pub struct Mandate {
pub id: i32,
pub mandate_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub payment_method_id: String,
pub mandate_status: storage_enums::MandateStatus,
@@ -49,7 +49,7 @@ pub struct Mandate {
#[diesel(table_name = mandate)]
pub struct MandateNew {
pub mandate_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub payment_method_id: String,
pub mandate_status: storage_enums::MandateStatus,
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 2c992554671..c54ff2a429e 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -1,5 +1,5 @@
use common_enums::RequestIncrementalAuthorization;
-use common_utils::{pii, types::MinorUnit};
+use common_utils::{id_type, pii, types::MinorUnit};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
@@ -16,7 +16,7 @@ pub struct PaymentIntent {
pub amount: MinorUnit,
pub currency: Option<storage_enums::Currency>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub description: Option<String>,
pub return_url: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
@@ -73,7 +73,7 @@ pub struct PaymentIntentNew {
pub amount: MinorUnit,
pub currency: Option<storage_enums::Currency>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub description: Option<String>,
pub return_url: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
@@ -134,7 +134,7 @@ pub enum PaymentIntentUpdate {
ReturnUrlUpdate {
return_url: Option<String>,
status: Option<storage_enums::IntentStatus>,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
shipping_address_id: Option<String>,
billing_address_id: Option<String>,
updated_by: String,
@@ -155,7 +155,7 @@ pub enum PaymentIntentUpdate {
currency: storage_enums::Currency,
setup_future_usage: Option<storage_enums::FutureUsage>,
status: storage_enums::IntentStatus,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
shipping_address_id: Option<String>,
billing_address_id: Option<String>,
return_url: Option<String>,
@@ -216,7 +216,7 @@ pub struct PaymentIntentUpdateInternal {
pub currency: Option<storage_enums::Currency>,
pub status: Option<storage_enums::IntentStatus>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub return_url: Option<String>,
pub setup_future_usage: Option<storage_enums::FutureUsage>,
pub off_session: Option<bool>,
diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs
index f4d46b1d28f..d9c7a66a6b2 100644
--- a/crates/diesel_models/src/payment_method.rs
+++ b/crates/diesel_models/src/payment_method.rs
@@ -1,5 +1,5 @@
use common_enums::MerchantStorageScheme;
-use common_utils::pii;
+use common_utils::{id_type, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -11,7 +11,7 @@ use crate::{encryption::Encryption, enums as storage_enums, schema::payment_meth
#[diesel(table_name = payment_methods)]
pub struct PaymentMethod {
pub id: i32,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub payment_method_id: String,
#[diesel(deserialize_as = super::OptionalDieselArray<storage_enums::Currency>)]
@@ -50,7 +50,7 @@ pub struct PaymentMethod {
)]
#[diesel(table_name = payment_methods)]
pub struct PaymentMethodNew {
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub payment_method_id: String,
pub payment_method: Option<storage_enums::PaymentMethod>,
diff --git a/crates/diesel_models/src/payout_attempt.rs b/crates/diesel_models/src/payout_attempt.rs
index 765cde503e0..8544d2d273f 100644
--- a/crates/diesel_models/src/payout_attempt.rs
+++ b/crates/diesel_models/src/payout_attempt.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use serde::{self, Deserialize, Serialize};
use time::PrimitiveDateTime;
@@ -10,7 +11,7 @@ use crate::{enums as storage_enums, schema::payout_attempt};
pub struct PayoutAttempt {
pub payout_attempt_id: String,
pub payout_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub address_id: String,
pub connector: Option<String>,
@@ -34,7 +35,6 @@ pub struct PayoutAttempt {
#[derive(
Clone,
Debug,
- Default,
Eq,
PartialEq,
Insertable,
@@ -47,7 +47,7 @@ pub struct PayoutAttempt {
pub struct PayoutAttemptNew {
pub payout_attempt_id: String,
pub payout_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub address_id: String,
pub connector: Option<String>,
diff --git a/crates/diesel_models/src/payouts.rs b/crates/diesel_models/src/payouts.rs
index 4c6fe40c399..1549610d4e4 100644
--- a/crates/diesel_models/src/payouts.rs
+++ b/crates/diesel_models/src/payouts.rs
@@ -1,4 +1,4 @@
-use common_utils::pii;
+use common_utils::{id_type, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
use serde::{self, Deserialize, Serialize};
use time::PrimitiveDateTime;
@@ -12,7 +12,7 @@ use crate::{enums as storage_enums, schema::payouts};
pub struct Payouts {
pub payout_id: String,
pub merchant_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub address_id: String,
pub payout_type: storage_enums::PayoutType,
pub payout_method_id: Option<String>,
@@ -38,7 +38,6 @@ pub struct Payouts {
#[derive(
Clone,
Debug,
- Default,
Eq,
PartialEq,
Insertable,
@@ -51,7 +50,7 @@ pub struct Payouts {
pub struct PayoutsNew {
pub payout_id: String,
pub merchant_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub address_id: String,
pub payout_type: storage_enums::PayoutType,
pub payout_method_id: Option<String>,
diff --git a/crates/diesel_models/src/query/address.rs b/crates/diesel_models/src/query/address.rs
index ffcd740f076..cf3cd41c405 100644
--- a/crates/diesel_models/src/query/address.rs
+++ b/crates/diesel_models/src/query/address.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
use super::generics;
@@ -90,7 +91,7 @@ impl Address {
pub async fn update_by_merchant_id_customer_id(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
address: AddressUpdateInternal,
) -> StorageResult<Vec<Self>> {
diff --git a/crates/diesel_models/src/query/customers.rs b/crates/diesel_models/src/query/customers.rs
index e5ec96c8fc5..f1cc7a73481 100644
--- a/crates/diesel_models/src/query/customers.rs
+++ b/crates/diesel_models/src/query/customers.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
use super::generics;
@@ -17,7 +18,7 @@ impl CustomerNew {
impl Customer {
pub async fn update_by_customer_id_merchant_id(
conn: &PgPooledConn,
- customer_id: String,
+ customer_id: id_type::CustomerId,
merchant_id: String,
customer: CustomerUpdateInternal,
) -> StorageResult<Self> {
@@ -44,7 +45,7 @@ impl Customer {
pub async fn delete_by_customer_id_merchant_id(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(
@@ -58,7 +59,7 @@ impl Customer {
pub async fn find_by_customer_id_merchant_id(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> StorageResult<Self> {
generics::generic_find_by_id::<<Self as HasTable>::Table, _, _>(
@@ -84,7 +85,7 @@ impl Customer {
pub async fn find_optional_by_customer_id_merchant_id(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> StorageResult<Option<Self>> {
generics::generic_find_by_id_optional::<<Self as HasTable>::Table, _, _>(
diff --git a/crates/diesel_models/src/query/mandate.rs b/crates/diesel_models/src/query/mandate.rs
index 6925cd12b6a..584721ed8f3 100644
--- a/crates/diesel_models/src/query/mandate.rs
+++ b/crates/diesel_models/src/query/mandate.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use error_stack::report;
@@ -42,7 +43,7 @@ impl Mandate {
pub async fn find_by_merchant_id_customer_id(
conn: &PgPooledConn,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
diff --git a/crates/diesel_models/src/query/payment_method.rs b/crates/diesel_models/src/query/payment_method.rs
index d3ae4409ee8..8008fec0206 100644
--- a/crates/diesel_models/src/query/payment_method.rs
+++ b/crates/diesel_models/src/query/payment_method.rs
@@ -1,4 +1,5 @@
use async_bb8_diesel::AsyncRunQueryDsl;
+use common_utils::id_type;
use diesel::{
associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods,
QueryDsl, Table,
@@ -85,7 +86,7 @@ impl PaymentMethod {
pub async fn find_by_customer_id_merchant_id(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
limit: Option<i64>,
) -> StorageResult<Vec<Self>> {
@@ -103,7 +104,7 @@ impl PaymentMethod {
pub async fn get_count_by_customer_id_merchant_id_status(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
) -> StorageResult<i64> {
@@ -130,7 +131,7 @@ impl PaymentMethod {
pub async fn find_by_customer_id_merchant_id_status(
conn: &PgPooledConn,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: storage_enums::PaymentMethodStatus,
limit: Option<i64>,
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index b9adc162c47..089cb29aec5 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -1,4 +1,4 @@
-use common_utils::{self, pii, types::MinorUnit};
+use common_utils::{self, id_type, pii, types::MinorUnit};
use time::PrimitiveDateTime;
pub mod payment_attempt;
@@ -18,7 +18,7 @@ pub struct PaymentIntent {
pub amount: MinorUnit,
pub currency: Option<storage_enums::Currency>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub description: Option<String>,
pub return_url: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 5cf6f1219f5..d413e97289a 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -1,7 +1,7 @@
use common_enums as storage_enums;
use common_utils::{
consts::{PAYMENTS_LIST_MAX_LIMIT_V1, PAYMENTS_LIST_MAX_LIMIT_V2},
- pii,
+ id_type, pii,
types::MinorUnit,
};
use serde::{Deserialize, Serialize};
@@ -78,7 +78,7 @@ pub struct PaymentIntentNew {
pub amount: MinorUnit,
pub currency: Option<storage_enums::Currency>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub description: Option<String>,
pub return_url: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
@@ -135,7 +135,7 @@ pub enum PaymentIntentUpdate {
ReturnUrlUpdate {
return_url: Option<String>,
status: Option<storage_enums::IntentStatus>,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
shipping_address_id: Option<String>,
billing_address_id: Option<String>,
updated_by: String,
@@ -156,7 +156,7 @@ pub enum PaymentIntentUpdate {
currency: storage_enums::Currency,
setup_future_usage: Option<storage_enums::FutureUsage>,
status: storage_enums::IntentStatus,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
shipping_address_id: Option<String>,
billing_address_id: Option<String>,
return_url: Option<String>,
@@ -216,7 +216,7 @@ pub struct PaymentIntentUpdateInternal {
pub currency: Option<storage_enums::Currency>,
pub status: Option<storage_enums::IntentStatus>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub return_url: Option<String>,
pub setup_future_usage: Option<storage_enums::FutureUsage>,
pub off_session: Option<bool>,
@@ -458,7 +458,7 @@ pub struct PaymentIntentListParams {
pub authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
pub merchant_connector_id: Option<Vec<String>>,
pub profile_id: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub starting_after_id: Option<String>,
pub ending_before_id: Option<String>,
pub limit: Option<u32>,
diff --git a/crates/hyperswitch_domain_models/src/payouts.rs b/crates/hyperswitch_domain_models/src/payouts.rs
index 75a5a21fb7a..bb636d2dc48 100644
--- a/crates/hyperswitch_domain_models/src/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts.rs
@@ -3,7 +3,7 @@ pub mod payout_attempt;
pub mod payouts;
use common_enums as storage_enums;
-use common_utils::consts;
+use common_utils::{consts, id_type};
use time::PrimitiveDateTime;
pub enum PayoutFetchConstraints {
@@ -20,7 +20,7 @@ pub struct PayoutListParams {
pub status: Option<Vec<storage_enums::PayoutStatus>>,
pub payout_method: Option<Vec<common_enums::PayoutType>>,
pub profile_id: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub starting_after_id: Option<String>,
pub ending_before_id: Option<String>,
pub entity_type: Option<common_enums::PayoutEntityType>,
diff --git a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
index afe45b0a6a2..a19e694ff27 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs
@@ -1,5 +1,6 @@
use api_models::enums::PayoutConnectors;
use common_enums as storage_enums;
+use common_utils::{generate_customer_id_of_default_length, id_type};
use serde::{Deserialize, Serialize};
use storage_enums::MerchantStorageScheme;
use time::PrimitiveDateTime;
@@ -51,7 +52,7 @@ pub struct PayoutListFilters {
pub struct PayoutAttempt {
pub payout_attempt_id: String,
pub payout_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub address_id: String,
pub connector: Option<String>,
@@ -76,7 +77,7 @@ pub struct PayoutAttempt {
pub struct PayoutAttemptNew {
pub payout_attempt_id: String,
pub payout_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub address_id: String,
pub connector: Option<String>,
@@ -102,7 +103,7 @@ impl Default for PayoutAttemptNew {
Self {
payout_attempt_id: String::default(),
payout_id: String::default(),
- customer_id: String::default(),
+ customer_id: generate_customer_id_of_default_length(),
merchant_id: String::default(),
address_id: String::default(),
connector: None,
diff --git a/crates/hyperswitch_domain_models/src/payouts/payouts.rs b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
index 679e4488f7b..c9017fff5b9 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
@@ -1,5 +1,5 @@
use common_enums as storage_enums;
-use common_utils::pii;
+use common_utils::{id_type, pii};
use serde::{Deserialize, Serialize};
use storage_enums::MerchantStorageScheme;
use time::PrimitiveDateTime;
@@ -71,7 +71,7 @@ pub trait PayoutsInterface {
pub struct Payouts {
pub payout_id: String,
pub merchant_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub address_id: String,
pub payout_type: storage_enums::PayoutType,
pub payout_method_id: Option<String>,
@@ -96,7 +96,7 @@ pub struct Payouts {
pub struct PayoutsNew {
pub payout_id: String,
pub merchant_id: String,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub address_id: String,
pub payout_type: storage_enums::PayoutType,
pub payout_method_id: Option<String>,
@@ -124,7 +124,7 @@ impl Default for PayoutsNew {
Self {
payout_id: String::default(),
merchant_id: String::default(),
- customer_id: String::default(),
+ customer_id: common_utils::generate_customer_id_of_default_length(),
address_id: String::default(),
payout_type: storage_enums::PayoutType::default(),
payout_method_id: Option::default(),
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index d0481cecc53..b5d96a5c53f 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -1,5 +1,6 @@
use std::{collections::HashMap, marker::PhantomData};
+use common_utils::id_type;
use masking::Secret;
use crate::payment_address::PaymentAddress;
@@ -8,7 +9,7 @@ use crate::payment_address::PaymentAddress;
pub struct RouterData<Flow, Request, Response> {
pub flow: PhantomData<Flow>,
pub merchant_id: String,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub connector_customer: Option<String>,
pub connector: String,
pub payment_id: String,
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index c8e68586dad..5a4838f9b79 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -1,7 +1,7 @@
pub mod authentication;
pub mod fraud_check;
use api_models::payments::RequestSurchargeDetails;
-use common_utils::{consts, errors, ext_traits::OptionExt, pii, types as common_types};
+use common_utils::{consts, errors, ext_traits::OptionExt, id_type, pii, types as common_types};
use diesel_models::enums as storage_enums;
use error_stack::ResultExt;
use masking::Secret;
@@ -617,7 +617,7 @@ pub struct PayoutsData {
#[derive(Debug, Default, Clone)]
pub struct CustomerDetails {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub name: Option<Secret<String, masking::WithType>>,
pub email: Option<pii::Email>,
pub phone: Option<Secret<String, masking::WithType>>,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index fd0688ed293..237cddcf94e 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -529,6 +529,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentChargeRequest,
api_models::payments::PaymentChargeResponse,
api_models::refunds::ChargeRefunds,
+ api_models::payments::CustomerDetailsResponse,
)),
modifiers(&SecurityAddon)
)]
diff --git a/crates/pm_auth/src/connector/plaid/transformers.rs b/crates/pm_auth/src/connector/plaid/transformers.rs
index f163875958e..9d903914483 100644
--- a/crates/pm_auth/src/connector/plaid/transformers.rs
+++ b/crates/pm_auth/src/connector/plaid/transformers.rs
@@ -1,6 +1,7 @@
use std::collections::HashMap;
use common_enums::{PaymentMethod, PaymentMethodType};
+use common_utils::id_type;
use masking::{PeekInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -19,7 +20,7 @@ pub struct PlaidLinkTokenRequest {
#[derive(Debug, Serialize, Eq, PartialEq)]
pub struct User {
- pub client_user_id: String,
+ pub client_user_id: id_type::CustomerId,
}
impl TryFrom<&types::LinkTokenRouterData> for PlaidLinkTokenRequest {
diff --git a/crates/pm_auth/src/types.rs b/crates/pm_auth/src/types.rs
index d5c66b9c64a..f2a848c2f60 100644
--- a/crates/pm_auth/src/types.rs
+++ b/crates/pm_auth/src/types.rs
@@ -4,6 +4,7 @@ use std::marker::PhantomData;
use api::auth_service::{BankAccountCredentials, ExchangeToken, LinkToken};
use common_enums::{PaymentMethod, PaymentMethodType};
+use common_utils::id_type;
use masking::Secret;
#[derive(Debug, Clone)]
pub struct PaymentAuthRouterData<F, Request, Response> {
@@ -21,7 +22,7 @@ pub struct LinkTokenRequest {
pub client_name: String,
pub country_codes: Option<Vec<String>>,
pub language: Option<String>,
- pub user_info: Option<String>,
+ pub user_info: Option<id_type::CustomerId>,
}
#[derive(Debug, Clone)]
diff --git a/crates/router/src/compatibility/stripe/customers.rs b/crates/router/src/compatibility/stripe/customers.rs
index 3628c72a31c..67c0f973b96 100644
--- a/crates/router/src/compatibility/stripe/customers.rs
+++ b/crates/router/src/compatibility/stripe/customers.rs
@@ -1,5 +1,6 @@
pub mod types;
use actix_web::{web, HttpRequest, HttpResponse};
+use common_utils::id_type;
use error_stack::report;
use router_env::{instrument, tracing, Flow};
@@ -55,7 +56,7 @@ pub async fn customer_create(
pub async fn customer_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
) -> HttpResponse {
let payload = customer_types::CustomerId {
customer_id: path.into_inner(),
@@ -90,7 +91,7 @@ pub async fn customer_update(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
form_payload: web::Bytes,
) -> HttpResponse {
let payload: types::CustomerUpdateRequest = match qs_config.deserialize_bytes(&form_payload) {
@@ -102,7 +103,7 @@ pub async fn customer_update(
let customer_id = path.into_inner();
let mut cust_update_req: customer_types::CustomerRequest = payload.into();
- cust_update_req.customer_id = customer_id;
+ cust_update_req.customer_id = Some(customer_id);
let flow = Flow::CustomersUpdate;
@@ -132,7 +133,7 @@ pub async fn customer_update(
pub async fn customer_delete(
state: web::Data<routes::AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
) -> HttpResponse {
let payload = customer_types::CustomerId {
customer_id: path.into_inner(),
@@ -166,7 +167,7 @@ pub async fn customer_delete(
pub async fn list_customer_payment_method_api(
state: web::Data<routes::AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
json_payload: web::Query<payment_methods::PaymentMethodListRequest>,
) -> HttpResponse {
let payload = json_payload.into_inner();
@@ -193,7 +194,7 @@ pub async fn list_customer_payment_method_api(
auth.merchant_account,
auth.key_store,
Some(req),
- Some(customer_id.as_str()),
+ Some(&customer_id),
)
},
&auth::ApiKeyAuth,
diff --git a/crates/router/src/compatibility/stripe/customers/types.rs b/crates/router/src/compatibility/stripe/customers/types.rs
index 8298595bbc5..0e1a5d1a793 100644
--- a/crates/router/src/compatibility/stripe/customers/types.rs
+++ b/crates/router/src/compatibility/stripe/customers/types.rs
@@ -3,7 +3,7 @@ use std::{convert::From, default::Default};
use api_models::{payment_methods as api_types, payments};
use common_utils::{
crypto::Encryptable,
- date_time,
+ date_time, id_type,
pii::{self, Email},
};
use serde::{Deserialize, Serialize};
@@ -80,9 +80,9 @@ pub struct CustomerUpdateRequest {
pub tax_exempt: Option<String>, // not used
}
-#[derive(Default, Serialize, PartialEq, Eq)]
+#[derive(Serialize, PartialEq, Eq)]
pub struct CreateCustomerResponse {
- pub id: String,
+ pub id: id_type::CustomerId,
pub object: String,
pub created: u64,
pub description: Option<String>,
@@ -95,9 +95,9 @@ pub struct CreateCustomerResponse {
pub type CustomerRetrieveResponse = CreateCustomerResponse;
pub type CustomerUpdateResponse = CreateCustomerResponse;
-#[derive(Default, Serialize, PartialEq, Eq)]
+#[derive(Serialize, PartialEq, Eq)]
pub struct CustomerDeleteResponse {
- pub id: String,
+ pub id: id_type::CustomerId,
pub deleted: bool,
}
@@ -120,7 +120,7 @@ impl From<StripeAddressDetails> for payments::AddressDetails {
impl From<CreateCustomerRequest> for api::CustomerRequest {
fn from(req: CreateCustomerRequest) -> Self {
Self {
- customer_id: api_models::customers::generate_customer_id(),
+ customer_id: Some(common_utils::generate_customer_id_of_default_length()),
name: req.name,
phone: req.phone,
email: req.email,
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 0526eacb2e8..5df2ba14874 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -5,6 +5,7 @@ use common_utils::{
crypto::Encryptable,
date_time,
ext_traits::StringExt,
+ id_type,
pii::{IpAddress, SecretSerdeValue, UpiVpaMaskingStrategy},
types::MinorUnit,
};
@@ -246,7 +247,7 @@ pub struct StripePaymentIntentRequest {
pub amount_capturable: Option<i64>,
pub confirm: Option<bool>,
pub capture_method: Option<api_enums::CaptureMethod>,
- pub customer: Option<String>,
+ pub customer: Option<id_type::CustomerId>,
pub description: Option<String>,
pub payment_method_data: Option<StripePaymentMethodData>,
pub receipt_email: Option<Email>,
@@ -466,7 +467,7 @@ pub struct StripePaymentIntentResponse {
pub status: StripePaymentStatus,
pub client_secret: Option<masking::Secret<String>>,
pub created: Option<i64>,
- pub customer: Option<String>,
+ pub customer: Option<id_type::CustomerId>,
pub refunds: Option<Vec<stripe_refunds::StripeRefundResponse>>,
pub mandate: Option<String>,
pub metadata: Option<SecretSerdeValue>,
@@ -609,7 +610,7 @@ impl Charges {
#[derive(Clone, Debug, serde::Deserialize)]
#[serde(deny_unknown_fields)]
pub struct StripePaymentListConstraints {
- pub customer: Option<String>,
+ pub customer: Option<id_type::CustomerId>,
pub starting_after: Option<String>,
pub ending_before: Option<String>,
#[serde(default = "default_limit")]
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 9a1cf58f11b..2f01da29832 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -1,7 +1,7 @@
use std::str::FromStr;
use api_models::payments;
-use common_utils::{date_time, ext_traits::StringExt, pii as secret};
+use common_utils::{date_time, ext_traits::StringExt, id_type, pii as secret};
use error_stack::ResultExt;
use router_env::logger;
use serde::{Deserialize, Serialize};
@@ -152,7 +152,7 @@ impl From<Shipping> for payments::Address {
#[derive(Default, Deserialize, Clone)]
pub struct StripeSetupIntentRequest {
pub confirm: Option<bool>,
- pub customer: Option<String>,
+ pub customer: Option<id_type::CustomerId>,
pub connector: Option<Vec<api_enums::RoutableConnectors>>,
pub description: Option<String>,
pub currency: Option<String>,
@@ -461,7 +461,7 @@ pub struct StripeSetupIntentResponse {
pub metadata: Option<secret::SecretSerdeValue>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<time::PrimitiveDateTime>,
- pub customer: Option<String>,
+ pub customer: Option<id_type::CustomerId>,
pub refunds: Option<Vec<stripe_refunds::StripeRefundResponse>>,
pub mandate_id: Option<String>,
pub next_action: Option<StripeNextAction>,
@@ -538,7 +538,7 @@ impl From<payments::PaymentsResponse> for StripeSetupIntentResponse {
#[derive(Clone, Debug, serde::Deserialize)]
#[serde(deny_unknown_fields)]
pub struct StripePaymentListConstraints {
- pub customer: Option<String>,
+ pub customer: Option<id_type::CustomerId>,
pub starting_after: Option<String>,
pub ending_before: Option<String>,
#[serde(default = "default_limit")]
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index 8415453b6ae..2fefe996e88 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -1,6 +1,6 @@
use std::str::FromStr;
-use common_utils::pii::Email;
+use common_utils::{id_type, pii::Email};
use error_stack::report;
use masking::{ExposeInterface, Secret};
use reqwest::Url;
@@ -311,7 +311,7 @@ pub struct BankRedirectionPMData {
#[serde(rename = "customer.email")]
customer_email: Option<Email>,
#[serde(rename = "customer.merchantCustomerId")]
- merchant_customer_id: Option<Secret<String>>,
+ merchant_customer_id: Option<Secret<id_type::CustomerId>>,
merchant_transaction_id: Option<Secret<String>>,
}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 1c24009c54b..bed99a9fb66 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2,7 +2,7 @@
use api_models::payouts::PayoutMethodData;
use api_models::{enums, payments, webhooks};
use cards::CardNumber;
-use common_utils::{ext_traits::Encode, pii};
+use common_utils::{ext_traits::Encode, id_type, pii};
use error_stack::{report, ResultExt};
use masking::{ExposeInterface, PeekInterface};
use reqwest::Url;
@@ -1640,7 +1640,8 @@ fn get_recurring_processing_model(
match (item.request.setup_future_usage, item.request.off_session) {
(Some(storage_enums::FutureUsage::OffSession), _) => {
let customer_id = item.get_customer_id()?;
- let shopper_reference = format!("{}_{}", item.merchant_id, customer_id);
+ let shopper_reference =
+ format!("{}_{}", item.merchant_id, customer_id.get_string_repr());
let store_payment_method = item.request.is_mandate_payment();
Ok((
Some(AdyenRecurringModel::UnscheduledCardOnFile),
@@ -1651,7 +1652,11 @@ fn get_recurring_processing_model(
(_, Some(true)) => Ok((
Some(AdyenRecurringModel::UnscheduledCardOnFile),
None,
- Some(format!("{}_{}", item.merchant_id, item.get_customer_id()?)),
+ Some(format!(
+ "{}_{}",
+ item.merchant_id,
+ item.get_customer_id()?.get_string_repr()
+ )),
)),
_ => Ok((None, None, None)),
}
@@ -1814,10 +1819,13 @@ fn get_social_security_number(voucher_data: &domain::VoucherData) -> Option<Secr
}
}
-fn build_shopper_reference(customer_id: &Option<String>, merchant_id: String) -> Option<String> {
+fn build_shopper_reference(
+ customer_id: &Option<id_type::CustomerId>,
+ merchant_id: String,
+) -> Option<String> {
customer_id
.clone()
- .map(|c_id| format!("{}_{}", merchant_id, c_id))
+ .map(|c_id| format!("{}_{}", merchant_id, c_id.get_string_repr()))
}
impl<'a> TryFrom<(&domain::BankDebitData, &types::PaymentsAuthorizeRouterData)>
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index de68438edc4..b281d0a0a77 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -1,7 +1,7 @@
use common_utils::{
errors::CustomResult,
ext_traits::{Encode, ValueExt},
- pii,
+ id_type, pii,
};
use error_stack::ResultExt;
use masking::{ExposeInterface, PeekInterface, Secret, StrongSecret};
@@ -179,7 +179,7 @@ struct PaymentProfileDetails {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomerDetails {
- id: String,
+ id: id_type::CustomerId,
}
#[derive(Debug, Serialize)]
@@ -273,7 +273,7 @@ pub struct AuthorizedotnetZeroMandateRequest {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct Profile {
- merchant_customer_id: String,
+ merchant_customer_id: id_type::CustomerId,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
email: Option<pii::Email>,
diff --git a/crates/router/src/connector/billwerk/transformers.rs b/crates/router/src/connector/billwerk/transformers.rs
index 811076a11da..113f26b55f4 100644
--- a/crates/router/src/connector/billwerk/transformers.rs
+++ b/crates/router/src/connector/billwerk/transformers.rs
@@ -1,4 +1,7 @@
-use common_utils::pii::{Email, SecretSerdeValue};
+use common_utils::{
+ id_type,
+ pii::{Email, SecretSerdeValue},
+};
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -145,7 +148,7 @@ impl<T>
#[derive(Debug, Serialize)]
pub struct BillwerkCustomerObject {
- handle: Option<String>,
+ handle: Option<id_type::CustomerId>,
email: Option<Email>,
address: Option<Secret<String>>,
address2: Option<Secret<String>>,
diff --git a/crates/router/src/connector/cashtocode/transformers.rs b/crates/router/src/connector/cashtocode/transformers.rs
index ba55fca9b80..93922449b86 100644
--- a/crates/router/src/connector/cashtocode/transformers.rs
+++ b/crates/router/src/connector/cashtocode/transformers.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
pub use common_utils::request::Method;
-use common_utils::{errors::CustomResult, ext_traits::ValueExt, pii::Email};
+use common_utils::{errors::CustomResult, ext_traits::ValueExt, id_type, pii::Email};
use error_stack::ResultExt;
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -18,11 +18,11 @@ use crate::{
pub struct CashtocodePaymentsRequest {
amount: f64,
transaction_id: String,
- user_id: Secret<String>,
+ user_id: Secret<id_type::CustomerId>,
currency: enums::Currency,
first_name: Option<Secret<String>>,
last_name: Option<Secret<String>>,
- user_alias: Secret<String>,
+ user_alias: Secret<id_type::CustomerId>,
requested_url: String,
cancel_url: String,
email: Option<Email>,
diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rs
index ee1ff91cd47..465086f60eb 100644
--- a/crates/router/src/connector/gocardless/transformers.rs
+++ b/crates/router/src/connector/gocardless/transformers.rs
@@ -2,7 +2,10 @@ use api_models::{
enums::{CountryAlpha2, UsStatesAbbreviation},
payments::AddressDetails,
};
-use common_utils::pii::{self, IpAddress};
+use common_utils::{
+ id_type,
+ pii::{self, IpAddress},
+};
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -59,7 +62,7 @@ pub struct GocardlessCustomer {
#[derive(Default, Debug, Serialize)]
pub struct CustomerMetaData {
- crm_id: Option<Secret<String>>,
+ crm_id: Option<Secret<id_type::CustomerId>>,
}
impl TryFrom<&types::ConnectorCustomerRouterData> for GocardlessCustomerRequest {
diff --git a/crates/router/src/connector/riskified/transformers/api.rs b/crates/router/src/connector/riskified/transformers/api.rs
index f0d47274d13..2e0ac3b0047 100644
--- a/crates/router/src/connector/riskified/transformers/api.rs
+++ b/crates/router/src/connector/riskified/transformers/api.rs
@@ -1,5 +1,5 @@
use api_models::payments::AdditionalPaymentData;
-use common_utils::{ext_traits::ValueExt, pii::Email};
+use common_utils::{ext_traits::ValueExt, id_type, pii::Email};
use error_stack::{self, ResultExt};
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -84,7 +84,7 @@ pub struct RiskifiedCustomer {
#[serde(with = "common_utils::custom_serde::iso8601")]
created_at: PrimitiveDateTime,
verified_email: bool,
- id: String,
+ id: id_type::CustomerId,
account_type: CustomerAccountType,
orders_count: i32,
phone: Option<Secret<String>>,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 8ff7d350f24..a9c78cb4bf1 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -11,6 +11,7 @@ use common_utils::{
date_time,
errors::ReportSwitchExt,
ext_traits::StringExt,
+ id_type,
pii::{self, Email, IpAddress},
types::MinorUnit,
};
@@ -87,7 +88,7 @@ pub trait RouterData {
T: serde::de::DeserializeOwned;
fn is_three_ds(&self) -> bool;
fn get_payment_method_token(&self) -> Result<types::PaymentMethodToken, Error>;
- fn get_customer_id(&self) -> Result<String, Error>;
+ fn get_customer_id(&self) -> Result<id_type::CustomerId, Error>;
fn get_connector_customer_id(&self) -> Result<String, Error>;
fn get_preprocessing_id(&self) -> Result<String, Error>;
fn get_recurring_mandate_payment_data(
@@ -402,7 +403,7 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
.clone()
.ok_or_else(missing_field_err("payment_method_token"))
}
- fn get_customer_id(&self) -> Result<String, Error> {
+ fn get_customer_id(&self) -> Result<id_type::CustomerId, Error> {
self.customer_id
.to_owned()
.ok_or_else(missing_field_err("customer_id"))
@@ -877,7 +878,7 @@ impl PaymentsSyncRequestData for types::PaymentsSyncData {
#[cfg(feature = "payouts")]
pub trait CustomerDetails {
- fn get_customer_id(&self) -> Result<String, errors::ConnectorError>;
+ fn get_customer_id(&self) -> Result<id_type::CustomerId, errors::ConnectorError>;
fn get_customer_name(
&self,
) -> Result<Secret<String, masking::WithType>, errors::ConnectorError>;
@@ -890,7 +891,7 @@ pub trait CustomerDetails {
#[cfg(feature = "payouts")]
impl CustomerDetails for types::CustomerDetails {
- fn get_customer_id(&self) -> Result<String, errors::ConnectorError> {
+ fn get_customer_id(&self) -> Result<id_type::CustomerId, errors::ConnectorError> {
self.customer_id
.clone()
.ok_or(errors::ConnectorError::MissingRequiredField {
diff --git a/crates/router/src/connector/volt/transformers.rs b/crates/router/src/connector/volt/transformers.rs
index a78ecc94443..19e3b06fae0 100644
--- a/crates/router/src/connector/volt/transformers.rs
+++ b/crates/router/src/connector/volt/transformers.rs
@@ -1,4 +1,4 @@
-use common_utils::pii::Email;
+use common_utils::{id_type, pii::Email};
use diesel_models::enums;
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -70,7 +70,7 @@ pub enum TransactionType {
#[derive(Debug, Serialize)]
pub struct ShopperDetails {
- reference: String,
+ reference: id_type::CustomerId,
email: Option<Email>,
first_name: Secret<String>,
last_name: Secret<String>,
diff --git a/crates/router/src/connector/zsl/transformers.rs b/crates/router/src/connector/zsl/transformers.rs
index a9c80d39b77..e6483c6f7d1 100644
--- a/crates/router/src/connector/zsl/transformers.rs
+++ b/crates/router/src/connector/zsl/transformers.rs
@@ -237,7 +237,7 @@ impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPayment
.customer_id
.clone()
.and_then(|customer_id| {
- let cust_id = customer_id.replace(['_', '-'], "");
+ let cust_id = customer_id.get_string_repr().replace(['_', '-'], "");
let id_len = cust_id.len();
if id_len > 10 {
cust_id.get(id_len - 10..id_len).map(|id| id.to_string())
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 0f3d60cccd7..1c983dcde95 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -1,6 +1,7 @@
use common_utils::{
crypto::{Encryptable, GcmAes256},
errors::ReportSwitchExt,
+ ext_traits::OptionExt,
};
use error_stack::{report, ResultExt};
use masking::ExposeInterface;
@@ -35,7 +36,11 @@ pub async fn create_customer(
mut customer_data: customers::CustomerRequest,
) -> errors::CustomerResponse<customers::CustomerResponse> {
let db = state.store.as_ref();
- let customer_id = &customer_data.customer_id;
+ let customer_id = customer_data
+ .customer_id
+ .clone()
+ .unwrap_or_else(common_utils::generate_customer_id_of_default_length);
+
let merchant_id = &merchant_account.merchant_id;
merchant_id.clone_into(&mut customer_data.merchant_id);
@@ -46,7 +51,7 @@ pub async fn create_customer(
// it errors out, now the address that was inserted is not deleted
match db
.find_customer_by_customer_id_merchant_id(
- customer_id,
+ &customer_id,
merchant_id,
&key_store,
merchant_account.storage_scheme,
@@ -73,7 +78,7 @@ pub async fn create_customer(
.get_domain_address(
customer_address,
merchant_id,
- customer_id,
+ &customer_id,
key,
merchant_account.storage_scheme,
)
@@ -93,7 +98,7 @@ pub async fn create_customer(
let new_customer = async {
Ok(domain::Customer {
- customer_id: customer_id.to_string(),
+ customer_id: customer_id.to_owned(),
merchant_id: merchant_id.to_string(),
name: customer_data
.name
@@ -350,9 +355,17 @@ pub async fn update_customer(
) -> errors::CustomerResponse<customers::CustomerResponse> {
let db = state.store.as_ref();
//Add this in update call if customer can be updated anywhere else
+
+ let customer_id = update_customer
+ .customer_id
+ .as_ref()
+ .get_required_value("customer_id")
+ .change_context(errors::CustomersErrorResponse::InternalServerError)
+ .attach("Missing required field `customer_id`")?;
+
let customer = db
.find_customer_by_customer_id_merchant_id(
- &update_customer.customer_id,
+ customer_id,
&merchant_account.merchant_id,
&key_store,
merchant_account.storage_scheme,
@@ -376,8 +389,8 @@ pub async fn update_customer(
.await
.switch()
.attach_printable(format!(
- "Failed while updating address: merchant_id: {}, customer_id: {}",
- merchant_account.merchant_id, update_customer.customer_id
+ "Failed while updating address: merchant_id: {}, customer_id: {:?}",
+ merchant_account.merchant_id, customer_id
))?,
)
}
@@ -416,7 +429,7 @@ pub async fn update_customer(
let response = db
.update_customer_by_customer_id_merchant_id(
- update_customer.customer_id.to_owned(),
+ customer_id.to_owned(),
merchant_account.merchant_id.to_owned(),
customer,
async {
diff --git a/crates/router/src/core/locker_migration.rs b/crates/router/src/core/locker_migration.rs
index bad3b2184b5..9dbc5428748 100644
--- a/crates/router/src/core/locker_migration.rs
+++ b/crates/router/src/core/locker_migration.rs
@@ -1,5 +1,5 @@
use api_models::{enums as api_enums, locker_migration::MigrateCardResponse};
-use common_utils::errors::CustomResult;
+use common_utils::{errors::CustomResult, id_type};
use diesel_models::{enums as storage_enums, PaymentMethod};
use error_stack::{FutureExt, ResultExt};
use futures::TryFutureExt;
@@ -77,7 +77,7 @@ pub async fn rust_locker_migration(
pub async fn call_to_locker(
state: &AppState,
payment_methods: Vec<PaymentMethod>,
- customer_id: &String,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
merchant_account: &domain::MerchantAccount,
) -> CustomResult<usize, errors::ApiErrorResponse> {
@@ -136,7 +136,7 @@ pub async fn call_to_locker(
state,
pm_create,
&card_details,
- customer_id.to_string(),
+ customer_id,
merchant_account,
api_enums::LockerChoice::HyperswitchCardVault,
Some(pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id)),
@@ -144,7 +144,7 @@ pub async fn call_to_locker(
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(format!(
- "Card migration failed for merchant_id: {merchant_id}, customer_id: {customer_id}, payment_method_id: {} ",
+ "Card migration failed for merchant_id: {merchant_id}, customer_id: {customer_id:?}, payment_method_id: {} ",
pm.payment_method_id
));
@@ -159,7 +159,7 @@ pub async fn call_to_locker(
cards_moved += 1;
logger::info!(
- "Card migrated for merchant_id: {merchant_id}, customer_id: {customer_id}, payment_method_id: {} ",
+ "Card migrated for merchant_id: {merchant_id}, customer_id: {customer_id:?}, payment_method_id: {} ",
pm.payment_method_id
);
}
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index 7a1e294f9dc..839f55dea2d 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -1,7 +1,7 @@
pub mod helpers;
pub mod utils;
use api_models::payments;
-use common_utils::ext_traits::Encode;
+use common_utils::{ext_traits::Encode, id_type};
use diesel_models::{enums as storage_enums, Mandate};
use error_stack::{report, ResultExt};
use futures::future;
@@ -235,7 +235,7 @@ pub async fn get_customer_mandates(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
format!(
- "Failed while finding mandate: merchant_id: {}, customer_id: {}",
+ "Failed while finding mandate: merchant_id: {}, customer_id: {:?}",
merchant_account.merchant_id, req.customer_id
)
})?;
@@ -344,7 +344,7 @@ where
pub async fn mandate_procedure<F, FData>(
state: &AppState,
resp: &types::RouterData<F, FData, types::PaymentsResponseData>,
- customer_id: &Option<String>,
+ customer_id: &Option<id_type::CustomerId>,
pm_id: Option<String>,
merchant_connector_id: Option<String>,
storage_scheme: MerchantStorageScheme,
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index cd51face62d..33103b7a901 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -24,7 +24,7 @@ use common_enums::enums::MerchantStorageScheme;
use common_utils::{
consts,
ext_traits::{AsyncExt, Encode, StringExt, ValueExt},
- generate_id,
+ generate_id, id_type,
};
use diesel_models::{business_profile::BusinessProfile, encryption::Encryption, payment_method};
use domain::CustomerUpdate;
@@ -85,7 +85,7 @@ use crate::{
pub async fn create_payment_method(
db: &dyn db::StorageInterface,
req: &api::PaymentMethodCreate,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
payment_method_id: &str,
locker_id: Option<String>,
merchant_id: &str,
@@ -119,7 +119,7 @@ pub async fn create_payment_method(
let response = db
.insert_payment_method(
storage::PaymentMethodNew {
- customer_id: customer_id.to_string(),
+ customer_id: customer_id.to_owned(),
merchant_id: merchant_id.to_string(),
payment_method_id: payment_method_id.to_string(),
locker_id,
@@ -173,7 +173,7 @@ pub async fn create_payment_method(
pub fn store_default_payment_method(
req: &api::PaymentMethodCreate,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &String,
) -> (
api::PaymentMethodResponse,
@@ -206,7 +206,7 @@ pub async fn get_or_insert_payment_method(
req: api::PaymentMethodCreate,
resp: &mut api::PaymentMethodResponse,
merchant_account: &domain::MerchantAccount,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
key_store: &domain::MerchantKeyStore,
) -> errors::RouterResult<diesel_models::PaymentMethod> {
let mut payment_method_id = resp.payment_method_id.clone();
@@ -293,7 +293,7 @@ pub async fn get_client_secret_or_add_payment_method(
let res = create_payment_method(
db,
&req,
- customer_id.as_str(),
+ &customer_id,
payment_method_id.as_str(),
None,
merchant_id.as_str(),
@@ -375,7 +375,7 @@ pub async fn add_payment_method_data(
let customer_id = payment_method.customer_id.clone();
let customer = db
.find_customer_by_customer_id_merchant_id(
- customer_id.as_str(),
+ &customer_id,
&merchant_account.merchant_id,
&key_store,
merchant_account.storage_scheme,
@@ -487,7 +487,7 @@ pub async fn add_payment_method_data(
db,
merchant_account.merchant_id.clone(),
key_store.clone(),
- customer_id.as_str(),
+ &customer_id,
pm_id,
merchant_account.storage_scheme,
)
@@ -626,7 +626,7 @@ pub async fn add_payment_method(
&state,
req.clone(),
&card,
- customer_id.clone(),
+ &customer_id,
merchant_account,
api::enums::LockerChoice::HyperswitchCardVault,
Some(
@@ -733,7 +733,7 @@ pub async fn insert_payment_method(
req: api::PaymentMethodCreate,
key_store: &domain::MerchantKeyStore,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
pm_metadata: Option<serde_json::Value>,
customer_acceptance: Option<serde_json::Value>,
locker_id: Option<String>,
@@ -1030,7 +1030,7 @@ pub async fn add_bank_to_locker(
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
bank: &api::BankPayout,
- customer_id: &String,
+ customer_id: &id_type::CustomerId,
) -> errors::CustomResult<
(
api::PaymentMethodResponse,
@@ -1093,7 +1093,7 @@ pub async fn add_card_to_locker(
state: &routes::AppState,
req: api::PaymentMethodCreate,
card: &api::CardDetail,
- customer_id: &String,
+ customer_id: &id_type::CustomerId,
merchant_account: &domain::MerchantAccount,
card_reference: Option<&str>,
) -> errors::CustomResult<
@@ -1110,7 +1110,7 @@ pub async fn add_card_to_locker(
state,
req.clone(),
card,
- customer_id.to_string(),
+ customer_id,
merchant_account,
api_enums::LockerChoice::HyperswitchCardVault,
card_reference,
@@ -1139,7 +1139,7 @@ pub async fn add_card_to_locker(
pub async fn get_card_from_locker(
state: &routes::AppState,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
card_reference: &str,
) -> errors::RouterResult<Card> {
@@ -1180,7 +1180,7 @@ pub async fn get_card_from_locker(
pub async fn delete_card_from_locker(
state: &routes::AppState,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
card_reference: &str,
) -> errors::RouterResult<payment_methods::DeleteCardResp> {
@@ -1206,7 +1206,7 @@ pub async fn add_card_hs(
state: &routes::AppState,
req: api::PaymentMethodCreate,
card: &api::CardDetail,
- customer_id: String,
+ customer_id: &id_type::CustomerId,
merchant_account: &domain::MerchantAccount,
locker_choice: api_enums::LockerChoice,
card_reference: Option<&str>,
@@ -1233,8 +1233,7 @@ pub async fn add_card_hs(
ttl: state.conf.locker.ttl_for_storage_in_secs,
});
- let store_card_payload =
- call_to_locker_hs(state, &payload, &customer_id, locker_choice).await?;
+ let store_card_payload = call_to_locker_hs(state, &payload, customer_id, locker_choice).await?;
let payment_method_resp = payment_methods::mk_add_card_response_hs(
card.clone(),
@@ -1270,7 +1269,7 @@ pub async fn decode_and_decrypt_locker_data(
pub async fn get_payment_method_from_hs_locker<'a>(
state: &'a routes::AppState,
key_store: &domain::MerchantKeyStore,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
payment_method_reference: &'a str,
locker_choice: Option<api_enums::LockerChoice>,
@@ -1332,7 +1331,7 @@ pub async fn get_payment_method_from_hs_locker<'a>(
pub async fn call_to_locker_hs<'a>(
state: &routes::AppState,
payload: &payment_methods::StoreLockerReq<'a>,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
locker_choice: api_enums::LockerChoice,
) -> errors::CustomResult<payment_methods::StoreCardRespPayload, errors::VaultError> {
let locker = &state.conf.locker;
@@ -1404,7 +1403,7 @@ pub async fn update_payment_method_connector_mandate_details(
#[instrument(skip_all)]
pub async fn get_card_from_hs_locker<'a>(
state: &'a routes::AppState,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
card_reference: &'a str,
locker_choice: api_enums::LockerChoice,
@@ -1457,7 +1456,7 @@ pub async fn get_card_from_hs_locker<'a>(
#[instrument(skip_all)]
pub async fn delete_card_from_hs_locker<'a>(
state: &routes::AppState,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
card_reference: &'a str,
) -> errors::RouterResult<payment_methods::DeleteCardResp> {
@@ -1508,7 +1507,7 @@ pub async fn mock_call_to_locker_hs<'a>(
payload: &payment_methods::StoreLockerReq<'a>,
card_cvc: Option<String>,
payment_method_id: Option<String>,
- customer_id: Option<&str>,
+ customer_id: Option<&id_type::CustomerId>,
) -> errors::CustomResult<payment_methods::StoreCardResp, errors::VaultError> {
let mut locker_mock_up = storage::LockerMockUpNew {
card_id: card_id.to_string(),
@@ -1521,7 +1520,7 @@ pub async fn mock_call_to_locker_hs<'a>(
card_exp_month: "12".to_string(),
card_cvc,
payment_method_id,
- customer_id: customer_id.map(str::to_string),
+ customer_id: customer_id.map(ToOwned::to_owned),
name_on_card: None,
nickname: None,
enc_card_data: None,
@@ -1808,7 +1807,7 @@ pub async fn list_payment_methods(
.as_ref()
.async_and_then(|cust| async {
db.find_customer_by_customer_id_merchant_id(
- cust.as_str(),
+ cust,
&pi.merchant_id,
&key_store,
merchant_account.storage_scheme,
@@ -3088,7 +3087,7 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed(
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
req: Option<api::PaymentMethodListRequest>,
- customer_id: Option<&str>,
+ customer_id: Option<&id_type::CustomerId>,
) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {
let db = state.store.as_ref();
let limit = req.clone().and_then(|pml_req| pml_req.limit);
@@ -3144,7 +3143,7 @@ pub async fn list_customer_payment_method(
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
payment_intent: Option<storage::PaymentIntent>,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
limit: Option<i64>,
) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {
let db = &*state.store;
@@ -3701,11 +3700,12 @@ pub async fn set_default_payment_method(
db: &dyn db::StorageInterface,
merchant_id: String,
key_store: domain::MerchantKeyStore,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
payment_method_id: String,
storage_scheme: MerchantStorageScheme,
) -> errors::RouterResponse<CustomerDefaultPaymentMethodResponse> {
- //check for the customer
+ // check for the customer
+ // TODO: customer need not be checked again here, this function can take an optional customer and check for existence of customer based on the optional value
let customer = db
.find_customer_by_customer_id_merchant_id(
customer_id,
@@ -3725,7 +3725,7 @@ pub async fn set_default_payment_method(
.get_required_value("payment_method")?;
utils::when(
- payment_method.customer_id != customer_id || payment_method.merchant_id != merchant_id,
+ &payment_method.customer_id != customer_id || payment_method.merchant_id != merchant_id,
|| {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: "The payment_method_id is not valid".to_string(),
@@ -3799,7 +3799,7 @@ pub async fn get_bank_from_hs_locker(
state: &routes::AppState,
key_store: &domain::MerchantKeyStore,
temp_token: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
token_ref: &str,
) -> errors::RouterResult<api::BankPayout> {
@@ -3886,7 +3886,7 @@ impl TempLockerCardSupport {
None,
None,
None,
- Some(pm.customer_id.to_string()),
+ Some(pm.customer_id.clone()),
Some(pm.payment_method_id.to_string()),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index 86b41d1d0fe..21aa51b46a3 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -1,8 +1,7 @@
-use std::str::FromStr;
-
use api_models::{enums as api_enums, payment_methods::Card};
use common_utils::{
ext_traits::{Encode, StringExt},
+ id_type,
pii::Email,
request::RequestContent,
};
@@ -39,7 +38,7 @@ impl StoreLockerReq<'_> {
#[derive(Debug, Deserialize, Serialize)]
pub struct StoreCardReq<'a> {
pub merchant_id: &'a str,
- pub merchant_customer_id: String,
+ pub merchant_customer_id: id_type::CustomerId,
#[serde(skip_serializing_if = "Option::is_none")]
pub requestor_card_reference: Option<String>,
pub card: Card,
@@ -49,7 +48,7 @@ pub struct StoreCardReq<'a> {
#[derive(Debug, Deserialize, Serialize)]
pub struct StoreGenericReq<'a> {
pub merchant_id: &'a str,
- pub merchant_customer_id: String,
+ pub merchant_customer_id: id_type::CustomerId,
#[serde(rename = "enc_card_data")]
pub enc_data: String,
pub ttl: i64,
@@ -79,7 +78,7 @@ pub enum DataDuplicationCheck {
#[derive(Debug, Deserialize, Serialize)]
pub struct CardReqBody<'a> {
pub merchant_id: &'a str,
- pub merchant_customer_id: String,
+ pub merchant_customer_id: id_type::CustomerId,
pub card_reference: String,
}
@@ -108,7 +107,7 @@ pub struct DeleteCardResp {
#[serde(rename_all = "camelCase")]
pub struct AddCardRequest<'a> {
pub card_number: cards::CardNumber,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub card_exp_month: Secret<String>,
pub card_exp_year: Secret<String>,
pub merchant_id: &'a str,
@@ -131,7 +130,7 @@ pub struct AddCardResponse {
pub card_exp_month: Option<Secret<String>>,
pub name_on_card: Option<Secret<String>>,
pub nickname: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub duplicate: Option<bool>,
}
@@ -143,7 +142,7 @@ pub struct AddPaymentMethodResponse {
#[serde(rename = "merchant_id")]
pub merchant_id: Option<String>,
pub nickname: Option<String>,
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub duplicate: Option<bool>,
pub payment_method_data: Secret<String>,
}
@@ -380,43 +379,10 @@ pub fn mk_add_card_response_hs(
}
}
-pub fn mk_add_card_request(
- locker: &settings::Locker,
- card: &api::CardDetail,
- customer_id: &str,
- _req: &api::PaymentMethodCreate,
- locker_id: &'static str,
- merchant_id: &str,
-) -> CustomResult<services::Request, errors::VaultError> {
- let customer_id = if cfg!(feature = "release") {
- format!("{customer_id}::{merchant_id}")
- } else {
- customer_id.to_owned()
- };
- let add_card_req = AddCardRequest {
- card_number: card.card_number.clone(),
- customer_id,
- card_exp_month: card.card_exp_month.clone(),
- card_exp_year: card.card_exp_year.clone(),
- merchant_id: locker_id,
- email_address: match Email::from_str("[email protected]") {
- Ok(email) => Some(email),
- Err(_) => None,
- }, //
- name_on_card: Some("John Doe".to_string().into()), // [#256]
- nickname: Some("router".to_string()), //
- };
- let mut url = locker.host.to_owned();
- url.push_str("/card/addCard");
- let mut request = services::Request::new(services::Method::Post, &url);
- request.set_body(RequestContent::FormUrlEncoded(Box::new(add_card_req)));
- Ok(request)
-}
-
pub async fn mk_get_card_request_hs(
jwekey: &settings::Jwekey,
locker: &settings::Locker,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
card_reference: &str,
locker_choice: Option<api_enums::LockerChoice>,
@@ -488,7 +454,7 @@ pub fn mk_get_card_response(card: GetCardResponse) -> errors::RouterResult<Card>
pub async fn mk_delete_card_request_hs(
jwekey: &settings::Jwekey,
locker: &settings::Locker,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
card_reference: &str,
) -> CustomResult<services::Request, errors::VaultError> {
@@ -618,7 +584,7 @@ pub fn mk_card_value2(
card_security_code: Option<String>,
card_fingerprint: Option<String>,
external_id: Option<String>,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
payment_method_id: Option<String>,
) -> CustomResult<String, errors::VaultError> {
let value2 = api::TokenizedCardValue2 {
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index 6d4f2322a8d..e0d8bada65e 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -2,7 +2,7 @@ use common_enums::PaymentMethodType;
use common_utils::{
crypto::{DecodeMessage, EncodeMessage, GcmAes256},
ext_traits::{BytesExt, Encode},
- generate_id_with_default_len,
+ generate_id_with_default_len, id_type,
pii::Email,
};
use error_stack::{report, ResultExt};
@@ -26,13 +26,19 @@ use crate::{
const VAULT_SERVICE_NAME: &str = "CARD";
pub struct SupplementaryVaultData {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub payment_method_id: Option<String>,
}
pub trait Vaultable: Sized {
- fn get_value1(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError>;
- fn get_value2(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError>;
+ fn get_value2(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
Ok(String::new())
}
fn from_values(
@@ -42,7 +48,10 @@ pub trait Vaultable: Sized {
}
impl Vaultable for api::Card {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = api::TokenizedCardValue1 {
card_number: self.card_number.peek().clone(),
exp_year: self.card_exp_year.peek().clone(),
@@ -62,7 +71,10 @@ impl Vaultable for api::Card {
.attach_printable("Failed to encode card value1")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = api::TokenizedCardValue2 {
card_security_code: Some(self.card_cvc.peek().clone()),
card_fingerprint: None,
@@ -117,7 +129,10 @@ impl Vaultable for api::Card {
}
impl Vaultable for api_models::payments::BankTransferData {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = api_models::payment_methods::TokenizedBankTransferValue1 {
data: self.to_owned(),
};
@@ -128,7 +143,10 @@ impl Vaultable for api_models::payments::BankTransferData {
.attach_printable("Failed to encode bank transfer data")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = api_models::payment_methods::TokenizedBankTransferValue2 { customer_id };
value2
@@ -163,7 +181,10 @@ impl Vaultable for api_models::payments::BankTransferData {
}
impl Vaultable for api::WalletData {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = api::TokenizedWalletValue1 {
data: self.to_owned(),
};
@@ -174,7 +195,10 @@ impl Vaultable for api::WalletData {
.attach_printable("Failed to encode wallet data value1")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = api::TokenizedWalletValue2 { customer_id };
value2
@@ -209,7 +233,10 @@ impl Vaultable for api::WalletData {
}
impl Vaultable for api_models::payments::BankRedirectData {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = api_models::payment_methods::TokenizedBankRedirectValue1 {
data: self.to_owned(),
};
@@ -220,7 +247,10 @@ impl Vaultable for api_models::payments::BankRedirectData {
.attach_printable("Failed to encode bank redirect data")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = api_models::payment_methods::TokenizedBankRedirectValue2 { customer_id };
value2
@@ -264,7 +294,10 @@ pub enum VaultPaymentMethod {
}
impl Vaultable for api::PaymentMethodData {
- fn get_value1(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = match self {
Self::Card(card) => VaultPaymentMethod::Card(card.get_value1(customer_id)?),
Self::Wallet(wallet) => VaultPaymentMethod::Wallet(wallet.get_value1(customer_id)?),
@@ -284,7 +317,10 @@ impl Vaultable for api::PaymentMethodData {
.attach_printable("Failed to encode payment method value1")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = match self {
Self::Card(card) => VaultPaymentMethod::Card(card.get_value2(customer_id)?),
Self::Wallet(wallet) => VaultPaymentMethod::Wallet(wallet.get_value2(customer_id)?),
@@ -352,7 +388,10 @@ impl Vaultable for api::PaymentMethodData {
#[cfg(feature = "payouts")]
impl Vaultable for api::CardPayout {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = api::TokenizedCardValue1 {
card_number: self.card_number.peek().clone(),
exp_year: self.expiry_year.peek().clone(),
@@ -369,7 +408,10 @@ impl Vaultable for api::CardPayout {
.attach_printable("Failed to encode card value1")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = api::TokenizedCardValue2 {
card_security_code: None,
card_fingerprint: None,
@@ -427,12 +469,15 @@ pub struct TokenizedWalletSensitiveValues {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedWalletInsensitiveValues {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
}
#[cfg(feature = "payouts")]
impl Vaultable for api::WalletPayout {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = match self {
Self::Paypal(paypal_data) => TokenizedWalletSensitiveValues {
email: paypal_data.email.clone(),
@@ -454,7 +499,10 @@ impl Vaultable for api::WalletPayout {
.attach_printable("Failed to encode wallet data - TokenizedWalletSensitiveValues")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = TokenizedWalletInsensitiveValues { customer_id };
value2
@@ -510,7 +558,7 @@ pub struct TokenizedBankSensitiveValues {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedBankInsensitiveValues {
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
pub bank_name: Option<String>,
pub bank_country_code: Option<api::enums::CountryAlpha2>,
pub bank_city: Option<String>,
@@ -519,7 +567,10 @@ pub struct TokenizedBankInsensitiveValues {
#[cfg(feature = "payouts")]
impl Vaultable for api::BankPayout {
- fn get_value1(&self, _customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ _customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let bank_sensitive_data = match self {
Self::Ach(b) => TokenizedBankSensitiveValues {
bank_account_number: Some(b.bank_account_number.clone()),
@@ -565,7 +616,10 @@ impl Vaultable for api::BankPayout {
.attach_printable("Failed to encode data - bank_sensitive_data")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let bank_insensitive_data = match self {
Self::Ach(b) => TokenizedBankInsensitiveValues {
customer_id,
@@ -688,7 +742,10 @@ pub enum VaultPayoutMethod {
#[cfg(feature = "payouts")]
impl Vaultable for api::PayoutMethodData {
- fn get_value1(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value1(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value1 = match self {
Self::Card(card) => VaultPayoutMethod::Card(card.get_value1(customer_id)?),
Self::Bank(bank) => VaultPayoutMethod::Bank(bank.get_value1(customer_id)?),
@@ -701,7 +758,10 @@ impl Vaultable for api::PayoutMethodData {
.attach_printable("Failed to encode payout method value1")
}
- fn get_value2(&self, customer_id: Option<String>) -> CustomResult<String, errors::VaultError> {
+ fn get_value2(
+ &self,
+ customer_id: Option<id_type::CustomerId>,
+ ) -> CustomResult<String, errors::VaultError> {
let value2 = match self {
Self::Card(card) => VaultPayoutMethod::Card(card.get_value2(customer_id)?),
Self::Bank(bank) => VaultPayoutMethod::Bank(bank.get_value2(customer_id)?),
@@ -777,7 +837,7 @@ impl Vault {
state: &routes::AppState,
token_id: Option<String>,
payment_method: &api::PaymentMethodData,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
pm: enums::PaymentMethod,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<String> {
@@ -829,7 +889,7 @@ impl Vault {
state: &routes::AppState,
token_id: Option<String>,
payout_method: &api::PayoutMethodData,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<String> {
let value1 = payout_method
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index db99ff590cd..7bc0b532239 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3814,7 +3814,7 @@ pub async fn payment_external_authentication(
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
- format!("error while finding customer with customer_id {customer_id}")
+ format!("error while finding customer with customer_id {customer_id:?}")
})?,
),
None => None,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e55f5a27787..8f7ed4da256 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -7,10 +7,10 @@ use api_models::{
use base64::Engine;
use common_utils::{
ext_traits::{AsyncExt, ByteSliceExt, Encode, ValueExt},
- fp_utils, generate_id, pii,
+ fp_utils, generate_id, id_type, pii,
types::MinorUnit,
};
-use diesel_models::enums;
+use diesel_models::enums::{self};
// TODO : Evaluate all the helper functions ()
use error_stack::{report, ResultExt};
use futures::future::Either;
@@ -124,7 +124,7 @@ pub async fn create_or_update_address_for_payment_by_request(
req_address: Option<&api::Address>,
address_id: Option<&str>,
merchant_id: &str,
- customer_id: Option<&String>,
+ customer_id: Option<&id_type::CustomerId>,
merchant_key_store: &domain::MerchantKeyStore,
payment_id: &str,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -286,7 +286,7 @@ pub async fn create_or_find_address_for_payment_by_request(
req_address: Option<&api::Address>,
address_id: Option<&str>,
merchant_id: &str,
- customer_id: Option<&String>,
+ customer_id: Option<&id_type::CustomerId>,
merchant_key_store: &domain::MerchantKeyStore,
payment_id: &str,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -1011,7 +1011,7 @@ fn validate_new_mandate_request(
pub fn validate_customer_id_mandatory_cases(
has_setup_future_usage: bool,
- customer_id: &Option<String>,
+ customer_id: Option<&id_type::CustomerId>,
) -> RouterResult<()> {
match (has_setup_future_usage, customer_id) {
(true, None) => Err(errors::ApiErrorResponse::PreconditionFailed {
@@ -1162,8 +1162,8 @@ pub fn verify_mandate_details(
pub fn verify_mandate_details_for_recurring_payments(
mandate_merchant_id: &str,
merchant_id: &str,
- mandate_customer_id: &str,
- customer_id: &str,
+ mandate_customer_id: &id_type::CustomerId,
+ customer_id: &id_type::CustomerId,
) -> RouterResult<()> {
if mandate_merchant_id != merchant_id {
Err(report!(errors::ApiErrorResponse::MandateNotFound))?
@@ -1266,7 +1266,7 @@ pub(crate) async fn get_payment_method_create_request(
payment_method_data: Option<&domain::PaymentMethodData>,
payment_method: Option<storage_enums::PaymentMethod>,
payment_method_type: Option<storage_enums::PaymentMethodType>,
- customer_id: &Option<String>,
+ customer_id: &Option<id_type::CustomerId>,
billing_name: Option<masking::Secret<String>>,
) -> RouterResult<api::PaymentMethodCreate> {
match payment_method_data {
@@ -1340,7 +1340,7 @@ pub(crate) async fn get_payment_method_create_request(
pub async fn get_customer_from_details<F: Clone>(
db: &dyn StorageInterface,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
merchant_id: &str,
payment_data: &mut PaymentData<F>,
merchant_key_store: &domain::MerchantKeyStore,
@@ -1348,10 +1348,10 @@ pub async fn get_customer_from_details<F: Clone>(
) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
match customer_id {
None => Ok(None),
- Some(c_id) => {
+ Some(customer_id) => {
let customer = db
.find_customer_optional_by_customer_id_merchant_id(
- &c_id,
+ &customer_id,
merchant_id,
merchant_key_store,
storage_scheme,
@@ -1456,8 +1456,9 @@ pub fn get_customer_details_from_request(
let customer_id = request
.customer
.as_ref()
- .map(|customer_details| customer_details.id.clone())
- .or(request.customer_id.clone());
+ .map(|customer_details| &customer_details.id)
+ .or(request.customer_id.as_ref())
+ .map(ToOwned::to_owned);
let customer_name = request
.customer
@@ -1595,7 +1596,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
let key = key_store.key.get_inner().peek();
Ok::<_, error_stack::Report<common_utils::errors::CryptoError>>(
domain::Customer {
- customer_id: customer_id.to_string(),
+ customer_id,
merchant_id: merchant_id.to_string(),
name: request_customer_details
.name
@@ -2541,7 +2542,7 @@ pub fn make_merchant_url_with_response(
pub async fn make_ephemeral_key(
state: AppState,
- customer_id: String,
+ customer_id: id_type::CustomerId,
merchant_id: String,
) -> errors::RouterResponse<ephemeral_key::EphemeralKey> {
let store = &state.store;
@@ -2669,7 +2670,7 @@ pub fn generate_mandate(
payment_id: String,
connector: String,
setup_mandate_details: Option<MandateData>,
- customer_id: &Option<String>,
+ customer_id: &Option<id_type::CustomerId>,
payment_method_id: String,
connector_mandate_id: Option<pii::SecretSerdeValue>,
network_txn_id: Option<String>,
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 3f57ba2830f..49fe8ce2011 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -169,10 +169,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
- &payment_intent
+ payment_intent
.customer_id
- .clone()
- .or_else(|| request.customer_id.clone()),
+ .as_ref()
+ .or(request.customer_id.as_ref()),
)?;
let shipping_address = helpers::create_or_update_address_for_payment_by_request(
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index a3ed16def0c..aa2cf09cb6a 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -360,10 +360,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
- &payment_intent
+ payment_intent
.customer_id
- .clone()
- .or_else(|| customer_details.customer_id.clone()),
+ .as_ref()
+ .or(customer_details.customer_id.as_ref()),
)?;
let creds_identifier = request
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 68f8b7056c0..4d4444a2802 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -727,11 +727,11 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentCreate
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
- &request
+ request
.customer
- .clone()
- .map(|customer| customer.id)
- .or(request.customer_id.clone()),
+ .as_ref()
+ .map(|customer| &customer.id)
+ .or(request.customer_id.as_ref()),
)?;
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index d7351b3b5ba..494ab0f2eec 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -172,10 +172,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
if request.confirm.unwrap_or(false) {
helpers::validate_customer_id_mandatory_cases(
request.setup_future_usage.is_some(),
- &payment_intent
+ payment_intent
.customer_id
- .clone()
- .or_else(|| customer_details.customer_id.clone()),
+ .as_ref()
+ .or(customer_details.customer_id.as_ref()),
)?;
}
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index f5a4265a9fb..3341011bb5d 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -4,7 +4,7 @@ use api_models::payment_methods::PaymentMethodsData;
use common_enums::PaymentMethod;
use common_utils::{
ext_traits::{Encode, ValueExt},
- pii,
+ id_type, pii,
};
use error_stack::{report, ResultExt};
use masking::ExposeInterface;
@@ -58,7 +58,7 @@ pub async fn save_payment_method<FData>(
connector_name: String,
merchant_connector_id: Option<String>,
save_payment_method_data: SavePaymentMethodData<FData>,
- customer_id: Option<String>,
+ customer_id: Option<id_type::CustomerId>,
merchant_account: &domain::MerchantAccount,
payment_method_type: Option<storage_enums::PaymentMethodType>,
key_store: &domain::MerchantKeyStore,
@@ -307,7 +307,7 @@ where
payment_methods::cards::create_payment_method(
db,
&payment_method_create_request,
- customer_id.as_str(),
+ &customer_id,
&resp.payment_method_id,
locker_id,
merchant_id,
@@ -402,7 +402,7 @@ where
payment_method_create_request.clone(),
key_store,
&merchant_account.merchant_id,
- customer_id.as_str(),
+ &customer_id,
resp.metadata.clone().map(|val| val.expose()),
customer_acceptance,
locker_id,
@@ -426,7 +426,7 @@ where
payment_methods::cards::delete_card_from_locker(
state,
- customer_id.as_str(),
+ &customer_id,
merchant_id,
existing_pm
.locker_id
@@ -439,7 +439,7 @@ where
state,
payment_method_create_request,
&card,
- customer_id.clone(),
+ &customer_id,
merchant_account,
api::enums::LockerChoice::HyperswitchCardVault,
Some(
@@ -529,7 +529,7 @@ where
payment_methods::cards::create_payment_method(
db,
&payment_method_create_request,
- customer_id.as_str(),
+ &customer_id,
&resp.payment_method_id,
locker_id,
merchant_id,
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 1170d2a25cb..7aaf215ab51 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -714,13 +714,16 @@ pub async fn payouts_list_core(
) {
logger::warn!(
?error,
- "customer missing for customer_id : {}",
+ "customer missing for customer_id : {:?}",
payouts.customer_id,
);
return None;
}
Some(Err(error.change_context(StorageError::ValueNotFound(
- format!("customer missing for customer_id : {}", payouts.customer_id),
+ format!(
+ "customer missing for customer_id : {:?}",
+ payouts.customer_id
+ ),
))))
}
}
@@ -789,7 +792,11 @@ pub async fn payouts_filtered_list_core(
match domain::Customer::convert_back(c, &key_store.key).await {
Ok(domain_cust) => Some((p, pa, domain_cust)),
Err(err) => {
- logger::warn!(?err, "failed to convert customer for id: {}", p.customer_id);
+ logger::warn!(
+ ?err,
+ "failed to convert customer for id: {:?}",
+ p.customer_id
+ );
None
}
}
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 9c6cdbd8881..3059d3a4164 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -2,6 +2,7 @@ use api_models::{enums, payment_methods::Card, payouts};
use common_utils::{
errors::CustomResult,
ext_traits::{AsyncExt, StringExt},
+ generate_customer_id_of_default_length, id_type,
};
use diesel_models::encryption::Encryption;
use error_stack::ResultExt;
@@ -22,7 +23,6 @@ use crate::{
CustomerDetails,
},
routing::TransactionData,
- utils as core_utils,
},
db::StorageInterface,
routes::{metrics, AppState},
@@ -44,7 +44,7 @@ pub async fn make_payout_method_data<'a>(
state: &'a AppState,
payout_method_data: Option<&api::PayoutMethodData>,
payout_token: Option<&str>,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
payout_type: Option<&api_enums::PayoutType>,
merchant_key_store: &domain::MerchantKeyStore,
@@ -581,8 +581,11 @@ pub async fn get_or_create_customer_details(
) -> RouterResult<Option<domain::Customer>> {
let db: &dyn StorageInterface = &*state.store;
// Create customer_id if not passed in request
- let customer_id =
- core_utils::get_or_generate_id("customer_id", &customer_details.customer_id, "cust")?;
+ let customer_id = customer_details
+ .customer_id
+ .clone()
+ .unwrap_or_else(generate_customer_id_of_default_length);
+
let merchant_id = &merchant_account.merchant_id;
let key = key_store.key.get_inner().peek();
diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs
index 496aab13b13..1819c5152e0 100644
--- a/crates/router/src/core/payouts/validator.rs
+++ b/crates/router/src/core/payouts/validator.rs
@@ -88,7 +88,10 @@ pub async fn validate_create_request(
// Payout token
let payout_method_data = match req.payout_token.to_owned() {
Some(payout_token) => {
- let customer_id = req.customer_id.to_owned().map_or("".to_string(), |c| c);
+ let customer_id = req
+ .customer_id
+ .to_owned()
+ .unwrap_or_else(common_utils::generate_customer_id_of_default_length);
helpers::make_payout_method_data(
state,
req.payout_method_data.as_ref(),
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index 5a6b2606d0c..f210019b4da 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel_models::{address::AddressUpdateInternal, enums::MerchantStorageScheme};
use error_stack::ResultExt;
@@ -66,7 +67,7 @@ where
async fn update_address_by_merchant_id_customer_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
address: storage_types::AddressUpdate,
key_store: &domain::MerchantKeyStore,
@@ -75,7 +76,7 @@ where
#[cfg(not(feature = "kv_store"))]
mod storage {
- use common_utils::ext_traits::AsyncExt;
+ use common_utils::{ext_traits::AsyncExt, id_type};
use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
@@ -237,7 +238,7 @@ mod storage {
#[instrument(skip_all)]
async fn update_address_by_merchant_id_customer_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
address: storage_types::AddressUpdate,
key_store: &domain::MerchantKeyStore,
@@ -270,7 +271,7 @@ mod storage {
#[cfg(feature = "kv_store")]
mod storage {
- use common_utils::ext_traits::AsyncExt;
+ use common_utils::{ext_traits::AsyncExt, id_type};
use diesel_models::{enums::MerchantStorageScheme, AddressUpdateInternal};
use error_stack::{report, ResultExt};
use redis_interface::HsetnxReply;
@@ -587,7 +588,7 @@ mod storage {
#[instrument(skip_all)]
async fn update_address_by_merchant_id_customer_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
address: storage_types::AddressUpdate,
key_store: &domain::MerchantKeyStore,
@@ -777,7 +778,7 @@ impl AddressInterface for MockDb {
async fn update_address_by_merchant_id_customer_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
address_update: storage_types::AddressUpdate,
key_store: &domain::MerchantKeyStore,
@@ -788,7 +789,7 @@ impl AddressInterface for MockDb {
.await
.iter_mut()
.find(|address| {
- address.customer_id == Some(customer_id.to_string())
+ address.customer_id.as_ref() == Some(customer_id)
&& address.merchant_id == merchant_id
})
.map(|a| {
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index 5f8dbe69f80..cad3d2969fe 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -1,4 +1,4 @@
-use common_utils::ext_traits::AsyncExt;
+use common_utils::{ext_traits::AsyncExt, id_type};
use error_stack::ResultExt;
use futures::future::try_join_all;
use router_env::{instrument, tracing};
@@ -23,13 +23,13 @@ where
{
async fn delete_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> CustomResult<bool, errors::StorageError>;
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -37,7 +37,7 @@ where
async fn update_customer_by_customer_id_merchant_id(
&self,
- customer_id: String,
+ customer_id: id_type::CustomerId,
merchant_id: String,
customer: domain::Customer,
customer_update: storage_types::CustomerUpdate,
@@ -47,7 +47,7 @@ where
async fn find_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -69,7 +69,7 @@ where
#[cfg(feature = "kv_store")]
mod storage {
- use common_utils::ext_traits::AsyncExt;
+ use common_utils::{ext_traits::AsyncExt, id_type};
use diesel_models::kv;
use error_stack::{report, ResultExt};
use futures::future::try_join_all;
@@ -103,7 +103,7 @@ mod storage {
// check customer not found in kv and fallback to db
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -126,9 +126,9 @@ mod storage {
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id,
- customer_id,
+ customer_id: customer_id.get_string_repr(),
};
- let field = format!("cust_{}", customer_id);
+ let field = format!("cust_{}", customer_id.get_string_repr());
Box::pin(db_utils::try_redis_get_else_try_database_get(
// check for ValueNotFound
async {
@@ -167,7 +167,7 @@ mod storage {
#[instrument(skip_all)]
async fn update_customer_by_customer_id_merchant_id(
&self,
- customer_id: String,
+ customer_id: id_type::CustomerId,
merchant_id: String,
customer: domain::Customer,
customer_update: storage_types::CustomerUpdate,
@@ -190,9 +190,9 @@ mod storage {
};
let key = PartitionKey::MerchantIdCustomerId {
merchant_id: merchant_id.as_str(),
- customer_id: customer_id.as_str(),
+ customer_id: customer_id.get_string_repr(),
};
- let field = format!("cust_{}", customer_id);
+ let field = format!("cust_{}", customer_id.get_string_repr());
let storage_scheme = decide_storage_scheme::<_, diesel_models::Customer>(
self,
storage_scheme,
@@ -244,7 +244,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -267,9 +267,9 @@ mod storage {
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id,
- customer_id,
+ customer_id: customer_id.get_string_repr(),
};
- let field = format!("cust_{}", customer_id);
+ let field = format!("cust_{}", customer_id.get_string_repr());
Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
@@ -357,9 +357,9 @@ mod storage {
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id: merchant_id.as_str(),
- customer_id: customer_id.as_str(),
+ customer_id: customer_id.get_string_repr(),
};
- let field = format!("cust_{}", customer_id.clone());
+ let field = format!("cust_{}", customer_id.get_string_repr());
let redis_entry = kv::TypedSql {
op: kv::DBOperation::Insert {
@@ -384,7 +384,7 @@ mod storage {
Ok(redis_interface::HsetnxReply::KeyNotSet) => {
Err(report!(errors::StorageError::DuplicateValue {
entity: "customer",
- key: Some(customer_id),
+ key: Some(customer_id.get_string_repr().to_string()),
}))
}
Ok(redis_interface::HsetnxReply::KeySet) => Ok(storage_customer),
@@ -402,7 +402,7 @@ mod storage {
#[instrument(skip_all)]
async fn delete_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> CustomResult<bool, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -419,7 +419,7 @@ mod storage {
#[cfg(not(feature = "kv_store"))]
mod storage {
- use common_utils::ext_traits::AsyncExt;
+ use common_utils::{ext_traits::AsyncExt, id_type};
use error_stack::{report, ResultExt};
use futures::future::try_join_all;
use masking::PeekInterface;
@@ -447,7 +447,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
@@ -483,7 +483,7 @@ mod storage {
#[instrument(skip_all)]
async fn update_customer_by_customer_id_merchant_id(
&self,
- customer_id: String,
+ customer_id: id_type::CustomerId,
merchant_id: String,
_customer: domain::Customer,
customer_update: storage_types::CustomerUpdate,
@@ -510,7 +510,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
@@ -590,7 +590,7 @@ mod storage {
#[instrument(skip_all)]
async fn delete_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> CustomResult<bool, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
@@ -610,7 +610,7 @@ impl CustomerInterface for MockDb {
#[allow(clippy::panic)]
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
@@ -619,7 +619,7 @@ impl CustomerInterface for MockDb {
let customer = customers
.iter()
.find(|customer| {
- customer.customer_id == customer_id && customer.merchant_id == merchant_id
+ customer.customer_id == *customer_id && customer.merchant_id == merchant_id
})
.cloned();
customer
@@ -659,7 +659,7 @@ impl CustomerInterface for MockDb {
#[instrument(skip_all)]
async fn update_customer_by_customer_id_merchant_id(
&self,
- _customer_id: String,
+ _customer_id: id_type::CustomerId,
_merchant_id: String,
_customer: domain::Customer,
_customer_update: storage_types::CustomerUpdate,
@@ -672,7 +672,7 @@ impl CustomerInterface for MockDb {
async fn find_customer_by_customer_id_merchant_id(
&self,
- _customer_id: &str,
+ _customer_id: &id_type::CustomerId,
_merchant_id: &str,
_key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
@@ -704,7 +704,7 @@ impl CustomerInterface for MockDb {
async fn delete_customer_by_customer_id_merchant_id(
&self,
- _customer_id: &str,
+ _customer_id: &id_type::CustomerId,
_merchant_id: &str,
) -> CustomResult<bool, errors::StorageError> {
// [#172]: Implement function for `MockDb`
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index a2aed292364..0e3b365ae07 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1,7 +1,7 @@
use std::sync::Arc;
use common_enums::enums::MerchantStorageScheme;
-use common_utils::{errors::CustomResult, pii};
+use common_utils::{errors::CustomResult, id_type, pii};
use diesel_models::{
enums,
enums::ProcessTrackerStatus,
@@ -175,7 +175,7 @@ impl AddressInterface for KafkaStore {
async fn update_address_by_merchant_id_customer_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
address: storage::AddressUpdate,
key_store: &domain::MerchantKeyStore,
@@ -320,7 +320,7 @@ impl ConfigInterface for KafkaStore {
impl CustomerInterface for KafkaStore {
async fn delete_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
) -> CustomResult<bool, errors::StorageError> {
self.diesel_store
@@ -330,7 +330,7 @@ impl CustomerInterface for KafkaStore {
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -347,7 +347,7 @@ impl CustomerInterface for KafkaStore {
async fn update_customer_by_customer_id_merchant_id(
&self,
- customer_id: String,
+ customer_id: id_type::CustomerId,
merchant_id: String,
customer: domain::Customer,
customer_update: storage::CustomerUpdate,
@@ -378,7 +378,7 @@ impl CustomerInterface for KafkaStore {
async fn find_customer_by_customer_id_merchant_id(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -706,7 +706,7 @@ impl MandateInterface for KafkaStore {
async fn find_mandate_by_merchant_id_customer_id(
&self,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> CustomResult<Vec<storage::Mandate>, errors::StorageError> {
self.diesel_store
.find_mandate_by_merchant_id_customer_id(merchant_id, customer_id)
@@ -1453,7 +1453,7 @@ impl PaymentMethodInterface for KafkaStore {
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
limit: Option<i64>,
) -> CustomResult<Vec<storage::PaymentMethod>, errors::StorageError> {
@@ -1464,7 +1464,7 @@ impl PaymentMethodInterface for KafkaStore {
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
@@ -1483,7 +1483,7 @@ impl PaymentMethodInterface for KafkaStore {
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
diff --git a/crates/router/src/db/locker_mock_up.rs b/crates/router/src/db/locker_mock_up.rs
index ea0e70c5bb9..0fb675025c9 100644
--- a/crates/router/src/db/locker_mock_up.rs
+++ b/crates/router/src/db/locker_mock_up.rs
@@ -131,6 +131,8 @@ impl LockerMockUpInterface for MockDb {
mod tests {
#[allow(clippy::unwrap_used)]
mod mockdb_locker_mock_up_interface {
+ use common_utils::{generate_customer_id_of_default_length, id_type};
+
use crate::{
db::{locker_mock_up::LockerMockUpInterface, MockDb},
types::storage,
@@ -140,7 +142,7 @@ mod tests {
card_id: String,
external_id: String,
merchant_id: String,
- customer_id: String,
+ customer_id: id_type::CustomerId,
}
fn create_locker_mock_up_new(locker_ids: LockerMockUpIds) -> storage::LockerMockUpNew {
@@ -174,7 +176,7 @@ mod tests {
card_id: "card_1".into(),
external_id: "external_1".into(),
merchant_id: "merchant_1".into(),
- customer_id: "customer_1".into(),
+ customer_id: generate_customer_id_of_default_length(),
}))
.await
.unwrap();
@@ -184,7 +186,7 @@ mod tests {
card_id: "card_2".into(),
external_id: "external_1".into(),
merchant_id: "merchant_1".into(),
- customer_id: "customer_1".into(),
+ customer_id: generate_customer_id_of_default_length(),
}))
.await;
@@ -205,7 +207,7 @@ mod tests {
card_id: "card_1".into(),
external_id: "external_1".into(),
merchant_id: "merchant_1".into(),
- customer_id: "customer_1".into(),
+ customer_id: generate_customer_id_of_default_length(),
}))
.await
.unwrap();
@@ -235,7 +237,7 @@ mod tests {
card_id: "card_1".into(),
external_id: "external_1".into(),
merchant_id: "merchant_1".into(),
- customer_id: "customer_1".into(),
+ customer_id: generate_customer_id_of_default_length(),
}))
.await
.unwrap();
diff --git a/crates/router/src/db/mandate.rs b/crates/router/src/db/mandate.rs
index c9995d502c0..e69e3318ae6 100644
--- a/crates/router/src/db/mandate.rs
+++ b/crates/router/src/db/mandate.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use error_stack::ResultExt;
use super::MockDb;
@@ -25,7 +26,7 @@ pub trait MandateInterface {
async fn find_mandate_by_merchant_id_customer_id(
&self,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> CustomResult<Vec<storage_types::Mandate>, errors::StorageError>;
async fn update_mandate_by_merchant_id_mandate_id(
@@ -52,7 +53,7 @@ pub trait MandateInterface {
#[cfg(feature = "kv_store")]
mod storage {
- use common_utils::fallback_reverse_lookup_not_found;
+ use common_utils::{fallback_reverse_lookup_not_found, id_type};
use diesel_models::kv;
use error_stack::{report, ResultExt};
use redis_interface::HsetnxReply;
@@ -175,7 +176,7 @@ mod storage {
async fn find_mandate_by_merchant_id_customer_id(
&self,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> CustomResult<Vec<storage_types::Mandate>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage_types::Mandate::find_by_merchant_id_customer_id(&conn, merchant_id, customer_id)
@@ -363,6 +364,7 @@ mod storage {
#[cfg(not(feature = "kv_store"))]
mod storage {
+ use common_utils::id_type;
use error_stack::report;
use router_env::{instrument, tracing};
@@ -410,7 +412,7 @@ mod storage {
async fn find_mandate_by_merchant_id_customer_id(
&self,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> CustomResult<Vec<storage_types::Mandate>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage_types::Mandate::find_by_merchant_id_customer_id(&conn, merchant_id, customer_id)
@@ -505,7 +507,7 @@ impl MandateInterface for MockDb {
async fn find_mandate_by_merchant_id_customer_id(
&self,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> CustomResult<Vec<storage_types::Mandate>, errors::StorageError> {
return Ok(self
.mandates
@@ -513,7 +515,7 @@ impl MandateInterface for MockDb {
.await
.iter()
.filter(|mandate| {
- mandate.merchant_id == merchant_id && mandate.customer_id == customer_id
+ mandate.merchant_id == merchant_id && &mandate.customer_id == customer_id
})
.cloned()
.collect());
diff --git a/crates/router/src/db/payment_method.rs b/crates/router/src/db/payment_method.rs
index 29b3379a291..9ec25b1d1b2 100644
--- a/crates/router/src/db/payment_method.rs
+++ b/crates/router/src/db/payment_method.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use diesel_models::payment_method::PaymentMethodUpdateInternal;
use error_stack::ResultExt;
@@ -23,14 +24,14 @@ pub trait PaymentMethodInterface {
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
limit: Option<i64>,
) -> CustomResult<Vec<storage_types::PaymentMethod>, errors::StorageError>;
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
@@ -39,7 +40,7 @@ pub trait PaymentMethodInterface {
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError>;
@@ -66,7 +67,7 @@ pub trait PaymentMethodInterface {
#[cfg(feature = "kv_store")]
mod storage {
- use common_utils::fallback_reverse_lookup_not_found;
+ use common_utils::{fallback_reverse_lookup_not_found, id_type};
use diesel_models::{kv, PaymentMethodUpdateInternal};
use error_stack::{report, ResultExt};
use redis_interface::HsetnxReply;
@@ -188,7 +189,7 @@ mod storage {
#[instrument(skip_all)]
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
@@ -230,7 +231,7 @@ mod storage {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id: &merchant_id,
- customer_id: &customer_id,
+ customer_id: customer_id.get_string_repr(),
};
let key_str = key.to_string();
let field =
@@ -301,7 +302,7 @@ mod storage {
let customer_id = payment_method.customer_id.clone();
let key = PartitionKey::MerchantIdCustomerId {
merchant_id: &merchant_id,
- customer_id: &customer_id,
+ customer_id: customer_id.get_string_repr(),
};
let field = format!("payment_method_id_{}", payment_method.payment_method_id);
let storage_scheme = decide_storage_scheme::<_, storage_types::PaymentMethod>(
@@ -364,7 +365,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
limit: Option<i64>,
) -> CustomResult<Vec<storage_types::PaymentMethod>, errors::StorageError> {
@@ -382,7 +383,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
@@ -406,7 +407,7 @@ mod storage {
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id,
- customer_id,
+ customer_id: customer_id.get_string_repr(),
};
let pattern = "payment_method_id_*";
@@ -456,6 +457,7 @@ mod storage {
#[cfg(not(feature = "kv_store"))]
mod storage {
+ use common_utils::id_type;
use error_stack::report;
use router_env::{instrument, tracing};
@@ -466,6 +468,7 @@ mod storage {
services::Store,
types::storage::{self as storage_types, enums::MerchantStorageScheme},
};
+
#[async_trait::async_trait]
impl PaymentMethodInterface for Store {
#[instrument(skip_all)]
@@ -495,7 +498,7 @@ mod storage {
#[instrument(skip_all)]
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
@@ -540,7 +543,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
limit: Option<i64>,
) -> CustomResult<Vec<storage_types::PaymentMethod>, errors::StorageError> {
@@ -558,7 +561,7 @@ mod storage {
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
@@ -637,7 +640,7 @@ impl PaymentMethodInterface for MockDb {
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
@@ -645,7 +648,7 @@ impl PaymentMethodInterface for MockDb {
let count = payment_methods
.iter()
.filter(|pm| {
- pm.customer_id == customer_id
+ pm.customer_id == *customer_id
&& pm.merchant_id == merchant_id
&& pm.status == status
})
@@ -700,14 +703,14 @@ impl PaymentMethodInterface for MockDb {
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
_limit: Option<i64>,
) -> CustomResult<Vec<storage_types::PaymentMethod>, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
let payment_methods_found: Vec<storage_types::PaymentMethod> = payment_methods
.iter()
- .filter(|pm| pm.customer_id == customer_id && pm.merchant_id == merchant_id)
+ .filter(|pm| pm.customer_id == *customer_id && pm.merchant_id == merchant_id)
.cloned()
.collect();
@@ -723,7 +726,7 @@ impl PaymentMethodInterface for MockDb {
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
merchant_id: &str,
status: common_enums::PaymentMethodStatus,
_limit: Option<i64>,
@@ -733,7 +736,7 @@ impl PaymentMethodInterface for MockDb {
let payment_methods_found: Vec<storage_types::PaymentMethod> = payment_methods
.iter()
.filter(|pm| {
- pm.customer_id == customer_id
+ pm.customer_id == *customer_id
&& pm.merchant_id == merchant_id
&& pm.status == status
})
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index 64fa8e83d49..b97cfc3fa0d 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -1,4 +1,5 @@
use actix_web::{web, HttpRequest, HttpResponse, Responder};
+use common_utils::id_type;
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
@@ -35,7 +36,7 @@ pub async fn customers_create(
pub async fn customers_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
) -> HttpResponse {
let flow = Flow::CustomersRetrieve;
let payload = web::Json(customers::CustomerId {
@@ -90,12 +91,12 @@ pub async fn customers_list(state: web::Data<AppState>, req: HttpRequest) -> Htt
pub async fn customers_update(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
mut json_payload: web::Json<customers::CustomerRequest>,
) -> HttpResponse {
let flow = Flow::CustomersUpdate;
let customer_id = path.into_inner();
- json_payload.customer_id = customer_id;
+ json_payload.customer_id = Some(customer_id);
Box::pin(api::server_wrap(
flow,
state,
@@ -116,13 +117,14 @@ pub async fn customers_update(
pub async fn customers_delete(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
) -> impl Responder {
let flow = Flow::CustomersCreate;
let payload = web::Json(customers::CustomerId {
customer_id: path.into_inner(),
})
.into_inner();
+
Box::pin(api::server_wrap(
flow,
state,
@@ -142,7 +144,7 @@ pub async fn customers_delete(
pub async fn get_customer_mandates(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<id_type::CustomerId>,
) -> impl Responder {
let flow = Flow::CustomersGetMandates;
let customer_id = customers::CustomerId {
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index e9dacd9f84f..96daf95d115 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -1,5 +1,5 @@
use actix_web::{web, HttpRequest, HttpResponse};
-use common_utils::{consts::TOKEN_TTL, errors::CustomResult};
+use common_utils::{consts::TOKEN_TTL, errors::CustomResult, id_type};
use diesel_models::enums::IntentStatus;
use error_stack::ResultExt;
use router_env::{instrument, logger, tracing, Flow};
@@ -131,7 +131,7 @@ pub async fn list_payment_method_api(
#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))]
pub async fn list_customer_payment_method_api(
state: web::Data<AppState>,
- customer_id: web::Path<(String,)>,
+ customer_id: web::Path<(id_type::CustomerId,)>,
req: HttpRequest,
query_payload: web::Query<payment_methods::PaymentMethodListRequest>,
) -> HttpResponse {
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index c7280261c2a..64a7c8069f7 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -5,7 +5,7 @@ use api_models::{
};
use async_trait::async_trait;
use common_enums::TokenPurpose;
-use common_utils::date_time;
+use common_utils::{date_time, id_type};
use error_stack::{report, ResultExt};
use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation};
use masking::PeekInterface;
@@ -1037,7 +1037,7 @@ where
pub async fn is_ephemeral_auth<A: AppStateInfo + Sync>(
headers: &HeaderMap,
db: &dyn StorageInterface,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
) -> RouterResult<Box<dyn AuthenticateAndFetch<AuthenticationData, A>>> {
let api_key = get_api_key(headers)?;
diff --git a/crates/router/src/services/kafka/payment_intent.rs b/crates/router/src/services/kafka/payment_intent.rs
index 81ac6454c91..7a74f07e3b2 100644
--- a/crates/router/src/services/kafka/payment_intent.rs
+++ b/crates/router/src/services/kafka/payment_intent.rs
@@ -1,4 +1,4 @@
-use common_utils::types::MinorUnit;
+use common_utils::{id_type, types::MinorUnit};
use diesel_models::enums as storage_enums;
use hyperswitch_domain_models::payments::PaymentIntent;
use time::OffsetDateTime;
@@ -11,7 +11,7 @@ pub struct KafkaPaymentIntent<'a> {
pub amount: MinorUnit,
pub currency: Option<storage_enums::Currency>,
pub amount_captured: Option<MinorUnit>,
- pub customer_id: Option<&'a String>,
+ pub customer_id: Option<&'a id_type::CustomerId>,
pub description: Option<&'a String>,
pub return_url: Option<&'a String>,
pub connector_id: Option<&'a String>,
diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rs
index a07b90ee288..fd781c7df9c 100644
--- a/crates/router/src/services/kafka/payout.rs
+++ b/crates/router/src/services/kafka/payout.rs
@@ -1,4 +1,4 @@
-use common_utils::pii;
+use common_utils::{id_type, pii};
use diesel_models::enums as storage_enums;
use hyperswitch_domain_models::payouts::{payout_attempt::PayoutAttempt, payouts::Payouts};
use time::OffsetDateTime;
@@ -8,7 +8,7 @@ pub struct KafkaPayout<'a> {
pub payout_id: &'a String,
pub payout_attempt_id: &'a String,
pub merchant_id: &'a String,
- pub customer_id: &'a String,
+ pub customer_id: &'a id_type::CustomerId,
pub address_id: &'a String,
pub profile_id: &'a String,
pub payout_method_id: Option<&'a String>,
diff --git a/crates/router/src/types/domain/address.rs b/crates/router/src/types/domain/address.rs
index f2b110deb19..0ed09a35013 100644
--- a/crates/router/src/types/domain/address.rs
+++ b/crates/router/src/types/domain/address.rs
@@ -2,6 +2,7 @@ use async_trait::async_trait;
use common_utils::{
crypto, date_time,
errors::{CustomResult, ValidationError},
+ id_type,
};
use diesel_models::{address::AddressUpdateInternal, encryption::Encryption, enums};
use error_stack::ResultExt;
@@ -48,13 +49,13 @@ pub struct PaymentAddress {
pub address: Address,
pub payment_id: String,
// This is present in `PaymentAddress` because even `payouts` uses `PaymentAddress`
- pub customer_id: Option<String>,
+ pub customer_id: Option<id_type::CustomerId>,
}
#[derive(Debug, Clone)]
pub struct CustomerAddress {
pub address: Address,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
}
#[async_trait]
diff --git a/crates/router/src/types/domain/customer.rs b/crates/router/src/types/domain/customer.rs
index 0e8ac32b4af..c5b0b3701cb 100644
--- a/crates/router/src/types/domain/customer.rs
+++ b/crates/router/src/types/domain/customer.rs
@@ -1,4 +1,4 @@
-use common_utils::{crypto, date_time, pii};
+use common_utils::{crypto, date_time, id_type, pii};
use diesel_models::{customers::CustomerUpdateInternal, encryption::Encryption};
use error_stack::ResultExt;
use masking::{PeekInterface, Secret};
@@ -10,7 +10,7 @@ use crate::errors::{CustomResult, ValidationError};
#[derive(Clone, Debug)]
pub struct Customer {
pub id: Option<i32>,
- pub customer_id: String,
+ pub customer_id: id_type::CustomerId,
pub merchant_id: String,
pub name: crypto::OptionalEncryptableName,
pub email: crypto::OptionalEncryptableEmail,
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 82182d11702..3391b52a22c 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1184,7 +1184,7 @@ impl ForeignFrom<storage::GatewayStatusMap> for gsm_api_types::GsmResponse {
}
}
-impl ForeignFrom<&domain::Customer> for payments::CustomerDetails {
+impl ForeignFrom<&domain::Customer> for payments::CustomerDetailsResponse {
fn foreign_from(customer: &domain::Customer) -> Self {
Self {
id: customer.customer_id.clone(),
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index fdbf5087919..da6cac195ca 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -16,6 +16,7 @@ use std::fmt::Debug;
use api_models::{enums, payments, webhooks};
use base64::Engine;
+use common_utils::id_type;
pub use common_utils::{
crypto,
ext_traits::{ByteSliceExt, BytesExt, Encode, StringExt, ValueExt},
@@ -572,7 +573,7 @@ pub trait CustomerAddress {
&self,
address_details: payments::AddressDetails,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
) -> CustomResult<domain::CustomerAddress, common_utils::errors::CryptoError>;
@@ -640,7 +641,7 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
&self,
address_details: payments::AddressDetails,
merchant_id: &str,
- customer_id: &str,
+ customer_id: &id_type::CustomerId,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
) -> CustomResult<domain::CustomerAddress, common_utils::errors::CryptoError> {
@@ -698,7 +699,7 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
Ok(domain::CustomerAddress {
address,
- customer_id: customer_id.to_string(),
+ customer_id: customer_id.to_owned(),
})
}
.await
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index 8936b2af67f..256b115dbba 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -2,6 +2,7 @@ use api_models::{
enums::Connector::{DummyConnector4, DummyConnector7},
user::sample_data::SampleDataRequest,
};
+use common_utils::id_type;
use diesel_models::{user::sample_data::PaymentAttemptBatchNew, RefundNew};
use error_stack::ResultExt;
use hyperswitch_domain_models::payments::payment_intent::PaymentIntentNew;
@@ -143,6 +144,10 @@ pub async fn generate_sample_data(
return Err(SampleDataError::InvalidParameters.into());
}
+ // This has to be an internal server error because, this function failing means that the intended functionality is not working as expected
+ let dashboard_customer_id = id_type::CustomerId::from("hs-dashboard-user".into())
+ .change_context(SampleDataError::InternalServerError)?;
+
for num in 1..=sample_data_size {
let payment_id = common_utils::generate_id_with_default_len("test");
let attempt_id = crate::utils::get_payment_attempt_id(&payment_id, 1);
@@ -191,7 +196,7 @@ pub async fn generate_sample_data(
attempt_id.clone(),
),
attempt_count: 1,
- customer_id: Some("hs-dashboard-user".to_string()),
+ customer_id: Some(dashboard_customer_id.clone()),
amount_captured: Some(common_utils::types::MinorUnit::new(amount * 100)),
profile_id: Some(profile_id.clone()),
return_url: Default::default(),
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index b4eafee4c83..414ab8cd1d5 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -1,6 +1,7 @@
use std::{marker::PhantomData, str::FromStr};
use api_models::payments::{Address, AddressDetails, PhoneDetails};
+use common_utils::id_type;
use masking::Secret;
use router::{
configs::settings::Settings,
@@ -22,7 +23,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
types::RouterData {
flow: PhantomData,
merchant_id: String::from("aci"),
- customer_id: Some(String::from("aci")),
+ customer_id: Some(id_type::CustomerId::from("aci".into()).unwrap()),
connector: "aci".to_string(),
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: uuid::Uuid::new_v4().to_string(),
@@ -130,7 +131,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
types::RouterData {
flow: PhantomData,
merchant_id: String::from("aci"),
- customer_id: Some(String::from("aci")),
+ customer_id: Some(id_type::CustomerId::from("aci".into()).unwrap()),
connector: "aci".to_string(),
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: uuid::Uuid::new_v4().to_string(),
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 9955cb77df7..ae93ca326ba 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -480,7 +480,7 @@ pub trait ConnectorActions: Connector {
entity_type: enums::PayoutEntityType::Individual,
payout_type,
customer_details: Some(payments::CustomerDetails {
- customer_id: core_utils::get_or_generate_id("customer_id", &None, "cust_").ok(),
+ customer_id: Some(common_utils::generate_customer_id_of_default_length()),
name: Some(Secret::new("John Doe".to_string())),
email: Email::from_str("john.doe@example").ok(),
phone: Some(Secret::new("620874518".to_string())),
@@ -500,7 +500,7 @@ pub trait ConnectorActions: Connector {
RouterData {
flow: PhantomData,
merchant_id: self.get_name(),
- customer_id: Some(self.get_name()),
+ customer_id: Some(common_utils::generate_customer_id_of_default_length()),
connector: self.get_name(),
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: uuid::Uuid::new_v4().to_string(),
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 6566004c4cf..e76eee4c179 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -2,7 +2,7 @@
mod utils;
-use common_utils::types::MinorUnit;
+use common_utils::{id_type, types::MinorUnit};
use router::{
configs,
core::payments,
@@ -493,7 +493,7 @@ async fn payments_create_core_adyen_no_redirect() {
amount_to_capture: Some(MinorUnit::new(6540)),
capture_on: Some(datetime!(2022-09-10 10:11:12)),
confirm: Some(true),
- customer_id: Some(customer_id),
+ customer_id: Some(id_type::CustomerId::from(customer_id.into()).unwrap()),
description: Some("Its my first payment request".to_string()),
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OnSession),
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 288a1af3006..42cfe3b74c1 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -2,7 +2,7 @@
mod utils;
-use common_utils::types::MinorUnit;
+use common_utils::{id_type, types::MinorUnit};
use router::{
core::payments,
db::StorageImpl,
@@ -260,7 +260,7 @@ async fn payments_create_core_adyen_no_redirect() {
amount_to_capture: Some(MinorUnit::new(6540)),
capture_on: Some(datetime!(2022-09-10 10:11:12)),
confirm: Some(true),
- customer_id: Some(customer_id),
+ customer_id: Some(id_type::CustomerId::from(customer_id.into()).unwrap()),
description: Some("Its my first payment request".to_string()),
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OffSession),
diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs
index 4ee66826b20..b1582bb6e9a 100644
--- a/crates/storage_impl/src/lib.rs
+++ b/crates/storage_impl/src/lib.rs
@@ -392,7 +392,8 @@ impl UniqueConstraints for diesel_models::Customer {
fn unique_constraints(&self) -> Vec<String> {
vec![format!(
"customer_{}_{}",
- self.customer_id, self.merchant_id
+ self.customer_id.get_string_repr(),
+ self.merchant_id
)]
}
fn table_name(&self) -> &str {
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 5a21fe0d249..9defe94f94c 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -8118,7 +8118,9 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
- "example": "cus_meowerunwiuwiwqw"
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
},
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
@@ -8173,7 +8175,53 @@
"properties": {
"id": {
"type": "string",
- "description": "The identifier for the customer."
+ "description": "The identifier for the customer.",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
+ },
+ "name": {
+ "type": "string",
+ "description": "The customer's name",
+ "example": "John Doe",
+ "nullable": true,
+ "maxLength": 255
+ },
+ "email": {
+ "type": "string",
+ "description": "The customer's email address",
+ "example": "[email protected]",
+ "nullable": true,
+ "maxLength": 255
+ },
+ "phone": {
+ "type": "string",
+ "description": "The customer's phone number",
+ "example": "3141592653",
+ "nullable": true,
+ "maxLength": 10
+ },
+ "phone_country_code": {
+ "type": "string",
+ "description": "The country code for the customer's phone number",
+ "example": "+1",
+ "nullable": true,
+ "maxLength": 2
+ }
+ }
+ },
+ "CustomerDetailsResponse": {
+ "type": "object",
+ "required": [
+ "id"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "The identifier for the customer.",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
},
"name": {
"type": "string",
@@ -8231,7 +8279,9 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
- "example": "cus_meowerunwiuwiwqw"
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
},
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
@@ -8378,7 +8428,9 @@
"type": "string",
"description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "maxLength": 255
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 1
},
"name": {
"type": "string",
@@ -8439,9 +8491,10 @@
"properties": {
"customer_id": {
"type": "string",
- "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
+ "description": "The identifier for the customer object",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "maxLength": 255
+ "maxLength": 64,
+ "minLength": 1
},
"name": {
"type": "string",
@@ -8521,7 +8574,10 @@
],
"properties": {
"customer_id": {
- "type": "string"
+ "type": "string",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
},
"payment_method_id": {
"type": "string"
@@ -8773,7 +8829,10 @@
"properties": {
"customer_id": {
"type": "string",
- "description": "customer_id to which this ephemeral key belongs to"
+ "description": "customer_id to which this ephemeral key belongs to",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
},
"created_at": {
"type": "integer",
@@ -12885,8 +12944,10 @@
"customer_id": {
"type": "string",
"description": "The identifier for customer",
- "example": "cus_meowuwunwiuwiwqw",
- "nullable": true
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 1
},
"starting_after": {
"type": "string",
@@ -13031,8 +13092,10 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
- "example": "cus_meowerunwiuwiwqw",
- "nullable": true
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 1
},
"card_network": {
"type": "string",
@@ -13404,8 +13467,10 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
- "example": "cus_meowerunwiuwiwqw",
- "nullable": true
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 1
},
"payment_method_id": {
"type": "string",
@@ -13862,10 +13927,11 @@
},
"customer_id": {
"type": "string",
- "description": "The identifier for the customer object.",
+ "description": "The identifier for the customer",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
- "maxLength": 255
+ "maxLength": 64,
+ "minLength": 1
},
"off_session": {
"type": "boolean",
@@ -14222,10 +14288,11 @@
},
"customer_id": {
"type": "string",
- "description": "The identifier for the customer object.",
+ "description": "The identifier for the customer",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
- "maxLength": 255
+ "maxLength": 64,
+ "minLength": 1
},
"off_session": {
"type": "boolean",
@@ -14694,10 +14761,11 @@
},
"customer_id": {
"type": "string",
- "description": "The identifier for the customer object.",
+ "description": "The identifier for the customer",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
- "maxLength": 255
+ "maxLength": 64,
+ "minLength": 1
},
"email": {
"type": "string",
@@ -15101,12 +15169,13 @@
"deprecated": true,
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
- "maxLength": 255
+ "maxLength": 64,
+ "minLength": 1
},
"customer": {
"allOf": [
{
- "$ref": "#/components/schemas/CustomerDetails"
+ "$ref": "#/components/schemas/CustomerDetailsResponse"
}
],
"nullable": true
@@ -15792,10 +15861,11 @@
},
"customer_id": {
"type": "string",
- "description": "The identifier for the customer object.",
+ "description": "The identifier for the customer",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
- "maxLength": 255
+ "maxLength": 64,
+ "minLength": 1
},
"off_session": {
"type": "boolean",
@@ -16155,7 +16225,6 @@
"currency",
"confirm",
"payout_type",
- "customer_id",
"auto_fulfill",
"client_secret",
"return_url",
@@ -16233,6 +16302,7 @@
"type": "string",
"description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "nullable": true,
"maxLength": 255
},
"auto_fulfill": {
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
index 397f164511f..01ca82e7a6d 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
index 397f164511f..01ca82e7a6d 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
index 397f164511f..01ca82e7a6d 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/request.json
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/request.json
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/request.json
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json
index 2b6e0287d48..d84bc378e9f 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
index 188c0b38676..4df766dd9ae 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario10-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "stripesavecard_{{random_number}}",
+ "customer_id": "stripesavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json
index f40ab119265..e2e3487835b 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario11-Save card payment with manual capture/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json
index 750011ab177..5210f97558b 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario9-Add card flow/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "stripesavecard_{{random_number}}",
+ "customer_id": "stripesavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
@@ -76,12 +76,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/nmi/Flow Testcases/Happy Cases/Scenario10-Add card flow/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario10-Add card flow/Payments - Create/request.json
index d0320b09975..191d28b5722 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario10-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario10-Add card flow/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": "{{random_number}}",
- "customer_id": "stripesavecard_{{random_number}}",
+ "customer_id": "stripesavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario11-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario11-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
index fe4adccda47..e9a8d716625 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario11-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario11-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": "{{random_number}}",
- "customer_id": "stripesavecard_{{random_number}}",
+ "customer_id": "stripesavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json
index 2ac0cacfb99..4e2266d7a8e 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "stripesavecard_{{random_number}}",
+ "customer_id": "stripesavecard_1234",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
index 150106cfded..2fc42dd451d 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "stripesavecard_{{random_number}}",
+ "customer_id": "stripesavecard_1234",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json
index d73166871cd..875cca26aad 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json
@@ -24,7 +24,7 @@
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 6540,
- "customer_id": "adyensavecard_{{random_number}}",
+ "customer_id": "adyensavecard",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 397864885cb..4fdc32050a1 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -18389,7 +18389,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard_1234\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -19103,7 +19103,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"stripesavecard_1234\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -19569,7 +19569,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
|
feat
|
add a domain type for `customer_id` (#4705)
|
8113a57f8440d6dcf02a3d803ecc4e9cf319bb1d
|
2023-01-20 01:43:08
|
Sangamesh Kulkarni
|
docs: request and response for payments route (#400)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 4fdc5dc488e..ec38f147dda 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -559,7 +559,8 @@ pub enum RoutableConnectors {
Worldpay,
}
-#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
+/// Wallets which support obtaining session object
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum SupportedWallets {
Paypal,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 1d50c88a08d..ddbf7325fd6 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -399,10 +399,13 @@ pub enum PaymentMethodDataResponse {
Paypal,
}
-#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, ToSchema)]
pub enum PaymentIdType {
+ /// The identifier for payment intent
PaymentIntentId(String),
+ /// The identifier for connector transaction
ConnectorTransactionId(String),
+ /// The identifier for payment attempt
PaymentAttemptId(String),
}
@@ -515,13 +518,19 @@ pub struct PhoneDetails {
pub country_code: Option<String>,
}
-#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize)]
+#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize, ToSchema)]
pub struct PaymentsCaptureRequest {
+ /// The unique identifier for the payment
pub payment_id: Option<String>,
+ /// The unique identifier for the merchant
pub merchant_id: Option<String>,
+ /// The Amount to be captured/ debited from the user's payment method.
pub amount_to_capture: Option<i64>,
+ /// Decider to refund the uncaptured amount
pub refund_uncaptured_amount: Option<bool>,
+ /// Provides information about a card payment that customers see on their statements.
pub statement_descriptor_suffix: Option<String>,
+ /// Concatenated with the statement descriptor suffix that’s set on the account to form the complete statement descriptor.
pub statement_descriptor_prefix: Option<String>,
}
@@ -670,33 +679,44 @@ pub struct PaymentsResponse {
pub error_message: Option<String>,
}
-#[derive(Clone, Debug, serde::Deserialize)]
+#[derive(Clone, Debug, serde::Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct PaymentListConstraints {
+ /// The identifier for customer
pub customer_id: Option<String>,
+ /// A cursor for use in pagination, fetch the next list after some object
pub starting_after: Option<String>,
+ /// A cursor for use in pagination, fetch the previous list before some object
pub ending_before: Option<String>,
+ /// limit on the number of objects to return
#[serde(default = "default_limit")]
pub limit: i64,
+ /// The time at which payment is created
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<PrimitiveDateTime>,
+ /// Time less than the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.lt")]
pub created_lt: Option<PrimitiveDateTime>,
+ /// Time greater than the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.gt")]
pub created_gt: Option<PrimitiveDateTime>,
+ /// Time less than or equals to the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.lte")]
pub created_lte: Option<PrimitiveDateTime>,
+ /// Time greater than or equals to the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.gte")]
pub created_gte: Option<PrimitiveDateTime>,
}
-#[derive(Clone, Debug, serde::Serialize)]
+#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct PaymentListResponse {
+ /// The number of payments included in the list
pub size: usize,
+ // The list of payments response objects
pub data: Vec<PaymentsResponse>,
}
@@ -949,12 +969,17 @@ pub struct PaymentsResponseForm {
pub order_id: String,
}
-#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)]
+#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsRetrieveRequest {
+ /// The type of ID (ex: payment intent id, payment attempt id or connector txn id)
pub resource_id: PaymentIdType,
+ /// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
+ /// Decider to enable or disable the connector call for retrieve request
pub force_sync: bool,
+ /// The parameters passed to a retrieve request
pub param: Option<String>,
+ /// The name of the connector
pub connector: Option<String>,
}
@@ -978,119 +1003,171 @@ pub struct Metadata {
pub data: serde_json::Value,
}
-#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsSessionRequest {
+ /// The identifier for the payment
pub payment_id: String,
+ /// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
pub client_secret: String,
+ /// The list of the supported wallets
+ #[schema(value_type = Vec<SupportedWallets>)]
pub wallets: Vec<api_enums::SupportedWallets>,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayAllowedMethodsParameters {
+ /// The list of allowed auth methods (ex: 3DS, No3DS, PAN_ONLY etc)
pub allowed_auth_methods: Vec<String>,
+ /// The list of allowed card networks (ex: AMEX,JCB etc)
pub allowed_card_networks: Vec<String>,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayTokenParameters {
+ /// The name of the connector
pub gateway: String,
+ /// The merchant ID registered in the connector associated
pub gateway_merchant_id: String,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayTokenizationSpecification {
+ /// The token specification type(ex: PAYMENT_GATEWAY)
#[serde(rename = "type")]
pub token_specification_type: String,
+ /// The parameters for the token specification Google Pay
pub parameters: GpayTokenParameters,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayAllowedPaymentMethods {
+ /// The type of payment method
#[serde(rename = "type")]
pub payment_method_type: String,
+ /// The parameters Google Pay requires
pub parameters: GpayAllowedMethodsParameters,
+ /// The tokenization specification for Google Pay
pub tokenization_specification: GpayTokenizationSpecification,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayTransactionInfo {
+ /// The country code
pub country_code: String,
+ /// The currency code
pub currency_code: String,
+ /// The total price status (ex: 'FINAL')
pub total_price_status: String,
+ /// The total price
pub total_price: i64,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayMerchantInfo {
+ /// The name of the merchant
pub merchant_name: String,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-pub struct GpayMetadata {
+pub struct GpayMetaData {
pub merchant_info: GpayMerchantInfo,
pub allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpaySessionTokenData {
- pub data: GpayMetadata,
+ #[serde(rename = "gpay")]
+ pub data: GpayMetaData,
}
-#[derive(Debug, Clone, serde::Serialize)]
+#[derive(Debug, Clone, serde::Serialize, ToSchema)]
#[serde(tag = "wallet_name")]
#[serde(rename_all = "lowercase")]
pub enum SessionToken {
+ /// The session response structure for Google Pay
Gpay {
- #[serde(flatten)]
- data: GpayMetadata,
+ /// The merchant info
+ merchant_info: GpayMerchantInfo,
+ /// List of the allowed payment meythods
+ allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
+ /// The transaction info Google Pay requires
transaction_info: GpayTransactionInfo,
},
+ /// The session response structure for Klarna
Klarna {
+ /// The session token for Klarna
session_token: String,
+ /// The identifier for the session
session_id: String,
},
+ /// The session response structure for PayPal
Paypal {
+ /// The session token for PayPal
session_token: String,
},
+ /// The session response structure for Apple Pay
Applepay {
+ /// Timestamp at which session is requested
epoch_timestamp: u64,
+ /// Timestamp at which session expires
expires_at: u64,
+ /// The identifier for the merchant session
merchant_session_identifier: String,
+ /// Applepay generates unique ID (UUID) value
nonce: String,
+ /// The identifier for the merchant
merchant_identifier: String,
+ /// The domain name of the merchant which is registered in Apple Pay
domain_name: String,
+ /// The name to be displayed on Apple Pay button
display_name: String,
+ /// A string which represents the properties of a payment
signature: String,
+ /// The identifier for the operational analytics
operational_analytics_identifier: String,
+ /// The number of retries to get the session response
retries: u8,
+ /// The identifier for the connector transaction
psp_id: String,
},
}
-#[derive(Default, Debug, serde::Serialize, Clone)]
+#[derive(Default, Debug, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsSessionResponse {
+ /// The identifier for the payment
pub payment_id: String,
+ /// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
+ #[schema(value_type = String)]
pub client_secret: Secret<String, pii::ClientSecret>,
+ /// The list of session token object
pub session_token: Vec<SessionToken>,
}
-#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)]
+#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentRetrieveBody {
+ /// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
+ /// Decider to enable or disable the connector call for retrieve request
pub force_sync: Option<bool>,
}
-#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)]
+#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsCancelRequest {
+ /// The identifier for the payment
#[serde(skip)]
pub payment_id: String,
+ /// The reason for the payment cancel
pub cancellation_reason: Option<String>,
}
-#[derive(Default, Debug, serde::Deserialize, serde::Serialize)]
+#[derive(Default, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaymentsStartRequest {
+ /// Unique identifier for the payment. This ensures impotency for multiple payments
+ /// that have been done by a single merchant. This field is auto generated and is returned in the API response.
pub payment_id: String,
+ /// The identifier for the Merchant Account.
pub merchant_id: String,
- pub txn_id: String,
+ /// The identifier for the payment transaction
+ pub attempt_id: String,
}
mod payment_id_type {
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 5c60719c98a..c105e62e850 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -84,8 +84,9 @@ fn create_gpay_session_token(
let response_router_data = types::PaymentsSessionRouterData {
response: Ok(types::PaymentsResponseData::SessionResponse {
session_token: payment_types::SessionToken::Gpay {
- data: gpay_data.data,
transaction_info,
+ merchant_info: gpay_data.data.merchant_info,
+ allowed_payment_methods: gpay_data.data.allowed_payment_methods,
},
}),
..router_data.clone()
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 8ef5f409489..ae6543fec67 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -70,6 +70,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::WalletIssuer,
api_models::enums::Connector,
api_models::enums::PaymentMethodType,
+ api_models::enums::SupportedWallets,
api_models::admin::PaymentConnectorCreate,
api_models::admin::PaymentMethods,
api_models::payments::AddressDetails,
@@ -94,6 +95,23 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsRequest,
api_models::payments::PaymentsResponse,
api_models::payment_methods::PaymentExperience,
+ api_models::payments::PaymentsStartRequest,
+ api_models::payments::PaymentRetrieveBody,
+ api_models::payments::PaymentsRetrieveRequest,
+ api_models::payments::PaymentIdType,
+ api_models::payments::PaymentsCaptureRequest,
+ api_models::payments::PaymentsSessionRequest,
+ api_models::payments::PaymentsSessionResponse,
+ api_models::payments::SessionToken,
+ api_models::payments::GpayMerchantInfo,
+ api_models::payments::GpayAllowedPaymentMethods,
+ api_models::payments::GpayAllowedMethodsParameters,
+ api_models::payments::GpayTokenizationSpecification,
+ api_models::payments::GpayTokenParameters,
+ api_models::payments::GpayTransactionInfo,
+ api_models::payments::PaymentsCancelRequest,
+ api_models::payments::PaymentListConstraints,
+ api_models::payments::PaymentListResponse,
crate::types::api::admin::MerchantAccountResponse,
crate::types::api::admin::MerchantConnectorId,
crate::types::api::admin::MerchantDetails,
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 6bfe771f98e..f427044cb80 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -62,7 +62,7 @@ pub async fn payments_start(
let payload = payment_types::PaymentsStartRequest {
payment_id: payment_id.clone(),
merchant_id: merchant_id.clone(),
- txn_id: attempt_id.clone(),
+ attempt_id: attempt_id.clone(),
};
api::server_wrap(
&state,
diff --git a/openapi/generated.json b/openapi/generated.json
index 56b77eea880..a96a2dc9e8b 100644
--- a/openapi/generated.json
+++ b/openapi/generated.json
@@ -698,6 +698,122 @@
"on_session"
]
},
+ "GpayAllowedMethodsParameters": {
+ "type": "object",
+ "required": [
+ "allowed_auth_methods",
+ "allowed_card_networks"
+ ],
+ "properties": {
+ "allowed_auth_methods": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "description": "The list of allowed auth methods (ex: 3DS, No3DS, PAN_ONLY etc)"
+ }
+ },
+ "allowed_card_networks": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "description": "The list of allowed card networks (ex: AMEX,JCB etc)"
+ }
+ }
+ }
+ },
+ "GpayAllowedPaymentMethods": {
+ "type": "object",
+ "required": [
+ "type",
+ "parameters",
+ "tokenization_specification"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "description": "The type of payment method"
+ },
+ "parameters": {
+ "$ref": "#/components/schemas/GpayAllowedMethodsParameters"
+ },
+ "tokenization_specification": {
+ "$ref": "#/components/schemas/GpayTokenizationSpecification"
+ }
+ }
+ },
+ "GpayMerchantInfo": {
+ "type": "object",
+ "required": [
+ "merchant_name"
+ ],
+ "properties": {
+ "merchant_name": {
+ "type": "string",
+ "description": "The name of the merchant"
+ }
+ }
+ },
+ "GpayTokenParameters": {
+ "type": "object",
+ "required": [
+ "gateway",
+ "gateway_merchant_id"
+ ],
+ "properties": {
+ "gateway": {
+ "type": "string",
+ "description": "The name of the connector"
+ },
+ "gateway_merchant_id": {
+ "type": "string",
+ "description": "The merchant ID registered in the connector associated"
+ }
+ }
+ },
+ "GpayTokenizationSpecification": {
+ "type": "object",
+ "required": [
+ "type",
+ "parameters"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "description": "The token specification type(ex: PAYMENT_GATEWAY)"
+ },
+ "parameters": {
+ "$ref": "#/components/schemas/GpayTokenParameters"
+ }
+ }
+ },
+ "GpayTransactionInfo": {
+ "type": "object",
+ "required": [
+ "country_code",
+ "currency_code",
+ "total_price_status",
+ "total_price"
+ ],
+ "properties": {
+ "country_code": {
+ "type": "string",
+ "description": "The country code"
+ },
+ "currency_code": {
+ "type": "string",
+ "description": "The currency code"
+ },
+ "total_price_status": {
+ "type": "string",
+ "description": "The total price status (ex: 'FINAL')"
+ },
+ "total_price": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The total price"
+ }
+ }
+ },
"IntentStatus": {
"type": "string",
"enum": [
@@ -1184,6 +1300,112 @@
"invoke_payment_app"
]
},
+ "PaymentIdType": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "PaymentIntentId"
+ ],
+ "properties": {
+ "PaymentIntentId": {
+ "type": "string",
+ "description": "The identifier for payment intent"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "ConnectorTransactionId"
+ ],
+ "properties": {
+ "ConnectorTransactionId": {
+ "type": "string",
+ "description": "The identifier for connector transaction"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "PaymentAttemptId"
+ ],
+ "properties": {
+ "PaymentAttemptId": {
+ "type": "string",
+ "description": "The identifier for payment attempt"
+ }
+ }
+ }
+ ]
+ },
+ "PaymentListConstraints": {
+ "type": "object",
+ "properties": {
+ "customer_id": {
+ "type": "string",
+ "description": "The identifier for customer"
+ },
+ "starting_after": {
+ "type": "string",
+ "description": "A cursor for use in pagination, fetch the next list after some object"
+ },
+ "ending_before": {
+ "type": "string",
+ "description": "A cursor for use in pagination, fetch the previous list before some object"
+ },
+ "limit": {
+ "type": "integer",
+ "format": "int64",
+ "description": "limit on the number of objects to return"
+ },
+ "created": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time at which payment is created"
+ },
+ "created.lt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Time less than the payment created time"
+ },
+ "created.gt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Time greater than the payment created time"
+ },
+ "created.lte": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Time less than or equals to the payment created time"
+ },
+ "created.gte": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Time greater than or equals to the payment created time"
+ }
+ }
+ },
+ "PaymentListResponse": {
+ "type": "object",
+ "required": [
+ "size",
+ "data"
+ ],
+ "properties": {
+ "size": {
+ "type": "integer",
+ "description": "The number of payments included in the list"
+ },
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentsResponse"
+ }
+ }
+ }
+ },
"PaymentMethod": {
"oneOf": [
{
@@ -1361,6 +1583,58 @@
}
}
},
+ "PaymentRetrieveBody": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "description": "The identifier for the Merchant Account."
+ },
+ "force_sync": {
+ "type": "boolean",
+ "description": "Decider to enable or disable the connector call for retrieve request"
+ }
+ }
+ },
+ "PaymentsCancelRequest": {
+ "type": "object",
+ "properties": {
+ "cancellation_reason": {
+ "type": "string",
+ "description": "The reason for the payment cancel"
+ }
+ }
+ },
+ "PaymentsCaptureRequest": {
+ "type": "object",
+ "properties": {
+ "payment_id": {
+ "type": "string",
+ "description": "The unique identifier for the payment"
+ },
+ "merchant_id": {
+ "type": "string",
+ "description": "The unique identifier for the merchant"
+ },
+ "amount_to_capture": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The Amount to be captured/ debited from the user's payment method."
+ },
+ "refund_uncaptured_amount": {
+ "type": "boolean",
+ "description": "Decider to refund the uncaptured amount"
+ },
+ "statement_descriptor_suffix": {
+ "type": "string",
+ "description": "Provides information about a card payment that customers see on their statements."
+ },
+ "statement_descriptor_prefix": {
+ "type": "string",
+ "description": "Concatenated with the statement descriptor suffix that’s set on the account to form the complete statement descriptor."
+ }
+ }
+ },
"PaymentsRequest": {
"type": "object",
"properties": {
@@ -1699,6 +1973,104 @@
}
}
},
+ "PaymentsRetrieveRequest": {
+ "type": "object",
+ "required": [
+ "resource_id",
+ "force_sync"
+ ],
+ "properties": {
+ "resource_id": {
+ "$ref": "#/components/schemas/PaymentIdType"
+ },
+ "merchant_id": {
+ "type": "string",
+ "description": "The identifier for the Merchant Account."
+ },
+ "force_sync": {
+ "type": "boolean",
+ "description": "Decider to enable or disable the connector call for retrieve request"
+ },
+ "param": {
+ "type": "string",
+ "description": "The parameters passed to a retrieve request"
+ },
+ "connector": {
+ "type": "string",
+ "description": "The name of the connector"
+ }
+ }
+ },
+ "PaymentsSessionRequest": {
+ "type": "object",
+ "required": [
+ "payment_id",
+ "client_secret",
+ "wallets"
+ ],
+ "properties": {
+ "payment_id": {
+ "type": "string",
+ "description": "The identifier for the payment"
+ },
+ "client_secret": {
+ "type": "string",
+ "description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"
+ },
+ "wallets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SupportedWallets"
+ }
+ }
+ }
+ },
+ "PaymentsSessionResponse": {
+ "type": "object",
+ "required": [
+ "payment_id",
+ "client_secret",
+ "session_token"
+ ],
+ "properties": {
+ "payment_id": {
+ "type": "string",
+ "description": "The identifier for the payment"
+ },
+ "client_secret": {
+ "type": "string",
+ "description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"
+ },
+ "session_token": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SessionToken"
+ }
+ }
+ }
+ },
+ "PaymentsStartRequest": {
+ "type": "object",
+ "required": [
+ "payment_id",
+ "merchant_id",
+ "attempt_id"
+ ],
+ "properties": {
+ "payment_id": {
+ "type": "string",
+ "description": "Unique identifier for the payment. This ensures impotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response."
+ },
+ "merchant_id": {
+ "type": "string",
+ "description": "The identifier for the Merchant Account."
+ },
+ "attempt_id": {
+ "type": "string",
+ "description": "The identifier for the payment transaction"
+ }
+ }
+ },
"PhoneDetails": {
"type": "object",
"properties": {
@@ -1833,6 +2205,171 @@
],
"example": "custom"
},
+ "SessionToken": {
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "The session response structure for Google Pay",
+ "required": [
+ "merchant_info",
+ "allowed_payment_methods",
+ "transaction_info",
+ "wallet_name"
+ ],
+ "properties": {
+ "merchant_info": {
+ "$ref": "#/components/schemas/GpayMerchantInfo"
+ },
+ "allowed_payment_methods": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/GpayAllowedPaymentMethods"
+ }
+ },
+ "transaction_info": {
+ "$ref": "#/components/schemas/GpayTransactionInfo"
+ },
+ "wallet_name": {
+ "type": "string",
+ "enum": [
+ "gpay"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The session response structure for Klarna",
+ "required": [
+ "session_token",
+ "session_id",
+ "wallet_name"
+ ],
+ "properties": {
+ "session_token": {
+ "type": "string",
+ "description": "The session token for Klarna"
+ },
+ "session_id": {
+ "type": "string",
+ "description": "The identifier for the session"
+ },
+ "wallet_name": {
+ "type": "string",
+ "enum": [
+ "klarna"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The session response structure for PayPal",
+ "required": [
+ "session_token",
+ "wallet_name"
+ ],
+ "properties": {
+ "session_token": {
+ "type": "string",
+ "description": "The session token for PayPal"
+ },
+ "wallet_name": {
+ "type": "string",
+ "enum": [
+ "paypal"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The session response structure for Apple Pay",
+ "required": [
+ "epoch_timestamp",
+ "expires_at",
+ "merchant_session_identifier",
+ "nonce",
+ "merchant_identifier",
+ "domain_name",
+ "display_name",
+ "signature",
+ "operational_analytics_identifier",
+ "retries",
+ "psp_id",
+ "wallet_name"
+ ],
+ "properties": {
+ "epoch_timestamp": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Timestamp at which session is requested"
+ },
+ "expires_at": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Timestamp at which session expires"
+ },
+ "merchant_session_identifier": {
+ "type": "string",
+ "description": "The identifier for the merchant session"
+ },
+ "nonce": {
+ "type": "string",
+ "description": "Applepay generates unique ID (UUID) value"
+ },
+ "merchant_identifier": {
+ "type": "string",
+ "description": "The identifier for the merchant"
+ },
+ "domain_name": {
+ "type": "string",
+ "description": "The domain name of the merchant which is registered in Apple Pay"
+ },
+ "display_name": {
+ "type": "string",
+ "description": "The name to be displayed on Apple Pay button"
+ },
+ "signature": {
+ "type": "string",
+ "description": "A string which represents the properties of a payment"
+ },
+ "operational_analytics_identifier": {
+ "type": "string",
+ "description": "The identifier for the operational analytics"
+ },
+ "retries": {
+ "type": "integer",
+ "format": "int32",
+ "description": "The number of retries to get the session response"
+ },
+ "psp_id": {
+ "type": "string",
+ "description": "The identifier for the connector transaction"
+ },
+ "wallet_name": {
+ "type": "string",
+ "enum": [
+ "applepay"
+ ]
+ }
+ }
+ }
+ ],
+ "discriminator": {
+ "propertyName": "wallet_name"
+ }
+ },
+ "SupportedWallets": {
+ "type": "string",
+ "description": "Wallets which support obtaining session object",
+ "enum": [
+ "paypal",
+ "apple_pay",
+ "klarna",
+ "gpay"
+ ]
+ },
"WalletData": {
"type": "object",
"required": [
|
docs
|
request and response for payments route (#400)
|
3b942c2b88e63f066693474d56e0ff6ca57b06fe
|
2023-07-14 18:15:07
|
github-actions
|
chore(version): v1.5.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 14081feafc3..ad988698a82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,45 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.5.0 (2023-07-14)
+
+### Features
+
+- **connector:**
+ - [Tsys] Add template code for Tsys connector ([#1704](https://github.com/juspay/hyperswitch/pull/1704)) ([`7609895`](https://github.com/juspay/hyperswitch/commit/76098952105c101c88410c6aa78c2c56298f0aaa))
+ - [Authorizedotnet] Add Wallet support ([#1223](https://github.com/juspay/hyperswitch/pull/1223)) ([`05540ea`](https://github.com/juspay/hyperswitch/commit/05540ea17e6fda4ae37b31c46956b3c93f94f903))
+ - [Adyen] Add support for PayPal wallet mandates ([#1686](https://github.com/juspay/hyperswitch/pull/1686)) ([`82fd844`](https://github.com/juspay/hyperswitch/commit/82fd84462072a7616806b0e06dc8a6812312f439))
+- **router:** Add expand attempts support in payments retrieve response ([#1678](https://github.com/juspay/hyperswitch/pull/1678)) ([`8572f1d`](https://github.com/juspay/hyperswitch/commit/8572f1da8eb57577b18537d3397f03448720ed3d))
+- Filter out payment_methods which does not support mandates during list api call ([#1318](https://github.com/juspay/hyperswitch/pull/1318)) ([`07aef53`](https://github.com/juspay/hyperswitch/commit/07aef53a5cd4cd70f75415e883d0e07d85244a1e))
+- Add `organization_id` to merchant account ([#1611](https://github.com/juspay/hyperswitch/pull/1611)) ([`7025b78`](https://github.com/juspay/hyperswitch/commit/7025b789b81221d45d7832460fab0c09b92aa9f9))
+
+### Bug Fixes
+
+- **api_keys:** Fix API key being created for non-existent merchant account ([#1712](https://github.com/juspay/hyperswitch/pull/1712)) ([`c9e20dc`](https://github.com/juspay/hyperswitch/commit/c9e20dcd30beb1de0b571dc61a0e843eda3f8ae0))
+- **router:** Decrease payment method token time based on payment_intent creation time ([#1682](https://github.com/juspay/hyperswitch/pull/1682)) ([`ce1d205`](https://github.com/juspay/hyperswitch/commit/ce1d2052190623ff85b1af830fe3835300e4d025))
+- **ui-test:** Run UI tests only on merge-queue ([#1709](https://github.com/juspay/hyperswitch/pull/1709)) ([`cb0ca0c`](https://github.com/juspay/hyperswitch/commit/cb0ca0cc2f9909921d574dbaa759744edb4cc275))
+- Store and retrieve merchant secret from MCA table for webhooks source verification ([#1331](https://github.com/juspay/hyperswitch/pull/1331)) ([`a6645bd`](https://github.com/juspay/hyperswitch/commit/a6645bd3540f66ebfdfa352bce87700c3c67a069))
+
+### Refactors
+
+- **CI-push:** Move merge_group to CI-push ([#1696](https://github.com/juspay/hyperswitch/pull/1696)) ([`08cca88`](https://github.com/juspay/hyperswitch/commit/08cca881c200a3e9a24fa780c035c37f51816ca9))
+- **payment_methods:** Remove legacy locker code as it is not been used ([#1666](https://github.com/juspay/hyperswitch/pull/1666)) ([`8832dd6`](https://github.com/juspay/hyperswitch/commit/8832dd60b98e37a6a46452e9dc1381dd64c2720f))
+
+### Testing
+
+- **connector:**
+ - [Multisafepay] Add ui test for card 3ds ([#1688](https://github.com/juspay/hyperswitch/pull/1688)) ([`9112417`](https://github.com/juspay/hyperswitch/commit/9112417caee51117c170af6096825c5b1b2bd0e0))
+ - [stripe] Add ui test for affirm ([#1694](https://github.com/juspay/hyperswitch/pull/1694)) ([`8c5703d`](https://github.com/juspay/hyperswitch/commit/8c5703df545007d8b61679bd57d0a58986ec10ce))
+
+### Miscellaneous Tasks
+
+- Address Rust 1.71 clippy lints ([#1708](https://github.com/juspay/hyperswitch/pull/1708)) ([`2cf8ae7`](https://github.com/juspay/hyperswitch/commit/2cf8ae7817db0a74b744f41484db81e1c441ebf3))
+
+**Full Changelog:** [`v1.4.0...v1.5.0`](https://github.com/juspay/hyperswitch/compare/v1.4.0...v1.5.0)
+
+- - -
+
+
## 1.4.0 (2023-07-13)
### Features
|
chore
|
v1.5.0
|
f1196be9055699421d5ec1148a4f0646da4b8fc7
|
2024-08-10 11:50:31
|
Narayan Bhat
|
refactor(merchant_account_v2): remove routing algorithms from merchant account and add version column (#5527)
| false
|
diff --git a/crates/diesel_models/src/merchant_account.rs b/crates/diesel_models/src/merchant_account.rs
index 0f87748d276..b3ef64b3e3d 100644
--- a/crates/diesel_models/src/merchant_account.rs
+++ b/crates/diesel_models/src/merchant_account.rs
@@ -56,6 +56,7 @@ pub struct MerchantAccount {
pub recon_status: storage_enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(
@@ -90,6 +91,7 @@ pub struct MerchantAccountSetter {
pub recon_status: storage_enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(
@@ -126,6 +128,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
recon_status: item.recon_status,
payment_link_config: item.payment_link_config,
pm_collect_link_config: item.pm_collect_link_config,
+ version: item.version,
}
}
}
@@ -151,14 +154,12 @@ pub struct MerchantAccount {
pub publishable_key: Option<String>,
pub storage_scheme: storage_enums::MerchantStorageScheme,
pub metadata: Option<pii::SecretSerdeValue>,
- pub routing_algorithm: Option<serde_json::Value>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
- pub frm_routing_algorithm: Option<serde_json::Value>,
- pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: storage_enums::ReconStatus,
pub id: common_utils::id_type::MerchantId,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
@@ -173,11 +174,9 @@ impl From<MerchantAccountSetter> for MerchantAccount {
metadata: item.metadata,
created_at: item.created_at,
modified_at: item.modified_at,
- frm_routing_algorithm: item.frm_routing_algorithm,
- routing_algorithm: item.routing_algorithm,
- payout_routing_algorithm: item.payout_routing_algorithm,
organization_id: item.organization_id,
recon_status: item.recon_status,
+ version: item.version,
}
}
}
@@ -190,13 +189,11 @@ pub struct MerchantAccountSetter {
pub publishable_key: Option<String>,
pub storage_scheme: storage_enums::MerchantStorageScheme,
pub metadata: Option<pii::SecretSerdeValue>,
- pub routing_algorithm: Option<serde_json::Value>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
- pub frm_routing_algorithm: Option<serde_json::Value>,
- pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: storage_enums::ReconStatus,
+ pub version: common_enums::ApiVersion,
}
impl MerchantAccount {
@@ -248,6 +245,7 @@ pub struct MerchantAccountNew {
pub recon_status: storage_enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
@@ -258,14 +256,12 @@ pub struct MerchantAccountNew {
pub merchant_details: Option<Encryption>,
pub publishable_key: Option<String>,
pub metadata: Option<pii::SecretSerdeValue>,
- pub routing_algorithm: Option<serde_json::Value>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
- pub frm_routing_algorithm: Option<serde_json::Value>,
- pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: storage_enums::ReconStatus,
pub id: common_utils::id_type::MerchantId,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
@@ -277,10 +273,7 @@ pub struct MerchantAccountUpdateInternal {
pub publishable_key: Option<String>,
pub storage_scheme: Option<storage_enums::MerchantStorageScheme>,
pub metadata: Option<pii::SecretSerdeValue>,
- pub routing_algorithm: Option<serde_json::Value>,
pub modified_at: time::PrimitiveDateTime,
- pub frm_routing_algorithm: Option<serde_json::Value>,
- pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: Option<common_utils::id_type::OrganizationId>,
pub recon_status: Option<storage_enums::ReconStatus>,
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 08a4e68c883..a1df3a889cb 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -665,6 +665,7 @@ diesel::table! {
recon_status -> ReconStatus,
payment_link_config -> Nullable<Jsonb>,
pm_collect_link_config -> Nullable<Jsonb>,
+ version -> ApiVersion,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index b5cfc00ae18..8821c7c8976 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -647,16 +647,14 @@ diesel::table! {
publishable_key -> Nullable<Varchar>,
storage_scheme -> MerchantStorageScheme,
metadata -> Nullable<Jsonb>,
- routing_algorithm -> Nullable<Json>,
created_at -> Timestamp,
modified_at -> Timestamp,
- frm_routing_algorithm -> Nullable<Jsonb>,
- payout_routing_algorithm -> Nullable<Jsonb>,
#[max_length = 32]
organization_id -> Varchar,
recon_status -> ReconStatus,
#[max_length = 64]
id -> Varchar,
+ version -> ApiVersion,
}
}
diff --git a/crates/hyperswitch_domain_models/src/consts.rs b/crates/hyperswitch_domain_models/src/consts.rs
new file mode 100644
index 00000000000..8499cd3d82f
--- /dev/null
+++ b/crates/hyperswitch_domain_models/src/consts.rs
@@ -0,0 +1,14 @@
+//! Constants that are used in the domain models.
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "customer_v2"),
+ not(feature = "merchant_account_v2")
+))]
+pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
+
+#[cfg(all(
+ feature = "v2",
+ any(feature = "customer_v2", feature = "merchant_account_v2")
+))]
+pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs
index b1a8f8dfdbc..7f217632def 100644
--- a/crates/hyperswitch_domain_models/src/customer.rs
+++ b/crates/hyperswitch_domain_models/src/customer.rs
@@ -1,7 +1,6 @@
use api_models::customers::CustomerRequestWithEncryption;
// #[cfg(all(feature = "v2", feature = "customer_v2"))]
// use common_enums::SoftDeleteStatus;
-use common_enums::ApiVersion;
use common_utils::{
crypto, date_time,
encryption::Encryption,
@@ -36,7 +35,7 @@ pub struct Customer {
pub address_id: Option<String>,
pub default_payment_method_id: Option<String>,
pub updated_by: Option<String>,
- pub version: ApiVersion,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
@@ -54,12 +53,12 @@ pub struct Customer {
pub modified_at: PrimitiveDateTime,
pub default_payment_method_id: Option<String>,
pub updated_by: Option<String>,
- pub version: ApiVersion,
pub merchant_reference_id: Option<id_type::CustomerId>,
pub default_billing_address: Option<Encryption>,
pub default_shipping_address: Option<Encryption>,
// pub status: Option<SoftDeleteStatus>,
pub id: String,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
@@ -196,8 +195,8 @@ impl super::behaviour::Conversion for Customer {
updated_by: self.updated_by,
default_billing_address: self.default_billing_address.map(Encryption::from),
default_shipping_address: self.default_shipping_address.map(Encryption::from),
- // status: self.status,
version: self.version,
+ // status: self.status,
})
}
@@ -250,8 +249,8 @@ impl super::behaviour::Conversion for Customer {
updated_by: item.updated_by,
default_billing_address: item.default_billing_address,
default_shipping_address: item.default_shipping_address,
- // status: item.status,
version: item.version,
+ // status: item.status,
})
}
@@ -275,7 +274,7 @@ impl super::behaviour::Conversion for Customer {
default_billing_address: self.default_billing_address,
default_shipping_address: self.default_shipping_address,
// status: self.status,
- version: self.version,
+ version: crate::consts::API_VERSION,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index cabeda2ccc2..85f35116910 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -1,6 +1,7 @@
pub mod api;
pub mod behaviour;
pub mod business_profile;
+pub mod consts;
pub mod customer;
pub mod errors;
pub mod mandates;
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index 27592e84a41..c86dff60eaa 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -49,6 +49,7 @@ pub struct MerchantAccount {
pub recon_status: diesel_models::enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(
@@ -85,6 +86,7 @@ pub struct MerchantAccountSetter {
pub recon_status: diesel_models::enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
+ pub version: common_enums::ApiVersion,
}
#[cfg(all(
@@ -121,6 +123,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
recon_status: item.recon_status,
payment_link_config: item.payment_link_config,
pm_collect_link_config: item.pm_collect_link_config,
+ version: item.version,
}
}
}
@@ -135,11 +138,8 @@ pub struct MerchantAccountSetter {
pub publishable_key: String,
pub storage_scheme: MerchantStorageScheme,
pub metadata: Option<pii::SecretSerdeValue>,
- pub routing_algorithm: Option<serde_json::Value>,
- pub frm_routing_algorithm: Option<serde_json::Value>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
- pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: diesel_models::enums::ReconStatus,
}
@@ -154,11 +154,8 @@ impl From<MerchantAccountSetter> for MerchantAccount {
publishable_key,
storage_scheme,
metadata,
- routing_algorithm,
- frm_routing_algorithm,
created_at,
modified_at,
- payout_routing_algorithm,
organization_id,
recon_status,
} = item;
@@ -169,11 +166,8 @@ impl From<MerchantAccountSetter> for MerchantAccount {
publishable_key,
storage_scheme,
metadata,
- routing_algorithm,
- frm_routing_algorithm,
created_at,
modified_at,
- payout_routing_algorithm,
organization_id,
recon_status,
}
@@ -189,11 +183,8 @@ pub struct MerchantAccount {
pub publishable_key: String,
pub storage_scheme: MerchantStorageScheme,
pub metadata: Option<pii::SecretSerdeValue>,
- pub routing_algorithm: Option<serde_json::Value>,
- pub frm_routing_algorithm: Option<serde_json::Value>,
pub created_at: time::PrimitiveDateTime,
pub modified_at: time::PrimitiveDateTime,
- pub payout_routing_algorithm: Option<serde_json::Value>,
pub organization_id: common_utils::id_type::OrganizationId,
pub recon_status: diesel_models::enums::ReconStatus,
}
@@ -263,9 +254,6 @@ pub enum MerchantAccountUpdate {
merchant_details: OptionalEncryptableValue,
publishable_key: Option<String>,
metadata: Option<pii::SecretSerdeValue>,
- routing_algorithm: Option<serde_json::Value>,
- frm_routing_algorithm: Option<serde_json::Value>,
- payout_routing_algorithm: Option<serde_json::Value>,
},
StorageSchemeUpdate {
storage_scheme: MerchantStorageScheme,
@@ -455,20 +443,14 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
MerchantAccountUpdate::Update {
merchant_name,
merchant_details,
- routing_algorithm,
publishable_key,
metadata,
- frm_routing_algorithm,
- payout_routing_algorithm,
} => Self {
merchant_name: merchant_name.map(Encryption::from),
merchant_details: merchant_details.map(Encryption::from),
- frm_routing_algorithm,
- routing_algorithm,
publishable_key,
metadata,
modified_at: now,
- payout_routing_algorithm,
storage_scheme: None,
organization_id: None,
recon_status: None,
@@ -480,9 +462,6 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
merchant_details: None,
publishable_key: None,
metadata: None,
- routing_algorithm: None,
- frm_routing_algorithm: None,
- payout_routing_algorithm: None,
organization_id: None,
recon_status: None,
},
@@ -494,9 +473,6 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
publishable_key: None,
storage_scheme: None,
metadata: None,
- routing_algorithm: None,
- frm_routing_algorithm: None,
- payout_routing_algorithm: None,
organization_id: None,
},
MerchantAccountUpdate::ModifiedAtUpdate => Self {
@@ -506,9 +482,6 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
publishable_key: None,
storage_scheme: None,
metadata: None,
- routing_algorithm: None,
- frm_routing_algorithm: None,
- payout_routing_algorithm: None,
organization_id: None,
recon_status: None,
},
@@ -531,13 +504,11 @@ impl super::behaviour::Conversion for MerchantAccount {
publishable_key: Some(self.publishable_key),
storage_scheme: self.storage_scheme,
metadata: self.metadata,
- routing_algorithm: self.routing_algorithm,
created_at: self.created_at,
modified_at: self.modified_at,
- frm_routing_algorithm: self.frm_routing_algorithm,
- payout_routing_algorithm: self.payout_routing_algorithm,
organization_id: self.organization_id,
recon_status: self.recon_status,
+ version: crate::consts::API_VERSION,
};
Ok(diesel_models::MerchantAccount::from(setter))
@@ -593,11 +564,8 @@ impl super::behaviour::Conversion for MerchantAccount {
publishable_key,
storage_scheme: item.storage_scheme,
metadata: item.metadata,
- routing_algorithm: item.routing_algorithm,
- frm_routing_algorithm: item.frm_routing_algorithm,
created_at: item.created_at,
modified_at: item.modified_at,
- payout_routing_algorithm: item.payout_routing_algorithm,
organization_id: item.organization_id,
recon_status: item.recon_status,
})
@@ -616,13 +584,11 @@ impl super::behaviour::Conversion for MerchantAccount {
merchant_details: self.merchant_details.map(Encryption::from),
publishable_key: Some(self.publishable_key),
metadata: self.metadata,
- routing_algorithm: self.routing_algorithm,
created_at: now,
modified_at: now,
- frm_routing_algorithm: self.frm_routing_algorithm,
- payout_routing_algorithm: self.payout_routing_algorithm,
organization_id: self.organization_id,
recon_status: self.recon_status,
+ version: crate::consts::API_VERSION,
})
}
}
@@ -664,6 +630,7 @@ impl super::behaviour::Conversion for MerchantAccount {
recon_status: self.recon_status,
payment_link_config: self.payment_link_config,
pm_collect_link_config: self.pm_collect_link_config,
+ version: self.version,
};
Ok(diesel_models::MerchantAccount::from(setter))
@@ -740,6 +707,7 @@ impl super::behaviour::Conversion for MerchantAccount {
recon_status: item.recon_status,
payment_link_config: item.payment_link_config,
pm_collect_link_config: item.pm_collect_link_config,
+ version: item.version,
})
}
.await
@@ -777,6 +745,7 @@ impl super::behaviour::Conversion for MerchantAccount {
recon_status: self.recon_status,
payment_link_config: self.payment_link_config,
pm_collect_link_config: self.pm_collect_link_config,
+ version: crate::consts::API_VERSION,
})
}
}
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs
index 383de01cd45..bdf8db2828e 100644
--- a/crates/router/src/consts.rs
+++ b/crates/router/src/consts.rs
@@ -130,9 +130,3 @@ pub const CONNECTOR_CREDS_TOKEN_TTL: i64 = 900;
//max_amount allowed is 999999999 in minor units
pub const MAX_ALLOWED_AMOUNT: i64 = 999999999;
-
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
-pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
-
-#[cfg(all(feature = "v2", feature = "customer_v2"))]
-pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 821057764e7..5c800a0dc24 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -400,6 +400,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
recon_status: diesel_models::enums::ReconStatus::NotRequested,
payment_link_config: None,
pm_collect_link_config,
+ version: hyperswitch_domain_models::consts::API_VERSION,
},
)
}
@@ -680,17 +681,11 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
.and_then(|val| val.try_into_optionaloperation())
})
.await?,
- routing_algorithm: Some(serde_json::json!({
- "algorithm_id": null,
- "timestamp": 0
- })),
publishable_key,
metadata,
storage_scheme: MerchantStorageScheme::PostgresOnly,
created_at: date_time::now(),
modified_at: date_time::now(),
- frm_routing_algorithm: None,
- payout_routing_algorithm: None,
organization_id: organization.get_organization_id(),
recon_status: diesel_models::enums::ReconStatus::NotRequested,
}),
@@ -955,7 +950,7 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
key_manager_state,
type_name!(storage::MerchantAccount),
domain_types::CryptoOperation::EncryptOptional(inner),
- km_types::Identifier::Merchant(key_store.merchant_id.clone()),
+ identifier.clone(),
key,
)
.await
@@ -1049,9 +1044,6 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
.attach_printable("Unable to encrypt merchant details")?,
metadata,
publishable_key: None,
- frm_routing_algorithm: None,
- payout_routing_algorithm: None,
- routing_algorithm: None,
})
}
}
diff --git a/crates/router/src/core/conditional_config.rs b/crates/router/src/core/conditional_config.rs
index e845d54ee7a..4c96ebc7d22 100644
--- a/crates/router/src/core/conditional_config.rs
+++ b/crates/router/src/core/conditional_config.rs
@@ -1,28 +1,42 @@
-use api_models::{
- conditional_configs::{DecisionManager, DecisionManagerRecord, DecisionManagerResponse},
- routing,
+use api_models::conditional_configs::{
+ DecisionManager, DecisionManagerRecord, DecisionManagerResponse,
};
-use common_utils::ext_traits::{Encode, StringExt, ValueExt};
-use diesel_models::configs;
+use common_utils::ext_traits::StringExt;
use error_stack::ResultExt;
-use euclid::frontend::ast;
-use storage_impl::redis::cache;
-use super::routing::helpers::update_merchant_active_algorithm_ref;
use crate::{
core::errors::{self, RouterResponse},
routes::SessionState,
services::api as service_api,
types::domain,
- utils::OptionExt,
};
+#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+pub async fn upsert_conditional_config(
+ _state: SessionState,
+ _key_store: domain::MerchantKeyStore,
+ _merchant_account: domain::MerchantAccount,
+ _request: DecisionManager,
+) -> RouterResponse<DecisionManagerRecord> {
+ todo!()
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+))]
pub async fn upsert_conditional_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
merchant_account: domain::MerchantAccount,
request: DecisionManager,
) -> RouterResponse<DecisionManagerRecord> {
+ use common_utils::ext_traits::{Encode, OptionExt, ValueExt};
+ use diesel_models::configs;
+ use storage_impl::redis::cache;
+
+ use super::routing::helpers::update_merchant_active_algorithm_ref;
+
let db = state.store.as_ref();
let (name, prog) = match request {
DecisionManager::DecisionManagerv0(ccr) => {
@@ -51,7 +65,7 @@ pub async fn upsert_conditional_config(
}
};
let timestamp = common_utils::date_time::now_unix_timestamp();
- let mut algo_id: routing::RoutingAlgorithmRef = merchant_account
+ let mut algo_id: api_models::routing::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
.map(|val| val.parse_value("routing algorithm"))
@@ -63,7 +77,7 @@ pub async fn upsert_conditional_config(
let key = merchant_account.get_id().get_payment_config_routing_id();
let read_config_key = db.find_config_by_key(&key).await;
- ast::lowering::lower_program(prog.clone())
+ euclid::frontend::ast::lowering::lower_program(prog.clone())
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid Request Data".to_string(),
})
@@ -149,14 +163,32 @@ pub async fn upsert_conditional_config(
}
}
+#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+pub async fn delete_conditional_config(
+ _state: SessionState,
+ _key_store: domain::MerchantKeyStore,
+ _merchant_account: domain::MerchantAccount,
+) -> RouterResponse<()> {
+ todo!()
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+))]
pub async fn delete_conditional_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
merchant_account: domain::MerchantAccount,
) -> RouterResponse<()> {
+ use common_utils::ext_traits::ValueExt;
+ use storage_impl::redis::cache;
+
+ use super::routing::helpers::update_merchant_active_algorithm_ref;
+
let db = state.store.as_ref();
let key = merchant_account.get_id().get_payment_config_routing_id();
- let mut algo_id: routing::RoutingAlgorithmRef = merchant_account
+ let mut algo_id: api_models::routing::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
.map(|value| value.parse_value("routing algorithm"))
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 69bf4052d70..e3169e611fd 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -15,7 +15,6 @@ use router_env::{instrument, tracing};
#[cfg(all(feature = "v2", feature = "customer_v2"))]
use crate::core::payment_methods::cards::create_encrypted_data;
use crate::{
- consts::API_VERSION,
core::errors::{self, StorageErrorExt},
db::StorageInterface,
pii::PeekInterface,
@@ -181,7 +180,7 @@ impl CustomerCreateBridge for customers::CustomerRequest {
modified_at: common_utils::date_time::now(),
default_payment_method_id: None,
updated_by: None,
- version: API_VERSION,
+ version: hyperswitch_domain_models::consts::API_VERSION,
})
}
@@ -268,7 +267,7 @@ impl CustomerCreateBridge for customers::CustomerRequest {
default_billing_address: encrypted_customer_billing_address.map(Into::into),
default_shipping_address: encrypted_customer_shipping_address.map(Into::into),
// status: Some(customer_domain::SoftDeleteStatus::Active)
- version: API_VERSION,
+ version: hyperswitch_domain_models::consts::API_VERSION,
})
}
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index 64fadd0e33d..114dff566c4 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -1,10 +1,9 @@
use std::fmt::Debug;
-use api_models::{admin::FrmConfigs, enums as api_enums};
+use api_models::{self, enums as api_enums};
use common_enums::CaptureMethod;
-use common_utils::ext_traits::OptionExt;
use error_stack::ResultExt;
-use masking::{ExposeInterface, PeekInterface};
+use masking::PeekInterface;
use router_env::{
logger,
tracing::{self, instrument},
@@ -120,7 +119,25 @@ where
Ok(router_data_res)
}
-pub async fn should_call_frm<F>(
+#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+pub async fn should_call_frm<F: Send + Clone>(
+ _merchant_account: &domain::MerchantAccount,
+ _payment_data: &payments::PaymentData<F>,
+ _state: &SessionState,
+ _key_store: domain::MerchantKeyStore,
+) -> RouterResult<(
+ bool,
+ Option<FrmRoutingAlgorithm>,
+ Option<String>,
+ Option<FrmConfigsObject>,
+)> {
+ // Frm routing algorithm is not present in the merchant account
+ // it has to be fetched from the business profile
+ todo!()
+}
+
+#[cfg(all(feature = "v1", not(feature = "merchant_account_v2")))]
+pub async fn should_call_frm<F: Send + Clone>(
merchant_account: &domain::MerchantAccount,
payment_data: &payments::PaymentData<F>,
state: &SessionState,
@@ -130,13 +147,13 @@ pub async fn should_call_frm<F>(
Option<FrmRoutingAlgorithm>,
Option<String>,
Option<FrmConfigsObject>,
-)>
-where
- F: Send + Clone,
-{
+)> {
+ use common_utils::ext_traits::OptionExt;
+ use masking::ExposeInterface;
+
+ let db = &*state.store;
match merchant_account.frm_routing_algorithm.clone() {
Some(frm_routing_algorithm_value) => {
- let db = &*state.store;
let frm_routing_algorithm_struct: FrmRoutingAlgorithm = frm_routing_algorithm_value
.clone()
.parse_value("FrmRoutingAlgorithm")
@@ -191,7 +208,7 @@ where
.ok();
match frm_configs_option {
Some(frm_configs_value) => {
- let frm_configs_struct: Vec<FrmConfigs> = frm_configs_value
+ let frm_configs_struct: Vec<api_models::admin::FrmConfigs> = frm_configs_value
.into_iter()
.map(|config| { config
.expose()
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index e5c8ef57b29..145f8d63f83 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -3292,6 +3292,10 @@ pub async fn call_surcharge_decision_management(
billing_address: Option<domain::Address>,
response_payment_method_types: &mut [ResponsePaymentMethodsEnabled],
) -> errors::RouterResult<api_surcharge_decision_configs::MerchantSurchargeConfigs> {
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+ ))]
let algorithm_ref: routing_types::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
@@ -3300,6 +3304,17 @@ pub async fn call_surcharge_decision_management(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
+
+ #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ let algorithm_ref: routing_types::RoutingAlgorithmRef = business_profile
+ .routing_algorithm
+ .clone()
+ .map(|val| val.parse_value("routing algorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Could not decode the routing algorithm")?
+ .unwrap_or_default();
+
let (surcharge_results, merchant_sucharge_configs) =
perform_surcharge_decision_management_for_payment_method_list(
&state,
@@ -3344,6 +3359,10 @@ pub async fn call_surcharge_decision_management_for_saved_card(
payment_intent: storage::PaymentIntent,
customer_payment_method_response: &mut api::CustomerPaymentMethodsListResponse,
) -> errors::RouterResult<()> {
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+ ))]
let algorithm_ref: routing_types::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
@@ -3352,6 +3371,17 @@ pub async fn call_surcharge_decision_management_for_saved_card(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
+
+ #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ let algorithm_ref: routing_types::RoutingAlgorithmRef = business_profile
+ .routing_algorithm
+ .clone()
+ .map(|val| val.parse_value("routing algorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Could not decode the routing algorithm")?
+ .unwrap_or_default();
+
let surcharge_results = perform_surcharge_decision_management_for_saved_cards(
state,
algorithm_ref,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 00cc4839b42..6b8c19925ee 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -181,7 +181,13 @@ where
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
.attach_printable("Failed while fetching/creating customer")?;
- call_decision_manager(state, &merchant_account, &mut payment_data).await?;
+ call_decision_manager(
+ state,
+ &merchant_account,
+ &business_profile,
+ &mut payment_data,
+ )
+ .await?;
let connector = get_connector_choice(
&operation,
@@ -491,6 +497,7 @@ where
call_surcharge_decision_management_for_session_flow(
state,
&merchant_account,
+ &business_profile,
&mut payment_data,
&connectors,
)
@@ -621,11 +628,16 @@ where
pub async fn call_decision_manager<O>(
state: &SessionState,
merchant_account: &domain::MerchantAccount,
+ _business_profile: &domain::BusinessProfile,
payment_data: &mut PaymentData<O>,
) -> RouterResult<()>
where
O: Send + Clone,
{
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+ ))]
let algorithm_ref: api::routing::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
@@ -635,6 +647,16 @@ where
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
+ #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ let algorithm_ref: api::routing::RoutingAlgorithmRef = _business_profile
+ .routing_algorithm
+ .clone()
+ .map(|val| val.parse_value("routing algorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Could not decode the routing algorithm")?
+ .unwrap_or_default();
+
let output = perform_decision_management(
state,
algorithm_ref,
@@ -737,7 +759,8 @@ pub fn get_connector_data(
#[instrument(skip_all)]
pub async fn call_surcharge_decision_management_for_session_flow<O>(
state: &SessionState,
- merchant_account: &domain::MerchantAccount,
+ _merchant_account: &domain::MerchantAccount,
+ _business_profile: &domain::BusinessProfile,
payment_data: &mut PaymentData<O>,
session_connector_data: &[api::SessionConnectorData],
) -> RouterResult<Option<api::SessionSurchargeDetails>>
@@ -763,7 +786,12 @@ where
.iter()
.map(|session_connector_data| session_connector_data.payment_method_type)
.collect();
- let algorithm_ref: api::routing::RoutingAlgorithmRef = merchant_account
+
+ #[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+ ))]
+ let algorithm_ref: api::routing::RoutingAlgorithmRef = _merchant_account
.routing_algorithm
.clone()
.map(|val| val.parse_value("routing algorithm"))
@@ -771,6 +799,17 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
+
+ #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ let algorithm_ref: api::routing::RoutingAlgorithmRef = _business_profile
+ .routing_algorithm
+ .clone()
+ .map(|val| val.parse_value("routing algorithm"))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Could not decode the routing algorithm")?
+ .unwrap_or_default();
+
let surcharge_results =
surcharge_decision_configs::perform_surcharge_decision_management_for_session_flow(
state,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 1fe84121d5b..07ffcf443b7 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1729,7 +1729,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: common_enums::ApiVersion::V1,
+ version: hyperswitch_domain_models::consts::API_VERSION,
};
metrics::CUSTOMER_CREATED.add(&metrics::CONTEXT, 1, &[]);
db.insert_customer(new_customer, key_manager_state, key_store, storage_scheme)
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 4714992799a..83afcefbb7a 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -691,7 +691,7 @@ pub(super) async fn get_or_create_customer_details(
address_id: None,
default_payment_method_id: None,
updated_by: None,
- version: consts::API_VERSION,
+ version: hyperswitch_domain_models::consts::API_VERSION,
};
Ok(Some(
diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs
index c73c3907d51..d9ab7d12bdb 100644
--- a/crates/router/src/core/payouts/validator.rs
+++ b/crates/router/src/core/payouts/validator.rs
@@ -79,7 +79,6 @@ pub async fn validate_create_request(
// Payout ID
let db: &dyn StorageInterface = &*state.store;
- let key_manager_state = &state.into();
let payout_id = core_utils::get_or_generate_uuid("payout_id", req.payout_id.as_ref())?;
match validate_uniqueness_of_payout_id_against_merchant_id(
db,
@@ -147,7 +146,7 @@ pub async fn validate_create_request(
not(feature = "merchant_account_v2")
))]
let profile_id = core_utils::get_profile_id_from_business_details(
- key_manager_state,
+ &state.into(),
merchant_key_store,
req.business_country,
req.business_label.as_ref(),
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 8cfb710a8c1..e388be764d2 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -181,8 +181,7 @@ pub async fn update_merchant_active_algorithm_ref(
_config_key: cache::CacheKind<'_>,
_algorithm_id: routing_types::RoutingAlgorithmRef,
) -> RouterResult<()> {
- // TODO: handle updating the active routing algorithm for v2 in merchant account
- Ok(())
+ todo!()
}
pub async fn update_business_profile_active_algorithm_ref(
diff --git a/crates/router/src/core/surcharge_decision_config.rs b/crates/router/src/core/surcharge_decision_config.rs
index 03e4f337372..461764ca428 100644
--- a/crates/router/src/core/surcharge_decision_config.rs
+++ b/crates/router/src/core/surcharge_decision_config.rs
@@ -1,31 +1,32 @@
-use api_models::{
- routing,
- surcharge_decision_configs::{
- SurchargeDecisionConfigReq, SurchargeDecisionManagerRecord,
- SurchargeDecisionManagerResponse,
- },
+use api_models::surcharge_decision_configs::{
+ SurchargeDecisionConfigReq, SurchargeDecisionManagerRecord, SurchargeDecisionManagerResponse,
};
-use common_utils::ext_traits::{Encode, StringExt, ValueExt};
-use diesel_models::configs;
+use common_utils::ext_traits::StringExt;
use error_stack::ResultExt;
-use euclid::frontend::ast;
-use storage_impl::redis::cache;
-use super::routing::helpers::update_merchant_active_algorithm_ref;
use crate::{
core::errors::{self, RouterResponse},
routes::SessionState,
services::api as service_api,
types::domain,
- utils::OptionExt,
};
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+))]
pub async fn upsert_surcharge_decision_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
merchant_account: domain::MerchantAccount,
request: SurchargeDecisionConfigReq,
) -> RouterResponse<SurchargeDecisionManagerRecord> {
+ use common_utils::ext_traits::{Encode, OptionExt, ValueExt};
+ use diesel_models::configs;
+ use storage_impl::redis::cache;
+
+ use super::routing::helpers::update_merchant_active_algorithm_ref;
+
let db = state.store.as_ref();
let name = request.name;
@@ -39,7 +40,7 @@ pub async fn upsert_surcharge_decision_config(
let merchant_surcharge_configs = request.merchant_surcharge_configs;
let timestamp = common_utils::date_time::now_unix_timestamp();
- let mut algo_id: routing::RoutingAlgorithmRef = merchant_account
+ let mut algo_id: api_models::routing::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
.map(|val| val.parse_value("routing algorithm"))
@@ -53,7 +54,7 @@ pub async fn upsert_surcharge_decision_config(
.get_payment_method_surcharge_routing_id();
let read_config_key = db.find_config_by_key(&key).await;
- ast::lowering::lower_program(program.clone())
+ euclid::frontend::ast::lowering::lower_program(program.clone())
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid Request Data".to_string(),
})
@@ -141,16 +142,35 @@ pub async fn upsert_surcharge_decision_config(
}
}
+#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+pub async fn upsert_surcharge_decision_config(
+ _state: SessionState,
+ _key_store: domain::MerchantKeyStore,
+ _merchant_account: domain::MerchantAccount,
+ _request: SurchargeDecisionConfigReq,
+) -> RouterResponse<SurchargeDecisionManagerRecord> {
+ todo!();
+}
+
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+))]
pub async fn delete_surcharge_decision_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
merchant_account: domain::MerchantAccount,
) -> RouterResponse<()> {
+ use common_utils::ext_traits::ValueExt;
+ use storage_impl::redis::cache;
+
+ use super::routing::helpers::update_merchant_active_algorithm_ref;
+
let db = state.store.as_ref();
let key = merchant_account
.get_id()
.get_payment_method_surcharge_routing_id();
- let mut algo_id: routing::RoutingAlgorithmRef = merchant_account
+ let mut algo_id: api_models::routing::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
.map(|value| value.parse_value("routing algorithm"))
@@ -172,6 +192,15 @@ pub async fn delete_surcharge_decision_config(
Ok(service_api::ApplicationResponse::StatusOk)
}
+#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+pub async fn delete_surcharge_decision_config(
+ _state: SessionState,
+ _key_store: domain::MerchantKeyStore,
+ _merchant_account: domain::MerchantAccount,
+) -> RouterResponse<()> {
+ todo!()
+}
+
pub async fn retrieve_surcharge_decision_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs
index 011da36be33..2d2897aa223 100644
--- a/crates/router/src/types/domain.rs
+++ b/crates/router/src/types/domain.rs
@@ -12,8 +12,14 @@ mod business_profile {
};
}
+mod customers {
+ pub use hyperswitch_domain_models::customer::*;
+}
+
+pub use customers::*;
+pub use merchant_account::*;
+
mod address;
-mod customer;
mod event;
mod merchant_connector_account;
mod merchant_key_store {
@@ -27,9 +33,7 @@ pub mod user_key_store;
pub use address::*;
pub use business_profile::*;
-pub use customer::*;
pub use event::*;
-pub use merchant_account::*;
pub use merchant_connector_account::*;
pub use merchant_key_store::*;
pub use payments::*;
diff --git a/crates/router/src/types/domain/customer.rs b/crates/router/src/types/domain/customer.rs
deleted file mode 100644
index 6f42cae0b45..00000000000
--- a/crates/router/src/types/domain/customer.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub use hyperswitch_domain_models::customer::*;
diff --git a/crates/router/src/types/domain/merchant_account.rs b/crates/router/src/types/domain/merchant_account.rs
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/migrations/2024-08-08-075600_add_api_version_to_merchant_account/down.sql b/migrations/2024-08-08-075600_add_api_version_to_merchant_account/down.sql
new file mode 100644
index 00000000000..c123c73d904
--- /dev/null
+++ b/migrations/2024-08-08-075600_add_api_version_to_merchant_account/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE merchant_account DROP COLUMN version;
diff --git a/migrations/2024-08-08-075600_add_api_version_to_merchant_account/up.sql b/migrations/2024-08-08-075600_add_api_version_to_merchant_account/up.sql
new file mode 100644
index 00000000000..68dd1d1d800
--- /dev/null
+++ b/migrations/2024-08-08-075600_add_api_version_to_merchant_account/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE merchant_account
+ADD COLUMN IF NOT EXISTS version "ApiVersion" NOT NULL DEFAULT 'v1';
diff --git a/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/down.sql b/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/down.sql
index 60e6c17b08b..8880dda3a5f 100644
--- a/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/down.sql
+++ b/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/down.sql
@@ -44,3 +44,12 @@ ADD COLUMN is_recon_enabled BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE merchant_account
ADD COLUMN webhook_details JSONB NULL;
+
+ALTER TABLE merchant_account
+ADD COLUMN routing_algorithm JSON;
+
+ALTER TABLE merchant_account
+ADD COLUMN frm_routing_algorithm JSONB;
+
+ALTER TABLE merchant_account
+ADD COLUMN payout_routing_algorithm JSONB;
diff --git a/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/up.sql b/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/up.sql
index e9a349e6130..0129f1b1cf8 100644
--- a/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/up.sql
+++ b/v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/up.sql
@@ -26,3 +26,9 @@ ALTER TABLE merchant_account DROP pm_collect_link_config;
ALTER TABLE merchant_account DROP is_recon_enabled;
ALTER TABLE merchant_account DROP webhook_details;
+
+ALTER TABLE merchant_account DROP routing_algorithm;
+
+ALTER TABLE merchant_account DROP frm_routing_algorithm;
+
+ALTER TABLE merchant_account DROP payout_routing_algorithm;
|
refactor
|
remove routing algorithms from merchant account and add version column (#5527)
|
6765a1c695493499d1907c56d05bdcd80a2fea93
|
2023-10-19 17:18:06
|
Kartikeya Hegde
|
fix: payment_method_data and description null during payment confirm (#2618)
| false
|
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 930a9cf959a..cf681543928 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -289,23 +289,47 @@ impl PaymentAttemptUpdate {
amount: pa_update.amount.unwrap_or(source.amount),
currency: pa_update.currency.or(source.currency),
status: pa_update.status.unwrap_or(source.status),
- connector: pa_update.connector.or(source.connector),
- connector_transaction_id: source
+ connector_transaction_id: pa_update
.connector_transaction_id
- .or(pa_update.connector_transaction_id),
+ .or(source.connector_transaction_id),
+ amount_to_capture: pa_update.amount_to_capture.or(source.amount_to_capture),
+ connector: pa_update.connector.or(source.connector),
authentication_type: pa_update.authentication_type.or(source.authentication_type),
payment_method: pa_update.payment_method.or(source.payment_method),
error_message: pa_update.error_message.unwrap_or(source.error_message),
payment_method_id: pa_update
.payment_method_id
.unwrap_or(source.payment_method_id),
- browser_info: pa_update.browser_info.or(source.browser_info),
+ cancellation_reason: pa_update.cancellation_reason.or(source.cancellation_reason),
modified_at: common_utils::date_time::now(),
+ mandate_id: pa_update.mandate_id.or(source.mandate_id),
+ browser_info: pa_update.browser_info.or(source.browser_info),
payment_token: pa_update.payment_token.or(source.payment_token),
+ error_code: pa_update.error_code.unwrap_or(source.error_code),
connector_metadata: pa_update.connector_metadata.or(source.connector_metadata),
+ payment_method_data: pa_update.payment_method_data.or(source.payment_method_data),
+ payment_method_type: pa_update.payment_method_type.or(source.payment_method_type),
+ payment_experience: pa_update.payment_experience.or(source.payment_experience),
+ business_sub_label: pa_update.business_sub_label.or(source.business_sub_label),
+ straight_through_algorithm: pa_update
+ .straight_through_algorithm
+ .or(source.straight_through_algorithm),
preprocessing_step_id: pa_update
.preprocessing_step_id
.or(source.preprocessing_step_id),
+ error_reason: pa_update.error_reason.unwrap_or(source.error_reason),
+ capture_method: pa_update.capture_method.or(source.capture_method),
+ connector_response_reference_id: pa_update
+ .connector_response_reference_id
+ .or(source.connector_response_reference_id),
+ multiple_capture_count: pa_update
+ .multiple_capture_count
+ .or(source.multiple_capture_count),
+ surcharge_amount: pa_update.surcharge_amount.or(source.surcharge_amount),
+ tax_amount: pa_update.tax_amount.or(source.tax_amount),
+ amount_capturable: pa_update
+ .amount_capturable
+ .unwrap_or(source.amount_capturable),
surcharge_metadata: pa_update.surcharge_metadata.or(source.surcharge_metadata),
updated_by: pa_update.updated_by,
..source
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index c6b95b5cef6..f449cadbba5 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -227,7 +227,30 @@ impl PaymentIntentUpdate {
.shipping_address_id
.or(source.shipping_address_id),
modified_at: common_utils::date_time::now(),
+ active_attempt_id: internal_update
+ .active_attempt_id
+ .unwrap_or(source.active_attempt_id),
+ business_country: internal_update.business_country.or(source.business_country),
+ business_label: internal_update.business_label.or(source.business_label),
+ description: internal_update.description.or(source.description),
+ statement_descriptor_name: internal_update
+ .statement_descriptor_name
+ .or(source.statement_descriptor_name),
+ statement_descriptor_suffix: internal_update
+ .statement_descriptor_suffix
+ .or(source.statement_descriptor_suffix),
order_details: internal_update.order_details.or(source.order_details),
+ attempt_count: internal_update
+ .attempt_count
+ .unwrap_or(source.attempt_count),
+ profile_id: internal_update.profile_id.or(source.profile_id),
+ merchant_decision: internal_update
+ .merchant_decision
+ .or(source.merchant_decision),
+ payment_confirm_source: internal_update
+ .payment_confirm_source
+ .or(source.payment_confirm_source),
+ updated_by: internal_update.updated_by,
..source
}
}
|
fix
|
payment_method_data and description null during payment confirm (#2618)
|
fb1760b1d8b5ca55dbaa93ab18f9fba9e7930e17
|
2023-09-14 17:20:37
|
Prajjwal Kumar
|
refactor(router): get route for applepay_verified_domains (#2157)
| false
|
diff --git a/crates/api_models/src/verifications.rs b/crates/api_models/src/verifications.rs
index 22e9a0194e7..e8aff66015d 100644
--- a/crates/api_models/src/verifications.rs
+++ b/crates/api_models/src/verifications.rs
@@ -1,6 +1,6 @@
/// The request body for verification of merchant (everything except domain_names are prefilled)
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-#[serde(rename_all = "camelCase")]
+#[serde(rename_all = "snake_case")]
pub struct ApplepayMerchantVerificationConfigs {
pub domain_names: Vec<String>,
pub encrypt_to: String,
@@ -10,7 +10,7 @@ pub struct ApplepayMerchantVerificationConfigs {
/// The derivation point for domain names from request body
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-#[serde(rename_all = "camelCase")]
+#[serde(rename_all = "snake_case")]
pub struct ApplepayMerchantVerificationRequest {
pub domain_names: Vec<String>,
pub merchant_connector_account_id: String,
@@ -18,22 +18,21 @@ pub struct ApplepayMerchantVerificationRequest {
/// Response to be sent for the verify/applepay api
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-#[serde(rename_all = "camelCase")]
+#[serde(rename_all = "snake_case")]
pub struct ApplepayMerchantResponse {
pub status_message: String,
- pub status_code: u16,
}
/// QueryParams to be send by the merchant for fetching the verified domains
#[derive(Debug, serde::Deserialize)]
-#[serde(rename_all = "camelCase")]
+#[serde(rename_all = "snake_case")]
pub struct ApplepayGetVerifiedDomainsParam {
- pub business_profile_id: String,
+ pub merchant_id: String,
+ pub merchant_connector_account_id: String,
}
/// Response to be sent for derivation of the already verified domains
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
-#[serde(rename_all = "camelCase")]
+#[serde(rename_all = "snake_case")]
pub struct ApplepayVerifiedDomainsResponse {
- pub status_code: u16,
pub verified_domains: Vec<String>,
}
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index c01bdf6fb75..545553cae49 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -15,4 +15,6 @@ pub mod payments;
pub mod payouts;
pub mod refunds;
pub mod utils;
+#[cfg(all(feature = "olap", feature = "kms"))]
+pub mod verification;
pub mod webhooks;
diff --git a/crates/router/src/utils/verification.rs b/crates/router/src/core/verification.rs
similarity index 59%
rename from crates/router/src/utils/verification.rs
rename to crates/router/src/core/verification.rs
index b0613540c55..cc2162908a8 100644
--- a/crates/router/src/utils/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -1,17 +1,17 @@
+pub mod utils;
use actix_web::web;
use api_models::verifications::{self, ApplepayMerchantResponse};
-use common_utils::errors::CustomResult;
-use error_stack::{Report, ResultExt};
+use common_utils::{errors::CustomResult, ext_traits::Encode};
+use error_stack::ResultExt;
#[cfg(feature = "kms")]
use external_services::kms;
use crate::{
core::errors::{self, api_error_response, utils::StorageErrorExt},
+ db::StorageInterface,
headers, logger,
routes::AppState,
services, types,
- types::storage,
- utils,
};
const APPLEPAY_INTERNAL_MERCHANT_NAME: &str = "Applepay_merchant";
@@ -33,6 +33,7 @@ pub async fn verify_merchant_creds_for_applepay(
let encrypted_cert = &state.conf.applepay_merchant_configs.merchant_cert;
let encrypted_key = &state.conf.applepay_merchant_configs.merchant_cert_key;
let applepay_endpoint = &state.conf.applepay_merchant_configs.applepay_endpoint;
+
let applepay_internal_merchant_identifier = kms::get_kms_client(kms_config)
.await
.decrypt(encrypted_merchant_identifier)
@@ -60,10 +61,10 @@ pub async fn verify_merchant_creds_for_applepay(
let applepay_req = types::RequestBody::log_and_get_request_body(
&request_body,
- utils::Encode::<verifications::ApplepayMerchantVerificationRequest>::encode_to_string_of_json,
- )
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to encode ApplePay session request to a string of json")?;
+ Encode::<verifications::ApplepayMerchantVerificationRequest>::encode_to_string_of_json,
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to encode ApplePay session request to a string of json")?;
let apple_pay_merch_verification_req = services::RequestBuilder::new()
.method(services::Method::Post)
@@ -79,7 +80,7 @@ pub async fn verify_merchant_creds_for_applepay(
.build();
let response = services::call_connector_api(state, apple_pay_merch_verification_req).await;
- log_applepay_verification_response_if_error(&response);
+ utils::log_applepay_verification_response_if_error(&response);
let applepay_response =
response.change_context(api_error_response::ApiErrorResponse::InternalServerError)?;
@@ -87,7 +88,7 @@ pub async fn verify_merchant_creds_for_applepay(
// Error is already logged
Ok(match applepay_response {
Ok(_) => {
- check_existence_and_add_domain_to_db(
+ utils::check_existence_and_add_domain_to_db(
state,
merchant_id,
body.merchant_connector_account_id.clone(),
@@ -96,93 +97,43 @@ pub async fn verify_merchant_creds_for_applepay(
.await
.change_context(api_error_response::ApiErrorResponse::InternalServerError)?;
services::api::ApplicationResponse::Json(ApplepayMerchantResponse {
- status_code: 200,
status_message: "Applepay verification Completed".to_string(),
})
}
Err(error) => {
logger::error!(?error);
services::api::ApplicationResponse::Json(ApplepayMerchantResponse {
- status_code: 200,
status_message: "Applepay verification Failed".to_string(),
})
}
})
}
-async fn check_existence_and_add_domain_to_db(
- state: &AppState,
+
+pub async fn get_verified_apple_domains_with_mid_mca_id(
+ db: &dyn StorageInterface,
merchant_id: String,
merchant_connector_id: String,
- domain_from_req: Vec<String>,
-) -> CustomResult<Vec<String>, errors::ApiErrorResponse> {
- let key_store = state
- .store
- .get_merchant_key_store_by_merchant_id(
- &merchant_id,
- &state.store.get_master_key().to_vec().into(),
- )
+) -> CustomResult<
+ services::ApplicationResponse<api_models::verifications::ApplepayVerifiedDomainsResponse>,
+ api_error_response::ApiErrorResponse,
+> {
+ let key_store = db
+ .get_merchant_key_store_by_merchant_id(&merchant_id, &db.get_master_key().to_vec().into())
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
- let merchant_connector_account = state
- .store
+ let verified_domains = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
- &merchant_id,
- &merchant_connector_id,
+ merchant_id.as_str(),
+ merchant_connector_id.as_str(),
&key_store,
)
.await
- .change_context(errors::ApiErrorResponse::InternalServerError)?;
-
- let mut already_verified_domains = merchant_connector_account
+ .change_context(api_error_response::ApiErrorResponse::ResourceIdNotFound)?
.applepay_verified_domains
- .clone()
.unwrap_or_default();
- let mut new_verified_domains: Vec<String> = domain_from_req
- .into_iter()
- .filter(|req_domain| !already_verified_domains.contains(req_domain))
- .collect();
-
- already_verified_domains.append(&mut new_verified_domains);
- let updated_mca = storage::MerchantConnectorAccountUpdate::Update {
- merchant_id: None,
- connector_type: None,
- connector_name: None,
- connector_account_details: None,
- test_mode: None,
- disabled: None,
- merchant_connector_id: None,
- payment_methods_enabled: None,
- metadata: None,
- frm_configs: None,
- connector_webhook_details: None,
- applepay_verified_domains: Some(already_verified_domains.clone()),
- };
- state
- .store
- .update_merchant_connector_account(
- merchant_connector_account,
- updated_mca.into(),
- &key_store,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable_lazy(|| {
- format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")
- })?;
-
- Ok(already_verified_domains.clone())
-}
-
-fn log_applepay_verification_response_if_error(
- response: &Result<Result<types::Response, types::Response>, Report<errors::ApiClientError>>,
-) {
- if let Err(error) = response.as_ref() {
- logger::error!(?error);
- };
- response
- .as_ref()
- .ok()
- .map(|res| res.as_ref().map_err(|error| logger::error!(?error)));
+ Ok(services::api::ApplicationResponse::Json(
+ api_models::verifications::ApplepayVerifiedDomainsResponse { verified_domains },
+ ))
}
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
new file mode 100644
index 00000000000..36bf4b7d716
--- /dev/null
+++ b/crates/router/src/core/verification/utils.rs
@@ -0,0 +1,88 @@
+use common_utils::errors::CustomResult;
+use error_stack::{Report, ResultExt};
+
+use crate::{
+ core::errors::{self, utils::StorageErrorExt},
+ logger,
+ routes::AppState,
+ types,
+ types::storage,
+};
+
+pub async fn check_existence_and_add_domain_to_db(
+ state: &AppState,
+ merchant_id: String,
+ merchant_connector_id: String,
+ domain_from_req: Vec<String>,
+) -> CustomResult<Vec<String>, errors::ApiErrorResponse> {
+ let key_store = state
+ .store
+ .get_merchant_key_store_by_merchant_id(
+ &merchant_id,
+ &state.store.get_master_key().to_vec().into(),
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
+
+ let merchant_connector_account = state
+ .store
+ .find_by_merchant_connector_account_merchant_id_merchant_connector_id(
+ &merchant_id,
+ &merchant_connector_id,
+ &key_store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)?;
+
+ let mut already_verified_domains = merchant_connector_account
+ .applepay_verified_domains
+ .clone()
+ .unwrap_or_default();
+
+ let mut new_verified_domains: Vec<String> = domain_from_req
+ .into_iter()
+ .filter(|req_domain| !already_verified_domains.contains(req_domain))
+ .collect();
+
+ already_verified_domains.append(&mut new_verified_domains);
+ let updated_mca = storage::MerchantConnectorAccountUpdate::Update {
+ merchant_id: None,
+ connector_type: None,
+ connector_name: None,
+ connector_account_details: None,
+ test_mode: None,
+ disabled: None,
+ merchant_connector_id: None,
+ payment_methods_enabled: None,
+ metadata: None,
+ frm_configs: None,
+ connector_webhook_details: None,
+ applepay_verified_domains: Some(already_verified_domains.clone()),
+ };
+ state
+ .store
+ .update_merchant_connector_account(
+ merchant_connector_account,
+ updated_mca.into(),
+ &key_store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable_lazy(|| {
+ format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")
+ })?;
+
+ Ok(already_verified_domains.clone())
+}
+
+pub fn log_applepay_verification_response_if_error(
+ response: &Result<Result<types::Response, types::Response>, Report<errors::ApiClientError>>,
+) {
+ if let Err(error) = response.as_ref() {
+ logger::error!(applepay_domain_verification_error= ?error);
+ };
+ response.as_ref().ok().map(|res| {
+ res.as_ref()
+ .map_err(|error| logger::error!(applepay_domain_verification_error= ?error))
+ });
+}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 8c529a42d50..d5691279bc3 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -12,7 +12,7 @@ use super::dummy_connector::*;
#[cfg(feature = "payouts")]
use super::payouts::*;
#[cfg(all(feature = "olap", feature = "kms"))]
-use super::verification::apple_pay_merchant_registration;
+use super::verification::{apple_pay_merchant_registration, retrieve_apple_pay_verified_domains};
#[cfg(feature = "olap")]
use super::{admin::*, api_keys::*, disputes::*, files::*};
use super::{cache::*, health::*};
@@ -589,5 +589,9 @@ impl Verify {
web::resource("/{merchant_id}/apple_pay")
.route(web::post().to(apple_pay_merchant_registration)),
)
+ .service(
+ web::resource("/applepay_verified_domains")
+ .route(web::get().to(retrieve_apple_pay_verified_domains)),
+ )
}
}
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index 1cb7ed6256c..e8985bbde5b 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -4,11 +4,10 @@ use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
+ core::verification,
services::{api, authentication as auth},
- utils::verification,
};
-#[cfg(all(feature = "olap", feature = "kms"))]
#[instrument(skip_all, fields(flow = ?Flow::Verification))]
pub async fn apple_pay_merchant_registration(
state: web::Data<AppState>,
@@ -36,3 +35,30 @@ pub async fn apple_pay_merchant_registration(
)
.await
}
+
+#[instrument(skip_all, fields(flow = ?Flow::Verification))]
+pub async fn retrieve_apple_pay_verified_domains(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ params: web::Query<verifications::ApplepayGetVerifiedDomainsParam>,
+) -> impl Responder {
+ let flow = Flow::Verification;
+ let merchant_id = ¶ms.merchant_id;
+ let mca_id = ¶ms.merchant_connector_account_id;
+
+ api::server_wrap(
+ flow,
+ state.get_ref(),
+ &req,
+ merchant_id.clone(),
+ |state, _, _| {
+ verification::get_verified_apple_domains_with_mid_mca_id(
+ &*state.store,
+ merchant_id.to_string(),
+ mca_id.clone(),
+ )
+ },
+ auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
+ )
+ .await
+}
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index b9e4504a992..94571bb1fcd 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -1,8 +1,6 @@
pub mod custom_serde;
pub mod db_utils;
pub mod ext_traits;
-#[cfg(all(feature = "olap", feature = "kms"))]
-pub mod verification;
#[cfg(feature = "kv_store")]
pub mod storage_partitioning;
|
refactor
|
get route for applepay_verified_domains (#2157)
|
d1d1e52b5d34d6905daa2a606f0b97a3934cfb29
|
2023-01-19 14:34:37
|
Sanchith Hegde
|
refactor(configs): make visibility of validation functions public (#421)
| false
|
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index e63ef2268cf..53d0951a122 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -3,7 +3,7 @@ use common_utils::ext_traits::ConfigExt;
use crate::core::errors::ApplicationError;
impl super::settings::Secrets {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
use common_utils::fp_utils::when;
when(self.jwt_secret.is_default_or_empty(), || {
@@ -21,7 +21,7 @@ impl super::settings::Secrets {
}
impl super::settings::Locker {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
use common_utils::fp_utils::when;
when(!self.mock_locker && self.host.is_default_or_empty(), || {
@@ -42,7 +42,7 @@ impl super::settings::Locker {
}
impl super::settings::Jwekey {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
#[cfg(feature = "kms")]
common_utils::fp_utils::when(self.aws_key_id.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
@@ -62,7 +62,7 @@ impl super::settings::Jwekey {
}
impl super::settings::Server {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.host.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"server host must not be empty".into(),
@@ -72,7 +72,7 @@ impl super::settings::Server {
}
impl super::settings::Database {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
use common_utils::fp_utils::when;
when(self.host.is_default_or_empty(), || {
@@ -102,7 +102,7 @@ impl super::settings::Database {
}
impl super::settings::SupportedConnectors {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.wallets.is_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"list of connectors supporting wallets must not be empty".into(),
@@ -112,7 +112,7 @@ impl super::settings::SupportedConnectors {
}
impl super::settings::Connectors {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
self.aci.validate()?;
self.adyen.validate()?;
self.applepay.validate()?;
@@ -133,7 +133,7 @@ impl super::settings::Connectors {
}
impl super::settings::ConnectorParams {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.base_url.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"connector base URL must not be empty".into(),
@@ -143,7 +143,7 @@ impl super::settings::ConnectorParams {
}
impl super::settings::SchedulerSettings {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
use common_utils::fp_utils::when;
when(self.stream.is_default_or_empty(), || {
@@ -165,7 +165,7 @@ impl super::settings::SchedulerSettings {
}
impl super::settings::ProducerSettings {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.lock_key.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"producer lock key must not be empty".into(),
@@ -176,7 +176,7 @@ impl super::settings::ProducerSettings {
#[cfg(feature = "kv_store")]
impl super::settings::DrainerSettings {
- pub(crate) fn validate(&self) -> Result<(), ApplicationError> {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.stream_name.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"drainer stream name must not be empty".into(),
|
refactor
|
make visibility of validation functions public (#421)
|
15342f7fe7fb081a49fc2d2bb0f7ef5457160442
|
2024-12-02 15:25:44
|
github-actions
|
chore(version): 2024.12.02.1
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 454a5545687..5f748c6924a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.12.02.1
+
+### Bug Fixes
+
+- **openapi:** Revert Standardise API naming scheme for V2 Dashboard Changes ([#6712](https://github.com/juspay/hyperswitch/pull/6712)) ([`b097d7f`](https://github.com/juspay/hyperswitch/commit/b097d7f5a984b32421494ea033029d01d034fab8))
+
+**Full Changelog:** [`2024.12.02.0...2024.12.02.1`](https://github.com/juspay/hyperswitch/compare/2024.12.02.0...2024.12.02.1)
+
+- - -
+
## 2024.12.02.0
### Features
|
chore
|
2024.12.02.1
|
a1691d1b85226f336514d2c0dd4707cda131c69b
|
2025-03-05 14:52:09
|
Aniket Burman
|
feat(connector): add template code for recurly (#7284)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 9e54c7e8c88..453e1161284 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -255,6 +255,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index c8eb14c9853..a6a7a09e16e 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -100,6 +100,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
shift4.base_url = "https://api.shift4.com/"
signifyd.base_url = "https://api.signifyd.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 90ca4ae143d..e8f2c30c696 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -104,6 +104,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://api.juspay.in"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://wh.riskified.com/api/"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 29e60131149..302ff6f3a0c 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -104,6 +104,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/development.toml b/config/development.toml
index 7619f992aab..b81080740fd 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -327,6 +327,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 58cf75fb8d2..83aa883a164 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -187,6 +187,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index cadca5fad02..65fa444175e 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -116,6 +116,7 @@ pub enum RoutableConnectors {
Prophetpay,
Rapyd,
Razorpay,
+ // Recurly,
// Redsys,
Riskified,
Shift4,
@@ -259,6 +260,7 @@ pub enum Connector {
Prophetpay,
Rapyd,
Razorpay,
+ //Recurly,
// Redsys,
Shift4,
Square,
@@ -408,6 +410,7 @@ impl Connector {
| Self::Powertranz
| Self::Prophetpay
| Self::Rapyd
+ // | Self::Recurly
// | Self::Redsys
| Self::Shift4
| Self::Square
@@ -543,6 +546,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Prophetpay => Self::Prophetpay,
RoutableConnectors::Rapyd => Self::Rapyd,
RoutableConnectors::Razorpay => Self::Razorpay,
+ // RoutableConnectors::Recurly => Self::Recurly,
RoutableConnectors::Riskified => Self::Riskified,
RoutableConnectors::Shift4 => Self::Shift4,
RoutableConnectors::Signifyd => Self::Signifyd,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 6fa0d9e103e..495228de0c9 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -59,6 +59,7 @@ pub mod powertranz;
pub mod prophetpay;
pub mod rapyd;
pub mod razorpay;
+pub mod recurly;
pub mod redsys;
pub mod shift4;
pub mod square;
@@ -92,8 +93,8 @@ pub use self::{
noon::Noon, novalnet::Novalnet, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, paybox::Paybox,
payeezy::Payeezy, payme::Payme, paystack::Paystack, payu::Payu, placetopay::Placetopay,
powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay,
- redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, stripebilling::Stripebilling,
- taxjar::Taxjar, thunes::Thunes, trustpay::Trustpay, tsys::Tsys,
+ recurly::Recurly, redsys::Redsys, shift4::Shift4, square::Square, stax::Stax,
+ stripebilling::Stripebilling, taxjar::Taxjar, thunes::Thunes, trustpay::Trustpay, tsys::Tsys,
unified_authentication_service::UnifiedAuthenticationService, volt::Volt,
wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen,
zsl::Zsl,
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
new file mode 100644
index 00000000000..c16810a6ab7
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -0,0 +1,568 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as recurly;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Recurly {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Recurly {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Recurly {}
+impl api::PaymentSession for Recurly {}
+impl api::ConnectorAccessToken for Recurly {}
+impl api::MandateSetup for Recurly {}
+impl api::PaymentAuthorize for Recurly {}
+impl api::PaymentSync for Recurly {}
+impl api::PaymentCapture for Recurly {}
+impl api::PaymentVoid for Recurly {}
+impl api::Refund for Recurly {}
+impl api::RefundExecute for Recurly {}
+impl api::RefundSync for Recurly {}
+impl api::PaymentToken for Recurly {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Recurly
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Recurly
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &RouterData<Flow, Request, Response>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Recurly {
+ fn id(&self) -> &'static str {
+ "recurly"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ // TODO! Check connector documentation, on which unit they are processing the currency.
+ // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
+ // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.recurly.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = recurly::RecurlyAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.expose().into_masked(),
+ )])
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: recurly::RecurlyErrorResponse = res
+ .response
+ .parse_struct("RecurlyErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Recurly {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Recurly {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Recurly {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Recurly {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = recurly::RecurlyRouterData::from((amount, req));
+ let connector_req = recurly::RecurlyPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: recurly::RecurlyPaymentsResponse = res
+ .response
+ .parse_struct("Recurly PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: recurly::RecurlyPaymentsResponse = res
+ .response
+ .parse_struct("recurly PaymentsSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: recurly::RecurlyPaymentsResponse = res
+ .response
+ .parse_struct("Recurly PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Recurly {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = recurly::RecurlyRouterData::from((refund_amount, req));
+ let connector_req = recurly::RecurlyRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundsRouterData<Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ let response: recurly::RefundResponse = res
+ .response
+ .parse_struct("recurly RefundResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Recurly {
+ fn get_headers(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ let response: recurly::RefundResponse = res
+ .response
+ .parse_struct("recurly RefundSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Recurly {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+impl ConnectorSpecifications for Recurly {}
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
new file mode 100644
index 00000000000..bc62985edb3
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
@@ -0,0 +1,228 @@
+use common_enums::enums;
+use common_utils::types::StringMinorUnit;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{ConnectorAuthType, RouterData},
+ router_flow_types::refunds::{Execute, RSync},
+ router_request_types::ResponseId,
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ types::{RefundsResponseRouterData, ResponseRouterData},
+ utils::PaymentsAuthorizeRequestData,
+};
+
+//TODO: Fill the struct with respective fields
+pub struct RecurlyRouterData<T> {
+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for RecurlyRouterData<T> {
+ fn from((amount, item): (StringMinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct RecurlyPaymentsRequest {
+ amount: StringMinorUnit,
+ card: RecurlyCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct RecurlyCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&RecurlyRouterData<&PaymentsAuthorizeRouterData>> for RecurlyPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &RecurlyRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = RecurlyCard {
+ 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.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct RecurlyAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for RecurlyAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => 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 RecurlyPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RecurlyPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: RecurlyPaymentStatus) -> Self {
+ match item {
+ RecurlyPaymentStatus::Succeeded => Self::Charged,
+ RecurlyPaymentStatus::Failed => Self::Failure,
+ RecurlyPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct RecurlyPaymentsResponse {
+ status: RecurlyPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, RecurlyPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, RecurlyPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct RecurlyRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&RecurlyRouterData<&RefundsRouterData<F>>> for RecurlyRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &RecurlyRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct RecurlyErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index f64f624187a..ad9e456c948 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -156,6 +156,7 @@ default_imp_for_authorize_session_token!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -250,6 +251,7 @@ default_imp_for_calculate_tax!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -319,6 +321,7 @@ default_imp_for_session_update!(
connectors::Klarna,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -415,6 +418,7 @@ default_imp_for_post_session_tokens!(
connectors::Klarna,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -520,6 +524,7 @@ default_imp_for_complete_authorize!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Stax,
connectors::Square,
@@ -613,6 +618,7 @@ default_imp_for_incremental_authorization!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -707,6 +713,7 @@ default_imp_for_create_customer!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Square,
@@ -789,6 +796,7 @@ default_imp_for_connector_redirect_response!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -875,6 +883,7 @@ default_imp_for_pre_processing_steps!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Stax,
connectors::Square,
@@ -968,6 +977,7 @@ default_imp_for_post_processing_steps!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1064,6 +1074,7 @@ default_imp_for_approve!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1160,6 +1171,7 @@ default_imp_for_reject!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1256,6 +1268,7 @@ default_imp_for_webhook_source_verification!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1352,6 +1365,7 @@ default_imp_for_accept_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1447,6 +1461,7 @@ default_imp_for_submit_evidence!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1542,6 +1557,7 @@ default_imp_for_defend_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1646,6 +1662,7 @@ default_imp_for_file_upload!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1733,6 +1750,7 @@ default_imp_for_payouts!(
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Square,
@@ -1829,6 +1847,7 @@ default_imp_for_payouts_create!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1926,6 +1945,7 @@ default_imp_for_payouts_retrieve!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2023,6 +2043,7 @@ default_imp_for_payouts_eligibility!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2119,6 +2140,7 @@ default_imp_for_payouts_fulfill!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2216,6 +2238,7 @@ default_imp_for_payouts_cancel!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2313,6 +2336,7 @@ default_imp_for_payouts_quote!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2410,6 +2434,7 @@ default_imp_for_payouts_recipient!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2507,6 +2532,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2605,6 +2631,7 @@ default_imp_for_frm_sale!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2703,6 +2730,7 @@ default_imp_for_frm_checkout!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2801,6 +2829,7 @@ default_imp_for_frm_transaction!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2899,6 +2928,7 @@ default_imp_for_frm_fulfillment!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2997,6 +3027,7 @@ default_imp_for_frm_record_return!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3090,6 +3121,7 @@ default_imp_for_revoking_mandates!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3186,6 +3218,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3280,6 +3313,7 @@ default_imp_for_uas_post_authentication!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3374,6 +3408,7 @@ default_imp_for_uas_authentication!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -3469,6 +3504,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index f333800480b..972a26adf36 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -265,6 +265,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -362,6 +363,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -454,6 +456,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -551,6 +554,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -647,6 +651,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -744,6 +749,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -851,6 +857,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -950,6 +957,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1049,6 +1057,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1148,6 +1157,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1247,6 +1257,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1346,6 +1357,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1445,6 +1457,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1544,6 +1557,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1643,6 +1657,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1740,6 +1755,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1839,6 +1855,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -1938,6 +1955,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2037,6 +2055,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2136,6 +2155,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2235,6 +2255,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
@@ -2331,6 +2352,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 5b46184c363..e3177856925 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -81,6 +81,7 @@ pub struct Connectors {
pub prophetpay: ConnectorParams,
pub rapyd: ConnectorParams,
pub razorpay: ConnectorParamsWithKeys,
+ pub recurly: ConnectorParams,
pub redsys: ConnectorParams,
pub riskified: ConnectorParams,
pub shift4: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 9f99b4c61a3..a89ae69451c 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -38,12 +38,12 @@ pub use hyperswitch_connectors::connectors::{
opennode::Opennode, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payme, payme::Payme,
paystack, paystack::Paystack, payu, payu::Payu, placetopay, placetopay::Placetopay, powertranz,
powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay,
- razorpay::Razorpay, redsys, redsys::Redsys, shift4, shift4::Shift4, square, square::Square,
- stax, stax::Stax, stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, thunes,
- thunes::Thunes, trustpay, trustpay::Trustpay, tsys, tsys::Tsys, unified_authentication_service,
- unified_authentication_service::UnifiedAuthenticationService, volt, volt::Volt, wellsfargo,
- wellsfargo::Wellsfargo, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, xendit,
- xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
+ razorpay::Razorpay, recurly::Recurly, redsys, redsys::Redsys, shift4, shift4::Shift4, square,
+ square::Square, stax, stax::Stax, stripebilling, stripebilling::Stripebilling, taxjar,
+ taxjar::Taxjar, thunes, thunes::Thunes, trustpay, trustpay::Trustpay, tsys, tsys::Tsys,
+ unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService,
+ volt, volt::Volt, wellsfargo, wellsfargo::Wellsfargo, worldline, worldline::Worldline,
+ worldpay, worldpay::Worldpay, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
};
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs
index 4f963755b1b..8d38b84a001 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -985,6 +985,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Powertranz,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Signifyd,
@@ -1390,6 +1391,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Powertranz,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Signifyd,
@@ -1729,6 +1731,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Signifyd,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 02a4fe2386c..7e5cdfdaa37 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -439,6 +439,7 @@ default_imp_for_connector_request_id!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Shift4,
@@ -1289,6 +1290,7 @@ default_imp_for_fraud_check!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Shift4,
connector::Square,
@@ -1778,6 +1780,7 @@ default_imp_for_connector_authentication!(
connector::Prophetpay,
connector::Rapyd,
connector::Razorpay,
+ connector::Recurly,
connector::Redsys,
connector::Riskified,
connector::Shift4,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index a32e0457dfa..c4c2371abf8 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -510,6 +510,7 @@ impl ConnectorData {
enums::Connector::Rapyd => {
Ok(ConnectorEnum::Old(Box::new(connector::Rapyd::new())))
}
+ // enums::Connector::Recurly => Ok(ConnectorEnum::Old(Box::new(connector::Recurly))),
// enums::Connector::Redsys => Ok(ConnectorEnum::Old(Box::new(connector::Redsys))),
enums::Connector::Shift4 => {
Ok(ConnectorEnum::Old(Box::new(connector::Shift4::new())))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 514ddbbbb50..6ab4111f4b7 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -290,6 +290,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Prophetpay => Self::Prophetpay,
api_enums::Connector::Rapyd => Self::Rapyd,
api_enums::Connector::Razorpay => Self::Razorpay,
+ // api_enums::Connector::Recurly => Self::Recurly,
// api_enums::Connector::Redsys => Self::Redsys,
api_enums::Connector::Shift4 => Self::Shift4,
api_enums::Connector::Signifyd => {
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 09718d56181..040b2dd6317 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -78,6 +78,7 @@ mod powertranz;
mod prophetpay;
mod rapyd;
mod razorpay;
+mod recurly;
mod redsys;
mod shift4;
mod square;
diff --git a/crates/router/tests/connectors/recurly.rs b/crates/router/tests/connectors/recurly.rs
new file mode 100644
index 00000000000..a38ed49d415
--- /dev/null
+++ b/crates/router/tests/connectors/recurly.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct RecurlyTest;
+impl ConnectorActions for RecurlyTest {}
+impl utils::Connector for RecurlyTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Recurly;
+ utils::construct_connector_data_old(
+ Box::new(Recurly::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .recurly
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "Recurly".to_string()
+ }
+}
+
+static CONNECTOR: RecurlyTest = RecurlyTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index d30a5008887..0650e5e6a4d 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -320,4 +320,7 @@ api_key= "API Key"
api_key= "API Key"
[paystack]
-api_key = "API Key"
\ No newline at end of file
+api_key = "API Key"
+
+[recurly]
+api_key= "API Key"
\ No newline at end of file
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index bb40cc51eaa..f19d5d22e80 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -82,6 +82,7 @@ pub struct ConnectorAuthentication {
pub prophetpay: Option<HeaderKey>,
pub rapyd: Option<BodyKey>,
pub razorpay: Option<BodyKey>,
+ pub recurly: Option<HeaderKey>,
pub redsys: Option<HeaderKey>,
pub shift4: Option<HeaderKey>,
pub square: Option<BodyKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 526899b7fff..6b1afeab21e 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -153,6 +153,7 @@ powertranz.base_url = "https://staging.ptranz.com/api/"
prophetpay.base_url = "https://ccm-thirdparty.cps.golf/"
rapyd.base_url = "https://sandboxapi.rapyd.net"
razorpay.base_url = "https://sandbox.juspay.in/"
+recurly.base_url = "https://{{merchant_subdomain_name}}.recurly.com"
redsys.base_url = "https://sis-t.redsys.es:25443/sis/realizarPago"
riskified.base_url = "https://sandbox.riskified.com/api"
shift4.base_url = "https://api.shift4.com/"
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 046042bfa73..022e54a943c 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
feat
|
add template code for recurly (#7284)
|
f8ef52c645d353aac438d6af5b00d9097332fdcb
|
2023-08-09 11:25:56
|
Narayan Bhat
|
feat(docs): add multiple examples support and webhook schema (#1864)
| false
|
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index b884508211e..021cc824026 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -1,6 +1,7 @@
use common_utils::custom_serde;
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
+use utoipa::ToSchema;
use crate::{disputes, enums as api_enums, payments, refunds};
@@ -81,20 +82,33 @@ pub struct IncomingWebhookDetails {
pub resource_object: Vec<u8>,
}
-#[derive(Debug, Clone, Serialize)]
+#[derive(Debug, Clone, Serialize, ToSchema)]
pub struct OutgoingWebhook {
+ /// The merchant id of the merchant
pub merchant_id: String,
+
+ /// The unique event id for each webhook
pub event_id: String,
+
+ /// The type of event this webhook corresponds to.
+ #[schema(value_type = EventType)]
pub event_type: api_enums::EventType,
+
+ /// This is specific to the flow, for ex: it will be `PaymentsResponse` for payments flow
pub content: OutgoingWebhookContent,
#[serde(default, with = "custom_serde::iso8601")]
+
+ /// The time at which webhook was sent
pub timestamp: PrimitiveDateTime,
}
-#[derive(Debug, Clone, Serialize)]
+#[derive(Debug, Clone, Serialize, ToSchema)]
#[serde(tag = "type", content = "object", rename_all = "snake_case")]
pub enum OutgoingWebhookContent {
+ #[schema(value_type = PaymentsResponse)]
PaymentDetails(payments::PaymentsResponse),
+ #[schema(value_type = RefundResponse)]
RefundDetails(refunds::RefundResponse),
+ #[schema(value_type = DisputeResponse)]
DisputeDetails(Box<disputes::DisputeResponse>),
}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 53e9f66928d..b3a76df3d01 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -736,6 +736,7 @@ impl Currency {
serde::Serialize,
strum::Display,
strum::EnumString,
+ ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "pg_enum")]
#[serde(rename_all = "snake_case")]
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index b0087b0522f..1ead4924bf1 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -17,7 +17,6 @@ pub mod routes;
pub mod scheduler;
pub mod middleware;
-#[cfg(feature = "openapi")]
pub mod openapi;
pub mod services;
pub mod types;
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 98e4f642fef..b650b1d8595 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -1,3 +1,4 @@
+#[cfg(feature = "openapi")]
#[derive(utoipa::OpenApi)]
#[openapi(
info(
@@ -79,13 +80,13 @@ Never share your secret api keys. Keep them guarded and secure.
crate::routes::mandates::get_mandate,
crate::routes::mandates::revoke_mandate,
crate::routes::payments::payments_create,
- // crate::routes::payments::payments_start,
+ // crate::routes::payments::payments_start,
crate::routes::payments::payments_retrieve,
crate::routes::payments::payments_update,
crate::routes::payments::payments_confirm,
crate::routes::payments::payments_capture,
crate::routes::payments::payments_connector_session,
- // crate::routes::payments::payments_redirect_response,
+ // crate::routes::payments::payments_redirect_response,
crate::routes::payments::payments_cancel,
crate::routes::payments::payments_list,
crate::routes::payment_methods::create_payment_method_api,
@@ -318,6 +319,9 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::PayoutStatus,
api_models::enums::PayoutType,
api_models::payments::FrmMessage,
+ api_models::webhooks::OutgoingWebhook,
+ api_models::webhooks::OutgoingWebhookContent,
+ api_models::enums::EventType,
crate::types::api::admin::MerchantAccountResponse,
crate::types::api::admin::MerchantConnectorId,
crate::types::api::admin::MerchantDetails,
@@ -346,7 +350,7 @@ impl utoipa::Modify for SecurityAddon {
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
"api-key",
"API keys are the most common method of authentication and can be obtained \
- from the HyperSwitch dashboard."
+ from the HyperSwitch dashboard."
))),
),
(
@@ -354,7 +358,7 @@ impl utoipa::Modify for SecurityAddon {
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
"api-key",
"Admin API keys allow you to perform some privileged actions such as \
- creating a merchant account and Merchant Connector account."
+ creating a merchant account and Merchant Connector account."
))),
),
(
@@ -362,7 +366,7 @@ impl utoipa::Modify for SecurityAddon {
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
"api-key",
"Publishable keys are a type of keys that can be public and have limited \
- scope of usage."
+ scope of usage."
))),
),
(
@@ -370,10 +374,114 @@ impl utoipa::Modify for SecurityAddon {
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
"api-key",
"Ephemeral keys provide temporary access to singular data, such as access \
- to a single customer object for a short period of time."
+ to a single customer object for a short period of time."
))),
),
]);
}
}
}
+
+pub mod examples {
+ /// Creating the payment with minimal fields
+ pub const PAYMENTS_CREATE_MINIMUM_FIELDS: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ }"#;
+
+ /// Creating a manual capture payment
+ pub const PAYMENTS_CREATE_WITH_MANUAL_CAPTURE: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "capture_method":"manual"
+ }"#;
+
+ /// Creating a payment with billing and shipping address
+ pub const PAYMENTS_CREATE_WITH_ADDRESS: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "customer": {
+ "id" : "cus_abcdefgh"
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "joseph",
+ "last_name": "Doe"
+ },
+ "phone": {
+ "number": "8056594427",
+ "country_code": "+91"
+ }
+ }
+ }"#;
+
+ /// Creating a payment with customer details
+ pub const PAYMENTS_CREATE_WITH_CUSTOMER_DATA: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "customer": {
+ "id":"cus_abcdefgh",
+ "name":"John Dough",
+ "phone":"9999999999",
+ "email":"[email protected]"
+ }
+ }"#;
+
+ /// 3DS force payment
+ pub const PAYMENTS_CREATE_WITH_FORCED_3DS: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "authentication_type" : "three_ds"
+ }"#;
+
+ /// A payment with other fields
+ pub const PAYMENTS_CREATE: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "payment_id": "abcdefghijklmnopqrstuvwxyz",
+ "customer": {
+ "id":"cus_abcdefgh",
+ "name":"John Dough",
+ "phone":"9999999999",
+ "email":"[email protected]"
+ },
+ "description": "Its my first payment request",
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "some-value",
+ "udf2": "some-value"
+ }
+ }"#;
+
+ /// Creating the payment with order details
+ pub const PAYMENTS_CREATE_WITH_ORDER_DETAILS: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "order_details": [
+ {
+ "product_name": "Apple iPhone 15",
+ "quantity": 1,
+ "amount" : 6540
+ }
+ ]
+ }"#;
+
+ /// Creating the payment with connector metadata for noon
+ pub const PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY: &str = r#"{
+ "amount": 6540,
+ "currency": "USD",
+ "connector_metadata": {
+ "noon": {
+ "order_category":"shoes"
+ }
+ }
+ }"#;
+}
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index e47a248fbf4..32de056c1fc 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -10,6 +10,12 @@ use crate::{
errors::http_not_implemented,
payments::{self, PaymentRedirectFlow},
},
+ openapi::examples::{
+ PAYMENTS_CREATE, PAYMENTS_CREATE_MINIMUM_FIELDS, PAYMENTS_CREATE_WITH_ADDRESS,
+ PAYMENTS_CREATE_WITH_CUSTOMER_DATA, PAYMENTS_CREATE_WITH_FORCED_3DS,
+ PAYMENTS_CREATE_WITH_MANUAL_CAPTURE, PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY,
+ PAYMENTS_CREATE_WITH_ORDER_DETAILS,
+ },
services::{api, authentication as auth},
types::{
api::{self as api_types, enums as api_enums, payments as payment_types},
@@ -23,17 +29,59 @@ use crate::{
#[utoipa::path(
post,
path = "/payments",
- request_body=PaymentsCreateRequest,
+ request_body(
+ content = PaymentsCreateRequest,
+ examples(
+ (
+ "Create a payment with minimul fields" = (
+ value = json!(PAYMENTS_CREATE_MINIMUM_FIELDS)
+ )
+ ),
+ (
+ "Create a manual capture payment" = (
+ value = json!(PAYMENTS_CREATE_WITH_MANUAL_CAPTURE)
+ )
+ ),
+ (
+ "Create a payment with address" = (
+ value = json!(PAYMENTS_CREATE_WITH_ADDRESS)
+ )
+ ),
+ (
+ "Create a payment with customer details" = (
+ value = json!(PAYMENTS_CREATE_WITH_CUSTOMER_DATA)
+ )
+ ),
+ (
+ "Create a 3DS payment" = (
+ value = json!(PAYMENTS_CREATE_WITH_FORCED_3DS)
+ )
+ ),
+ (
+ "Create a payment" = (
+ value = json!(PAYMENTS_CREATE)
+ )
+ ),
+ (
+ "Create a payment with order details" = (
+ value = json!(PAYMENTS_CREATE_WITH_ORDER_DETAILS)
+ )
+ ),
+ (
+ "Create a payment with order category for noon" = (
+ value = json!(PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY)
+ )
+ ),
+ )),
responses(
(status = 200, description = "Payment created", body = PaymentsResponse),
(status = 400, description = "Missing Mandatory fields")
),
tag = "Payments",
operation_id = "Create a Payment",
- security(("api_key" = []))
+ security(("api_key" = [])),
)]
#[instrument(skip_all, fields(flow = ?Flow::PaymentsCreate))]
-// #[post("")]
pub async fn payments_create(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index ac28e9563d4..d637dc61612 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -976,6 +976,32 @@
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentsCreateRequest"
+ },
+ "examples": {
+ "Create a 3DS payment": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"authentication_type\" : \"three_ds\"\n }"
+ },
+ "Create a manual capture payment": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"capture_method\":\"manual\"\n }"
+ },
+ "Create a payment": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"payment_id\": \"abcdefghijklmnopqrstuvwxyz\",\n \"customer\": {\n \"id\":\"cus_abcdefgh\",\n \"name\":\"John Dough\",\n \"phone\":\"9999999999\",\n \"email\":\"[email protected]\"\n },\n \"description\": \"Its my first payment request\",\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"some-value\",\n \"udf2\": \"some-value\"\n }\n }"
+ },
+ "Create a payment with address": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\" : \"cus_abcdefgh\"\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\"\n },\n \"phone\": {\n \"number\": \"8056594427\",\n \"country_code\": \"+91\"\n }\n }\n }"
+ },
+ "Create a payment with customer details": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\":\"cus_abcdefgh\",\n \"name\":\"John Dough\",\n \"phone\":\"9999999999\",\n \"email\":\"[email protected]\"\n }\n }"
+ },
+ "Create a payment with minimul fields": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n }"
+ },
+ "Create a payment with order category for noon": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"connector_metadata\": {\n \"noon\": {\n \"order_category\":\"shoes\"\n }\n }\n }"
+ },
+ "Create a payment with order details": {
+ "value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"order_details\": [\n {\n \"product_name\": \"Apple iPhone 15\",\n \"quantity\": 1,\n \"amount\" : 6540\n }\n ]\n }"
+ }
}
}
},
@@ -4853,6 +4879,24 @@
}
}
},
+ "EventType": {
+ "type": "string",
+ "enum": [
+ "payment_succeeded",
+ "payment_failed",
+ "payment_processing",
+ "action_required",
+ "refund_succeeded",
+ "refund_failed",
+ "dispute_opened",
+ "dispute_expired",
+ "dispute_accepted",
+ "dispute_cancelled",
+ "dispute_challenged",
+ "dispute_won",
+ "dispute_lost"
+ ]
+ },
"FeatureMetadata": {
"type": "object",
"properties": {
@@ -6986,6 +7030,97 @@
}
}
},
+ "OutgoingWebhook": {
+ "type": "object",
+ "required": [
+ "merchant_id",
+ "event_id",
+ "event_type",
+ "content"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "description": "The merchant id of the merchant"
+ },
+ "event_id": {
+ "type": "string",
+ "description": "The unique event id for each webhook"
+ },
+ "event_type": {
+ "$ref": "#/components/schemas/EventType"
+ },
+ "content": {
+ "$ref": "#/components/schemas/OutgoingWebhookContent"
+ },
+ "timestamp": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The time at which webhook was sent"
+ }
+ }
+ },
+ "OutgoingWebhookContent": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "type",
+ "object"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "payment_details"
+ ]
+ },
+ "object": {
+ "$ref": "#/components/schemas/PaymentsResponse"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "type",
+ "object"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "refund_details"
+ ]
+ },
+ "object": {
+ "$ref": "#/components/schemas/RefundResponse"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "type",
+ "object"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "dispute_details"
+ ]
+ },
+ "object": {
+ "$ref": "#/components/schemas/DisputeResponse"
+ }
+ }
+ }
+ ],
+ "discriminator": {
+ "propertyName": "type"
+ }
+ },
"PayLaterData": {
"oneOf": [
{
|
feat
|
add multiple examples support and webhook schema (#1864)
|
edf919e142736a28588b0f7e40ce724ad0065777
|
2024-06-14 12:55:31
|
Chethan Rao
|
chore: address Rust 1.79 clippy lints (#5003)
| false
|
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index 9a0d4ec62c6..1ab79f07e43 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -317,6 +317,7 @@ impl std::fmt::Display for Order {
// "count",
// Order::Descending,
// )
+#[allow(dead_code)]
#[derive(Debug)]
pub struct TopN {
pub columns: String,
diff --git a/crates/router/src/connector/globalpay/response.rs b/crates/router/src/connector/globalpay/response.rs
index 7d5efadaff8..95f8c33728e 100644
--- a/crates/router/src/connector/globalpay/response.rs
+++ b/crates/router/src/connector/globalpay/response.rs
@@ -377,31 +377,11 @@ pub enum GlobalpayPaymentStatus {
Reversed,
}
-#[derive(Debug, Deserialize)]
-pub struct GlobalpayWebhoookResourceObject {
- pub data: GlobalpayWebhookDataResource,
-}
-
-#[derive(Debug, Deserialize)]
-pub struct GlobalpayWebhookDataResource {
- pub object: serde_json::Value,
-}
-
#[derive(Debug, Deserialize)]
pub struct GlobalpayWebhookObjectId {
pub id: String,
}
-#[derive(Debug, Deserialize)]
-pub struct GlobalpayWebhookDataId {
- pub object: GlobalpayWebhookObjectDataId,
-}
-
-#[derive(Debug, Deserialize)]
-pub struct GlobalpayWebhookObjectDataId {
- pub id: String,
-}
-
#[derive(Debug, Deserialize)]
pub struct GlobalpayWebhookObjectEventType {
pub status: GlobalpayWebhookStatus,
diff --git a/crates/router/tests/connectors/adyen.rs b/crates/router/tests/connectors/adyen.rs
index ff703dd84ef..9ec7e1bd38c 100644
--- a/crates/router/tests/connectors/adyen.rs
+++ b/crates/router/tests/connectors/adyen.rs
@@ -83,7 +83,6 @@ impl AdyenTest {
use common_utils::pii::Email;
Some(PaymentInfo {
- country: Some(api_models::enums::CountryAlpha2::NL),
currency: Some(enums::Currency::EUR),
address: Some(PaymentAddress::new(
None,
diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs
index 6554ddbefbf..045d356066d 100644
--- a/crates/router/tests/connectors/payme.rs
+++ b/crates/router/tests/connectors/payme.rs
@@ -68,7 +68,6 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
return_url: None,
connector_customer: None,
payment_method_token: None,
- country: None,
currency: None,
#[cfg(feature = "payouts")]
payout_method_data: None,
diff --git a/crates/router/tests/connectors/square.rs b/crates/router/tests/connectors/square.rs
index 2dcd93cc105..db7dd933e8c 100644
--- a/crates/router/tests/connectors/square.rs
+++ b/crates/router/tests/connectors/square.rs
@@ -48,7 +48,6 @@ fn get_default_payment_info(payment_method_token: Option<String>) -> Option<util
#[cfg(feature = "payouts")]
payout_method_data: None,
currency: None,
- country: None,
})
}
diff --git a/crates/router/tests/connectors/stax.rs b/crates/router/tests/connectors/stax.rs
index 421ad9524c3..e1c139e9418 100644
--- a/crates/router/tests/connectors/stax.rs
+++ b/crates/router/tests/connectors/stax.rs
@@ -51,7 +51,6 @@ fn get_default_payment_info(
#[cfg(feature = "payouts")]
payout_method_data: None,
currency: None,
- country: None,
})
}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 596b3ed6069..d98f0dae4ac 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -51,7 +51,6 @@ pub struct PaymentInfo {
#[cfg(feature = "payouts")]
pub payout_method_data: Option<types::api::PayoutMethodData>,
pub currency: Option<enums::Currency>,
- pub country: Option<enums::CountryAlpha2>,
}
impl PaymentInfo {
diff --git a/crates/router/tests/connectors/wise.rs b/crates/router/tests/connectors/wise.rs
index 161fd27f03d..47b799324ac 100644
--- a/crates/router/tests/connectors/wise.rs
+++ b/crates/router/tests/connectors/wise.rs
@@ -52,7 +52,6 @@ impl utils::Connector for WiseTest {
impl WiseTest {
fn get_payout_info() -> Option<PaymentInfo> {
Some(PaymentInfo {
- country: Some(api_models::enums::CountryAlpha2::NL),
currency: Some(enums::Currency::GBP),
address: Some(PaymentAddress::new(
None,
|
chore
|
address Rust 1.79 clippy lints (#5003)
|
d63cbbd4ad8eb2438967b1538da363b67964750f
|
2023-09-12 13:46:24
|
AkshayaFoiger
|
feat(connector): [Braintree] implement 3DS card payment for braintree (#2095)
| false
|
diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs
index 1c7292f8eeb..1f8c3f3b5e6 100644
--- a/crates/router/src/connector/braintree.rs
+++ b/crates/router/src/connector/braintree.rs
@@ -13,7 +13,10 @@ use crate::{
configs::settings,
connector::utils as connector_utils,
consts,
- core::errors::{self, CustomResult},
+ core::{
+ errors::{self, CustomResult},
+ payments,
+ },
headers, logger,
services::{
self,
@@ -156,7 +159,7 @@ impl api::PaymentAuthorize for Braintree {}
impl api::PaymentSync for Braintree {}
impl api::PaymentVoid for Braintree {}
impl api::PaymentCapture for Braintree {}
-
+impl api::PaymentsCompleteAuthorize for Braintree {}
impl api::PaymentSession for Braintree {}
impl api::ConnectorAccessToken for Braintree {}
@@ -1248,3 +1251,146 @@ impl api::IncomingWebhook for Braintree {
Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
}
}
+
+impl services::ConnectorRedirectResponse for Braintree {
+ fn get_flow_type(
+ &self,
+ _query_params: &str,
+ _json_payload: Option<serde_json::Value>,
+ _action: services::PaymentAction,
+ ) -> CustomResult<payments::CallConnectorAction, errors::ConnectorError> {
+ Ok(payments::CallConnectorAction::Trigger)
+ }
+}
+
+impl
+ ConnectorIntegration<
+ api::CompleteAuthorize,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ > for Braintree
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ let connector_api_version = &req.connector_api_version;
+ match self.is_braintree_graphql_version(connector_api_version) {
+ true => self.build_headers(req, connectors),
+ false => Err(errors::ConnectorError::NotImplemented(
+ "get_headers method".to_string(),
+ ))?,
+ }
+ }
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+ fn get_url(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let connector_api_version = &req.connector_api_version;
+ match self.is_braintree_graphql_version(connector_api_version) {
+ true => {
+ let base_url = connectors
+ .braintree
+ .secondary_base_url
+ .as_ref()
+ .ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
+ Ok(base_url.to_string())
+ }
+ false => Err(errors::ConnectorError::NotImplemented(
+ "get_url method".to_string(),
+ ))?,
+ }
+ }
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ ) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
+ let connector_api_version = &req.connector_api_version;
+ match self.is_braintree_graphql_version(connector_api_version) {
+ true => {
+ let connector_request =
+ braintree_graphql_transformers::BraintreePaymentsRequest::try_from(req)?;
+ let braintree_payment_request = types::RequestBody::log_and_get_request_body(
+ &connector_request,
+ utils::Encode::<braintree_graphql_transformers::BraintreePaymentsRequest>::encode_to_string_of_json,
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(braintree_payment_request))
+ }
+ false => Err(errors::ConnectorError::NotImplemented(
+ "get_request_body method".to_string(),
+ ))?,
+ }
+ }
+ fn build_request(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ let connector_api_version = &req.connector_api_version;
+ match self.is_braintree_graphql_version(connector_api_version) {
+ true => Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsCompleteAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsCompleteAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .body(types::PaymentsCompleteAuthorizeType::get_request_body(
+ self, req,
+ )?)
+ .build(),
+ )),
+ false => Err(errors::ConnectorError::NotImplemented(
+ "payment method".to_string(),
+ ))?,
+ }
+ }
+ fn handle_response(
+ &self,
+ data: &types::PaymentsCompleteAuthorizeRouterData,
+ res: types::Response,
+ ) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
+ match connector_utils::PaymentsCompleteAuthorizeRequestData::is_auto_capture(&data.request)?
+ {
+ true => {
+ let response: braintree_graphql_transformers::BraintreeCompleteChargeResponse = res
+ .response
+ .parse_struct("Braintree PaymentsResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ false => {
+ let response: braintree_graphql_transformers::BraintreeCompleteAuthResponse = res
+ .response
+ .parse_struct("Braintree AuthResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ }
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
diff --git a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
index 28c55f2141d..913c32014aa 100644
--- a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
+++ b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
@@ -1,14 +1,16 @@
-use error_stack::ResultExt;
-use masking::Secret;
+use error_stack::{IntoReport, ResultExt};
+use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
connector::utils::{self, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData},
consts,
core::errors,
+ services,
types::{self, api, storage::enums},
};
+pub const CLIENT_TOKEN_MUTATION: &str = "mutation createClientToken($input: CreateClientTokenInput!) { createClientToken(input: $input) { clientToken}}";
pub const TOKENIZE_CREDIT_CARD: &str = "mutation tokenizeCreditCard($input: TokenizeCreditCardInput!) { tokenizeCreditCard(input: $input) { clientMutationId paymentMethod { id } } }";
pub const CHARGE_CREDIT_CARD_MUTATION: &str = "mutation ChargeCreditCard($input: ChargeCreditCardInput!) { chargeCreditCard(input: $input) { transaction { id legacyId createdAt amount { value currencyCode } status } } }";
pub const AUTHORIZE_CREDIT_CARD_MUTATION: &str = "mutation authorizeCreditCard($input: AuthorizeCreditCardInput!) { authorizeCreditCard(input: $input) { transaction { id legacyId amount { value currencyCode } status } } }";
@@ -29,11 +31,18 @@ pub struct VariablePaymentInput {
}
#[derive(Debug, Serialize)]
-pub struct BraintreePaymentsRequest {
+pub struct CardPaymentRequest {
query: String,
variables: VariablePaymentInput,
}
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum BraintreePaymentsRequest {
+ Card(CardPaymentRequest),
+ CardThreeDs(BraintreeClientTokenRequest),
+}
+
#[derive(Debug, Deserialize)]
pub struct BraintreeMeta {
merchant_account_id: Option<Secret<String>>,
@@ -56,34 +65,13 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
match item.request.payment_method_data.clone() {
api::PaymentMethodData::Card(_) => {
- let query = match item.request.is_auto_capture()? {
- true => CHARGE_CREDIT_CARD_MUTATION.to_string(),
- false => AUTHORIZE_CREDIT_CARD_MUTATION.to_string(),
- };
- Ok(Self {
- query,
- variables: VariablePaymentInput {
- input: PaymentInput {
- payment_method_id: match item.get_payment_method_token()? {
- types::PaymentMethodToken::Token(token) => token,
- types::PaymentMethodToken::ApplePayDecrypt(_) => {
- Err(errors::ConnectorError::InvalidWalletToken)?
- }
- },
- transaction: TransactionBody {
- amount: utils::to_currency_base_unit(
- item.request.amount,
- item.request.currency,
- )?,
- merchant_account_id: metadata.merchant_account_id.ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "merchant_account_id",
- },
- )?,
- },
- },
- },
- })
+ if item.is_three_ds() {
+ Ok(Self::CardThreeDs(BraintreeClientTokenRequest::try_from(
+ metadata,
+ )?))
+ } else {
+ Ok(Self::Card(CardPaymentRequest::try_from((item, metadata))?))
+ }
}
api_models::payments::PaymentMethodData::CardRedirect(_)
| api_models::payments::PaymentMethodData::Wallet(_)
@@ -106,6 +94,33 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
}
}
+impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for BraintreePaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &types::PaymentsCompleteAuthorizeRouterData) -> Result<Self, Self::Error> {
+ match item.request.payment_method_data.clone() {
+ Some(api::PaymentMethodData::Card(_)) => {
+ Ok(Self::Card(CardPaymentRequest::try_from(item)?))
+ }
+ Some(api_models::payments::PaymentMethodData::CardRedirect(_))
+ | Some(api_models::payments::PaymentMethodData::Wallet(_))
+ | Some(api_models::payments::PaymentMethodData::PayLater(_))
+ | Some(api_models::payments::PaymentMethodData::BankRedirect(_))
+ | Some(api_models::payments::PaymentMethodData::BankDebit(_))
+ | Some(api_models::payments::PaymentMethodData::BankTransfer(_))
+ | Some(api_models::payments::PaymentMethodData::Crypto(_))
+ | Some(api_models::payments::PaymentMethodData::MandatePayment)
+ | Some(api_models::payments::PaymentMethodData::Reward)
+ | Some(api_models::payments::PaymentMethodData::Upi(_))
+ | Some(api_models::payments::PaymentMethodData::Voucher(_))
+ | Some(api_models::payments::PaymentMethodData::GiftCard(_))
+ | None => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("complete authorize flow"),
+ )
+ .into()),
+ }
+ }
+}
+
#[derive(Debug, Clone, Deserialize)]
pub struct AuthResponse {
data: DataAuthResponse,
@@ -114,6 +129,14 @@ pub struct AuthResponse {
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum BraintreeAuthResponse {
+ AuthResponse(Box<AuthResponse>),
+ ClientTokenResponse(Box<ClientTokenResponse>),
+ ErrorResponse(Box<ErrorResponse>),
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(untagged)]
+pub enum BraintreeCompleteAuthResponse {
AuthResponse(Box<AuthResponse>),
ErrorResponse(Box<ErrorResponse>),
}
@@ -135,13 +158,24 @@ pub struct AuthChargeCreditCard {
transaction: TransactionAuthChargeResponseBody,
}
-impl<F, T>
- TryFrom<types::ResponseRouterData<F, BraintreeAuthResponse, T, types::PaymentsResponseData>>
- for types::RouterData<F, T, types::PaymentsResponseData>
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BraintreeAuthResponse,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::ResponseRouterData<F, BraintreeAuthResponse, T, types::PaymentsResponseData>,
+ item: types::ResponseRouterData<
+ F,
+ BraintreeAuthResponse,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ >,
) -> Result<Self, Self::Error> {
match item.response {
BraintreeAuthResponse::ErrorResponse(error_response) => Ok(Self {
@@ -164,6 +198,23 @@ impl<F, T>
..item.data
})
}
+ BraintreeAuthResponse::ClientTokenResponse(client_token_data) => Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending,
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::NoResponseId,
+ redirection_data: Some(get_braintree_redirect_form(
+ *client_token_data,
+ item.data.get_payment_method_token()?,
+ item.data.request.payment_method_data.clone(),
+ item.data.request.amount,
+ )?),
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ }),
+ ..item.data
+ }),
}
}
}
@@ -286,16 +337,22 @@ impl From<BraintreePaymentStatus> for enums::AttemptStatus {
}
}
-impl<F, T>
- TryFrom<types::ResponseRouterData<F, BraintreePaymentsResponse, T, types::PaymentsResponseData>>
- for types::RouterData<F, T, types::PaymentsResponseData>
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BraintreePaymentsResponse,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: types::ResponseRouterData<
F,
BraintreePaymentsResponse,
- T,
+ types::PaymentsAuthorizeData,
types::PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
@@ -307,6 +364,111 @@ impl<F, T>
BraintreePaymentsResponse::PaymentsResponse(payment_response) => {
let transaction_data = payment_response.data.charge_credit_card.transaction;
+ Ok(Self {
+ status: enums::AttemptStatus::from(transaction_data.status.clone()),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(transaction_data.id),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ }),
+ ..item.data
+ })
+ }
+ BraintreePaymentsResponse::ClientTokenResponse(client_token_data) => Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending,
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::NoResponseId,
+ redirection_data: Some(get_braintree_redirect_form(
+ *client_token_data,
+ item.data.get_payment_method_token()?,
+ item.data.request.payment_method_data.clone(),
+ item.data.request.amount,
+ )?),
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ }),
+ ..item.data
+ }),
+ }
+ }
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BraintreeCompleteChargeResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BraintreeCompleteChargeResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ match item.response {
+ BraintreeCompleteChargeResponse::ErrorResponse(error_response) => Ok(Self {
+ response: build_error_response(&error_response.errors.clone(), item.http_code),
+ ..item.data
+ }),
+ BraintreeCompleteChargeResponse::PaymentsResponse(payment_response) => {
+ let transaction_data = payment_response.data.charge_credit_card.transaction;
+
+ Ok(Self {
+ status: enums::AttemptStatus::from(transaction_data.status.clone()),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(transaction_data.id),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ }),
+ ..item.data
+ })
+ }
+ }
+ }
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BraintreeCompleteAuthResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BraintreeCompleteAuthResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ match item.response {
+ BraintreeCompleteAuthResponse::ErrorResponse(error_response) => Ok(Self {
+ response: build_error_response(&error_response.errors, item.http_code),
+ ..item.data
+ }),
+ BraintreeCompleteAuthResponse::AuthResponse(auth_response) => {
+ let transaction_data = auth_response.data.authorize_credit_card.transaction;
+
Ok(Self {
status: enums::AttemptStatus::from(transaction_data.status.clone()),
response: Ok(types::PaymentsResponseData::TransactionResponse {
@@ -332,6 +494,14 @@ pub struct PaymentsResponse {
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum BraintreePaymentsResponse {
+ PaymentsResponse(Box<PaymentsResponse>),
+ ClientTokenResponse(Box<ClientTokenResponse>),
+ ErrorResponse(Box<ErrorResponse>),
+}
+
+#[derive(Debug, Clone, Deserialize)]
+#[serde(untagged)]
+pub enum BraintreeCompleteChargeResponse {
PaymentsResponse(Box<PaymentsResponse>),
ErrorResponse(Box<ErrorResponse>),
}
@@ -572,23 +742,46 @@ pub struct CreditCardData {
cardholder_name: Secret<String>,
}
+#[derive(Default, Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientTokenInput {
+ merchant_account_id: Secret<String>,
+}
+
#[derive(Default, Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InputData {
credit_card: CreditCardData,
}
+#[derive(Default, Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InputClientTokenData {
+ client_token: ClientTokenInput,
+}
+
#[derive(Default, Debug, Clone, Serialize)]
pub struct VariableInput {
input: InputData,
}
+#[derive(Default, Debug, Clone, Serialize)]
+pub struct VariableClientTokenInput {
+ input: InputClientTokenData,
+}
+
#[derive(Default, Debug, Clone, Serialize)]
pub struct BraintreeTokenRequest {
query: String,
variables: VariableInput,
}
+#[derive(Default, Debug, Clone, Serialize)]
+pub struct BraintreeClientTokenRequest {
+ query: String,
+ variables: VariableClientTokenInput,
+}
+
impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::TokenizationRouterData) -> Result<Self, Self::Error> {
@@ -641,12 +834,29 @@ pub struct TokenizeCreditCardData {
payment_method: TokenizePaymentMethodData,
}
+#[derive(Default, Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientToken {
+ client_token: Secret<String>,
+}
+
#[derive(Default, Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TokenizeCreditCard {
tokenize_credit_card: TokenizeCreditCardData,
}
+#[derive(Default, Debug, Clone, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientTokenData {
+ create_client_token: ClientToken,
+}
+
+#[derive(Default, Debug, Clone, Deserialize)]
+pub struct ClientTokenResponse {
+ data: ClientTokenData,
+}
+
#[derive(Default, Debug, Clone, Deserialize)]
pub struct TokenResponse {
data: TokenizeCreditCard,
@@ -987,3 +1197,166 @@ impl<F, T>
}
}
}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BraintreeThreeDsResponse {
+ pub nonce: String,
+ pub liability_shifted: bool,
+ pub liability_shift_possible: bool,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct BraintreeRedirectionResponse {
+ pub authentication_response: String,
+}
+
+impl TryFrom<BraintreeMeta> for BraintreeClientTokenRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(metadata: BraintreeMeta) -> Result<Self, Self::Error> {
+ Ok(Self {
+ query: CLIENT_TOKEN_MUTATION.to_owned(),
+ variables: VariableClientTokenInput {
+ input: InputClientTokenData {
+ client_token: ClientTokenInput {
+ merchant_account_id: metadata.merchant_account_id.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "merchant_account_id",
+ },
+ )?,
+ },
+ },
+ },
+ })
+ }
+}
+
+impl TryFrom<(&types::PaymentsAuthorizeRouterData, BraintreeMeta)> for CardPaymentRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ payment_info: (&types::PaymentsAuthorizeRouterData, BraintreeMeta),
+ ) -> Result<Self, Self::Error> {
+ let item = payment_info.0;
+ let metadata = payment_info.1;
+ let query = match item.request.is_auto_capture()? {
+ true => CHARGE_CREDIT_CARD_MUTATION.to_string(),
+ false => AUTHORIZE_CREDIT_CARD_MUTATION.to_string(),
+ };
+ Ok(Self {
+ query,
+ variables: VariablePaymentInput {
+ input: PaymentInput {
+ payment_method_id: match item.get_payment_method_token()? {
+ types::PaymentMethodToken::Token(token) => token,
+ types::PaymentMethodToken::ApplePayDecrypt(_) => {
+ Err(errors::ConnectorError::InvalidWalletToken)?
+ }
+ },
+ transaction: TransactionBody {
+ amount: utils::to_currency_base_unit(
+ item.request.amount,
+ item.request.currency,
+ )?,
+ merchant_account_id: metadata.merchant_account_id.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "merchant_account_id",
+ },
+ )?,
+ },
+ },
+ },
+ })
+ }
+}
+
+impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for CardPaymentRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &types::PaymentsCompleteAuthorizeRouterData) -> Result<Self, Self::Error> {
+ let metadata: BraintreeMeta =
+ utils::to_connector_meta_from_secret(item.connector_meta_data.clone())?;
+ utils::validate_currency(item.request.currency, metadata.merchant_config_currency)?;
+ let payload_data =
+ utils::PaymentsCompleteAuthorizeRequestData::get_redirect_response_payload(
+ &item.request,
+ )?
+ .expose();
+ let redirection_response: BraintreeRedirectionResponse =
+ serde_json::from_value(payload_data)
+ .into_report()
+ .change_context(errors::ConnectorError::MissingConnectorRedirectionPayload {
+ field_name: "redirection_response",
+ })?;
+ let three_ds_data = serde_json::from_str::<BraintreeThreeDsResponse>(
+ &redirection_response.authentication_response,
+ )
+ .into_report()
+ .change_context(errors::ConnectorError::MissingConnectorRedirectionPayload {
+ field_name: "three_ds_data",
+ })?;
+ let query =
+ match utils::PaymentsCompleteAuthorizeRequestData::is_auto_capture(&item.request)? {
+ true => CHARGE_CREDIT_CARD_MUTATION.to_string(),
+ false => AUTHORIZE_CREDIT_CARD_MUTATION.to_string(),
+ };
+ Ok(Self {
+ query,
+ variables: VariablePaymentInput {
+ input: PaymentInput {
+ payment_method_id: three_ds_data.nonce,
+ transaction: TransactionBody {
+ amount: utils::to_currency_base_unit(
+ item.request.amount,
+ item.request.currency,
+ )?,
+ merchant_account_id: metadata.merchant_account_id.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "merchant_account_id",
+ },
+ )?,
+ },
+ },
+ },
+ })
+ }
+}
+
+fn get_braintree_redirect_form(
+ client_token_data: ClientTokenResponse,
+ payment_method_token: types::PaymentMethodToken,
+ card_details: api_models::payments::PaymentMethodData,
+ amount: i64,
+) -> Result<services::RedirectForm, error_stack::Report<errors::ConnectorError>> {
+ Ok(services::RedirectForm::Braintree {
+ client_token: client_token_data
+ .data
+ .create_client_token
+ .client_token
+ .expose(),
+ card_token: match payment_method_token {
+ types::PaymentMethodToken::Token(token) => token,
+ types::PaymentMethodToken::ApplePayDecrypt(_) => {
+ Err(errors::ConnectorError::InvalidWalletToken)?
+ }
+ },
+ bin: match card_details {
+ api_models::payments::PaymentMethodData::Card(card_details) => {
+ card_details.card_number.get_card_isin()
+ }
+ api_models::payments::PaymentMethodData::CardRedirect(_)
+ | api_models::payments::PaymentMethodData::Wallet(_)
+ | api_models::payments::PaymentMethodData::PayLater(_)
+ | api_models::payments::PaymentMethodData::BankRedirect(_)
+ | api_models::payments::PaymentMethodData::BankDebit(_)
+ | api_models::payments::PaymentMethodData::BankTransfer(_)
+ | api_models::payments::PaymentMethodData::Crypto(_)
+ | api_models::payments::PaymentMethodData::MandatePayment
+ | api_models::payments::PaymentMethodData::Reward
+ | api_models::payments::PaymentMethodData::Upi(_)
+ | api_models::payments::PaymentMethodData::Voucher(_)
+ | api_models::payments::PaymentMethodData::GiftCard(_) => Err(
+ errors::ConnectorError::NotImplemented("given payment method".to_owned()),
+ )?,
+ },
+ amount,
+ })
+}
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index a9731d04839..eda3739edfc 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -145,7 +145,6 @@ default_imp_for_complete_authorize!(
connector::Aci,
connector::Adyen,
connector::Bitpay,
- connector::Braintree,
connector::Boku,
connector::Cashtocode,
connector::Checkout,
@@ -286,7 +285,6 @@ default_imp_for_connector_redirect_response!(
connector::Adyen,
connector::Bitpay,
connector::Boku,
- connector::Braintree,
connector::Cashtocode,
connector::Coinbase,
connector::Cryptopay,
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 2f1f4323d81..8b9b0b6afeb 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -668,6 +668,12 @@ pub enum RedirectForm {
payment_fields_token: String, // payment-field-token
},
Payme,
+ Braintree {
+ client_token: String,
+ card_token: String,
+ bin: String,
+ amount: i64,
+ },
}
impl From<(url::Url, Method)> for RedirectForm {
@@ -1147,6 +1153,92 @@ pub fn build_redirection_form(
".to_string()))
}
}
+ RedirectForm::Braintree {
+ client_token,
+ card_token,
+ bin,
+ amount,
+ } => {
+ maud::html! {
+ (maud::DOCTYPE)
+ html {
+ head {
+ meta name="viewport" content="width=device-width, initial-scale=1";
+ (PreEscaped(r#"<script src="https://js.braintreegateway.com/web/3.97.1/js/three-d-secure.js"></script>"#))
+ (PreEscaped(r#"<script src="https://js.braintreegateway.com/web/3.97.1/js/hosted-fields.js"></script>"#))
+
+ }
+ body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" {
+
+ div id="loader1" class="lottie" style="height: 150px; display: block; position: relative; margin-top: 150px; margin-left: auto; margin-right: auto;" { "" }
+
+ (PreEscaped(r#"<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.7.4/lottie.min.js"></script>"#))
+
+ (PreEscaped(r#"
+ <script>
+ var anime = bodymovin.loadAnimation({
+ container: document.getElementById('loader1'),
+ renderer: 'svg',
+ loop: true,
+ autoplay: true,
+ name: 'hyperswitch loader',
+ animationData: {"v":"4.8.0","meta":{"g":"LottieFiles AE 3.1.1","a":"","k":"","d":"","tc":""},"fr":29.9700012207031,"ip":0,"op":31.0000012626559,"w":400,"h":250,"nm":"loader_shape","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"circle 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[278.25,202.671,0],"ix":2},"a":{"a":0,"k":[23.72,23.72,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[12.935,0],[0,-12.936],[-12.935,0],[0,12.935]],"o":[[-12.952,0],[0,12.935],[12.935,0],[0,-12.936]],"v":[[0,-23.471],[-23.47,0.001],[0,23.471],[23.47,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19.99,"s":[100]},{"t":29.9800012211104,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[23.72,23.721],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":48.0000019550801,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"square 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[196.25,201.271,0],"ix":2},"a":{"a":0,"k":[22.028,22.03,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.914,0],[0,0],[0,-1.914],[0,0],[-1.914,0],[0,0],[0,1.914],[0,0]],"o":[[0,0],[-1.914,0],[0,0],[0,1.914],[0,0],[1.914,0],[0,0],[0,-1.914]],"v":[[18.313,-21.779],[-18.312,-21.779],[-21.779,-18.313],[-21.779,18.314],[-18.312,21.779],[18.313,21.779],[21.779,18.314],[21.779,-18.313]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":5,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14.99,"s":[100]},{"t":24.9800010174563,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[22.028,22.029],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":47.0000019143492,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Triangle 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[116.25,200.703,0],"ix":2},"a":{"a":0,"k":[27.11,21.243,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0.558,-0.879],[0,0],[-1.133,0],[0,0],[0.609,0.947],[0,0]],"o":[[-0.558,-0.879],[0,0],[-0.609,0.947],[0,0],[1.133,0],[0,0],[0,0]],"v":[[1.209,-20.114],[-1.192,-20.114],[-26.251,18.795],[-25.051,20.993],[25.051,20.993],[26.251,18.795],[1.192,-20.114]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":9.99,"s":[100]},{"t":19.9800008138021,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[27.11,21.243],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":48.0000019550801,"st":0,"bm":0}],"markers":[]}
+ })
+ </script>
+ "#))
+
+
+ h3 style="text-align: center;" { "Please wait while we process your payment..." }
+ }
+
+ (PreEscaped(format!("<script>
+ var my3DSContainer;
+ var clientToken = \"{client_token}\";
+ braintree.threeDSecure.create({{
+ authorization: clientToken,
+ version: 2
+ }}, function(err, threeDs) {{
+ threeDs.verifyCard({{
+ amount: \"{amount}\",
+ nonce: \"{card_token}\",
+ bin: \"{bin}\",
+ addFrame: function(err, iframe) {{
+ my3DSContainer = document.createElement('div');
+ my3DSContainer.appendChild(iframe);
+ document.body.appendChild(my3DSContainer);
+ }},
+ removeFrame: function() {{
+ if(my3DSContainer && my3DSContainer.parentNode) {{
+ my3DSContainer.parentNode.removeChild(my3DSContainer);
+ }}
+ }},
+ onLookupComplete: function(data, next) {{
+ console.log(\"onLookup Complete\", data);
+ next();
+ }}
+ }},
+ function(err, payload) {{
+ if(err) {{
+ console.error(err);
+ }} else {{
+ console.log(payload);
+ var f = document.createElement('form');
+ f.action=window.location.pathname.replace(/payments\\/redirect\\/(\\w+)\\/(\\w+)\\/\\w+/, \"payments/$1/$2/redirect/complete/braintree\");
+ var i = document.createElement('input');
+ i.type = 'hidden';
+ f.method='POST';
+ i.name = 'authentication_response';
+ i.value = JSON.stringify(payload);
+ f.appendChild(i);
+ f.body = JSON.stringify(payload);
+ document.body.appendChild(f);
+ f.submit();
+ }}
+ }});
+ }}); </script>"
+ )))
+ }}
+ }
}
}
|
feat
|
[Braintree] implement 3DS card payment for braintree (#2095)
|
23b5647290a7baa12107abd88359507aa3c31444
|
2023-05-03 12:16:44
|
Kartikeya Hegde
|
fix: remove old data while deserialization error from cache (#1010)
| false
|
diff --git a/crates/router/src/db/cache.rs b/crates/router/src/db/cache.rs
index f616e98e1f5..a930eaf354c 100644
--- a/crates/router/src/db/cache.rs
+++ b/crates/router/src/db/cache.rs
@@ -24,15 +24,18 @@ where
.redis_conn()
.map_err(Into::<errors::StorageError>::into)?;
let redis_val = redis.get_and_deserialize_key::<T>(key, type_name).await;
+ let get_data_set_redis = || async {
+ let data = fun().await?;
+ redis
+ .serialize_and_set_key(key, &data)
+ .await
+ .change_context(errors::StorageError::KVError)?;
+ Ok::<_, error_stack::Report<errors::StorageError>>(data)
+ };
match redis_val {
Err(err) => match err.current_context() {
- errors::RedisError::NotFound => {
- let data = fun().await?;
- redis
- .serialize_and_set_key(key, &data)
- .await
- .change_context(errors::StorageError::KVError)?;
- Ok(data)
+ errors::RedisError::NotFound | errors::RedisError::JsonDeserializationFailed => {
+ get_data_set_redis().await
}
_ => Err(err
.change_context(errors::StorageError::KVError)
|
fix
|
remove old data while deserialization error from cache (#1010)
|
a4c8ad309b3ae580c4ab5651efeaebf44f8f2324
|
2024-04-25 05:33:05
|
github-actions
|
chore(version): 2024.04.25.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 66298bd3f7b..58ff71e295e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,28 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.04.25.0
+
+### Features
+
+- **router:** Handle authorize redirection after webhook processing for external 3ds flow ([#4452](https://github.com/juspay/hyperswitch/pull/4452)) ([`131e487`](https://github.com/juspay/hyperswitch/commit/131e487c662985737e9b50a8e62295ed9d23ca83))
+
+### Bug Fixes
+
+- **routing/tests:** Fix unit tests for routing ([#4438](https://github.com/juspay/hyperswitch/pull/4438)) ([`1d0d94d`](https://github.com/juspay/hyperswitch/commit/1d0d94d5e6528534ce461db39620f35490582ecb))
+
+### Documentation
+
+- **try_local_system:** Update WSL setup guide to address a memory issue ([#4431](https://github.com/juspay/hyperswitch/pull/4431)) ([`56f14b9`](https://github.com/juspay/hyperswitch/commit/56f14b935d5e9742a894408a714033318ecb6f2a))
+
+### Miscellaneous Tasks
+
+- Remove repetitive words ([#4448](https://github.com/juspay/hyperswitch/pull/4448)) ([`f49b0b3`](https://github.com/juspay/hyperswitch/commit/f49b0b3aabdf72030cb893ce479214eccd5a6e0f))
+
+**Full Changelog:** [`2024.04.24.0...2024.04.25.0`](https://github.com/juspay/hyperswitch/compare/2024.04.24.0...2024.04.25.0)
+
+- - -
+
## 2024.04.24.0
### Features
|
chore
|
2024.04.25.0
|
a0ac895aac928c566f6a29bbca65f187ecb9814e
|
2022-11-17 13:19:26
|
Sanchith Hegde
|
github(workflows): cancel previous in-progress CI workflow runs
| false
|
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 249f3e8d939..9676b485466 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -29,6 +29,10 @@ on:
- "LICENSE"
- "NOTICE"
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
env:
RUSTFLAGS: "-D warnings"
# Disable incremental compilation.
|
github
|
cancel previous in-progress CI workflow runs
|
ccee1a9ce9e860bfa04e74329fb47fd73f010b23
|
2024-06-03 14:46:17
|
ivor-juspay
|
feat(consolidated-kafka-events): add consolidated kafka payment events (#4798)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 5433d7a8e46..5d40d0e55ef 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -263,8 +263,7 @@ stripe = { banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,ba
# This data is used to call respective connectors for wallets and cards
[connectors.supported]
-wallets = ["klarna",
- "mifinity", "braintree", "applepay"]
+wallets = ["klarna", "mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"adyen",
@@ -352,8 +351,8 @@ email_role_arn = "" # The amazon resource name ( arn ) of the role which
sts_role_session_name = "" # An identifier for the assumed role session, used to uniquely identify a session.
[user]
-password_validity_in_days = 90 # Number of days after which password should be updated
-two_factor_auth_expiry_in_secs = 300 # Number of seconds after which 2FA should be done again if doing update/change from inside
+password_validity_in_days = 90 # Number of days after which password should be updated
+two_factor_auth_expiry_in_secs = 300 # Number of seconds after which 2FA should be done again if doing update/change from inside
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
@@ -364,7 +363,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" }
square = { long_lived_token = false, payment_method = "card" }
braintree = { long_lived_token = false, payment_method = "card" }
gocardless = { long_lived_token = true, payment_method = "bank_debit" }
-billwerk = {long_lived_token = false, payment_method = "card"}
+billwerk = { long_lived_token = false, payment_method = "card" }
[temp_locker_enable_config]
stripe = { payment_method = "bank_transfer" }
@@ -397,16 +396,16 @@ slack_invite_url = "https://www.example.com/" # Slack invite url for hyperswit
discord_invite_url = "https://www.example.com/" # Discord invite url for hyperswitch
[mandates.supported_payment_methods]
-card.credit = { connector_list = "stripe,adyen,cybersource,bankofamerica"} # Mandate supported payment method type and connector for card
-wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
-pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
-bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
-bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
-bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
-bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
+card.credit = { connector_list = "stripe,adyen,cybersource,bankofamerica" } # Mandate supported payment method type and connector for card
+wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
+pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
+bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
+bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
+bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
+bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect
bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" }
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" }
-wallet.google_pay = { connector_list = "bankofamerica"}
+wallet.google_pay = { connector_list = "bankofamerica" }
bank_redirect.giropay = { connector_list = "adyen,globalpay" }
@@ -589,6 +588,7 @@ outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webh
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
+consolidated_events_topic = "topic" # Kafka topic to be used for Consolidated events
# File storage configuration
[file_storage]
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index fc02335dcf5..7215e1931a4 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -81,6 +81,7 @@ outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webh
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
+consolidated_events_topic = "topic" # Kafka topic to be used for Consolidated events
# File storage configuration
[file_storage]
diff --git a/config/development.toml b/config/development.toml
index 56d74e67489..496ce6477a8 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -89,8 +89,7 @@ vault_private_key = ""
tunnel_private_key = ""
[connectors.supported]
-wallets = ["klarna",
- "mifinity", "braintree", "applepay", "adyen"]
+wallets = ["klarna", "mifinity", "braintree", "applepay", "adyen"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
@@ -559,7 +558,7 @@ redis_lock_expiry_seconds = 180 # 3 * 60 seconds
delay_between_retries_in_milliseconds = 500
[kv_config]
-ttl = 900 # 15 * 60 seconds
+ttl = 900 # 15 * 60 seconds
soft_kill = false
[frm]
@@ -579,6 +578,7 @@ outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
dispute_analytics_topic = "hyperswitch-dispute-events"
audit_events_topic = "hyperswitch-audit-events"
payout_analytics_topic = "hyperswitch-payout-events"
+consolidated_events_topic = "hyperswitch-consolidated-events"
[analytics]
source = "sqlx"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 3dac84e21d8..b94b5c8afbb 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -180,8 +180,7 @@ zsl.base_url = "https://api.sitoffalb.net/"
apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US,KR,VN,MA,ZA,VA,CL,SV,GT,HN,PA", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }
[connectors.supported]
-wallets = ["klarna",
- "mifinity", "braintree", "applepay"]
+wallets = ["klarna", "mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"aci",
@@ -239,7 +238,7 @@ cards = [
"worldline",
"worldpay",
"zen",
- "zsl"
+ "zsl",
]
[delayed_session_response]
@@ -269,7 +268,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" }
square = { long_lived_token = false, payment_method = "card" }
braintree = { long_lived_token = false, payment_method = "card" }
gocardless = { long_lived_token = true, payment_method = "bank_debit" }
-billwerk = {long_lived_token = false, payment_method = "card"}
+billwerk = { long_lived_token = false, payment_method = "card" }
[temp_locker_enable_config]
stripe = { payment_method = "bank_transfer" }
@@ -433,6 +432,7 @@ outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
dispute_analytics_topic = "hyperswitch-dispute-events"
audit_events_topic = "hyperswitch-audit-events"
payout_analytics_topic = "hyperswitch-payout-events"
+consolidated_events_topic = "hyperswitch-consolidated-events"
[analytics]
source = "sqlx"
@@ -454,7 +454,7 @@ connection_timeout = 10
queue_strategy = "Fifo"
[kv_config]
-ttl = 900 # 15 * 60 seconds
+ttl = 900 # 15 * 60 seconds
soft_kill = false
[frm]
diff --git a/crates/router/src/events.rs b/crates/router/src/events.rs
index 4bca5824835..e1ecd09804c 100644
--- a/crates/router/src/events.rs
+++ b/crates/router/src/events.rs
@@ -30,6 +30,7 @@ pub enum EventType {
AuditEvent,
#[cfg(feature = "payouts")]
Payout,
+ Consolidated,
}
#[derive(Debug, Default, Deserialize, Clone)]
diff --git a/crates/router/src/services/kafka.rs b/crates/router/src/services/kafka.rs
index 6f2aa9fcd10..3523ab9261f 100644
--- a/crates/router/src/services/kafka.rs
+++ b/crates/router/src/services/kafka.rs
@@ -12,9 +12,13 @@ use rdkafka::{
pub mod payout;
use crate::events::EventType;
mod dispute;
+mod dispute_event;
mod payment_attempt;
+mod payment_attempt_event;
mod payment_intent;
+mod payment_intent_event;
mod refund;
+mod refund_event;
use diesel_models::refund::Refund;
use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent};
use serde::Serialize;
@@ -23,8 +27,10 @@ use time::{OffsetDateTime, PrimitiveDateTime};
#[cfg(feature = "payouts")]
use self::payout::KafkaPayout;
use self::{
- dispute::KafkaDispute, payment_attempt::KafkaPaymentAttempt,
- payment_intent::KafkaPaymentIntent, refund::KafkaRefund,
+ dispute::KafkaDispute, dispute_event::KafkaDisputeEvent, payment_attempt::KafkaPaymentAttempt,
+ payment_attempt_event::KafkaPaymentAttemptEvent, payment_intent::KafkaPaymentIntent,
+ payment_intent_event::KafkaPaymentIntentEvent, refund::KafkaRefund,
+ refund_event::KafkaRefundEvent,
};
use crate::types::storage::Dispute;
@@ -89,6 +95,42 @@ impl<'a, T: KafkaMessage> KafkaMessage for KafkaEvent<'a, T> {
}
}
+#[derive(serde::Serialize, Debug)]
+struct KafkaConsolidatedLog<'a, T: KafkaMessage> {
+ #[serde(flatten)]
+ event: &'a T,
+ tenant_id: TenantID,
+}
+
+#[derive(serde::Serialize, Debug)]
+struct KafkaConsolidatedEvent<'a, T: KafkaMessage> {
+ log: KafkaConsolidatedLog<'a, T>,
+ log_type: EventType,
+}
+
+impl<'a, T: KafkaMessage> KafkaConsolidatedEvent<'a, T> {
+ fn new(event: &'a T, tenant_id: TenantID) -> Self {
+ Self {
+ log: KafkaConsolidatedLog { event, tenant_id },
+ log_type: event.event_type(),
+ }
+ }
+}
+
+impl<'a, T: KafkaMessage> KafkaMessage for KafkaConsolidatedEvent<'a, T> {
+ fn key(&self) -> String {
+ self.log.event.key()
+ }
+
+ fn event_type(&self) -> EventType {
+ EventType::Consolidated
+ }
+
+ fn creation_timestamp(&self) -> Option<i64> {
+ self.log.event.creation_timestamp()
+ }
+}
+
#[derive(Debug, serde::Deserialize, Clone, Default)]
#[serde(default)]
pub struct KafkaSettings {
@@ -103,6 +145,7 @@ pub struct KafkaSettings {
audit_events_topic: String,
#[cfg(feature = "payouts")]
payout_analytics_topic: String,
+ consolidated_events_topic: String,
}
impl KafkaSettings {
@@ -175,6 +218,12 @@ impl KafkaSettings {
))
})?;
+ common_utils::fp_utils::when(self.consolidated_events_topic.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "Consolidated Events topic must not be empty".into(),
+ ))
+ })?;
+
Ok(())
}
}
@@ -192,6 +241,7 @@ pub struct KafkaProducer {
audit_events_topic: String,
#[cfg(feature = "payouts")]
payout_analytics_topic: String,
+ consolidated_events_topic: String,
}
struct RdKafkaProducer(ThreadedProducer<DefaultProducerContext>);
@@ -233,23 +283,13 @@ impl KafkaProducer {
audit_events_topic: conf.audit_events_topic.clone(),
#[cfg(feature = "payouts")]
payout_analytics_topic: conf.payout_analytics_topic.clone(),
+ consolidated_events_topic: conf.consolidated_events_topic.clone(),
})
}
pub fn log_event<T: KafkaMessage>(&self, event: &T) -> MQResult<()> {
router_env::logger::debug!("Logging Kafka Event {event:?}");
- let topic = match event.event_type() {
- EventType::PaymentIntent => &self.intent_analytics_topic,
- EventType::PaymentAttempt => &self.attempt_analytics_topic,
- EventType::Refund => &self.refund_analytics_topic,
- EventType::ApiLogs => &self.api_logs_topic,
- EventType::ConnectorApiLogs => &self.connector_logs_topic,
- EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic,
- EventType::Dispute => &self.dispute_analytics_topic,
- EventType::AuditEvent => &self.audit_events_topic,
- #[cfg(feature = "payouts")]
- EventType::Payout => &self.payout_analytics_topic,
- };
+ let topic = self.get_topic(event.event_type());
self.producer
.0
.send(
@@ -281,11 +321,18 @@ impl KafkaProducer {
format!("Failed to add negative attempt event {negative_event:?}")
})?;
};
+
self.log_event(&KafkaEvent::new(
&KafkaPaymentAttempt::from_storage(attempt),
tenant_id.clone(),
))
- .attach_printable_lazy(|| format!("Failed to add positive attempt event {attempt:?}"))
+ .attach_printable_lazy(|| format!("Failed to add positive attempt event {attempt:?}"))?;
+
+ self.log_event(&KafkaConsolidatedEvent::new(
+ &KafkaPaymentAttemptEvent::from_storage(attempt),
+ tenant_id.clone(),
+ ))
+ .attach_printable_lazy(|| format!("Failed to add consolidated attempt event {attempt:?}"))
}
pub async fn log_payment_attempt_delete(
@@ -317,11 +364,18 @@ impl KafkaProducer {
format!("Failed to add negative intent event {negative_event:?}")
})?;
};
+
self.log_event(&KafkaEvent::new(
&KafkaPaymentIntent::from_storage(intent),
tenant_id.clone(),
))
- .attach_printable_lazy(|| format!("Failed to add positive intent event {intent:?}"))
+ .attach_printable_lazy(|| format!("Failed to add positive intent event {intent:?}"))?;
+
+ self.log_event(&KafkaConsolidatedEvent::new(
+ &KafkaPaymentIntentEvent::from_storage(intent),
+ tenant_id.clone(),
+ ))
+ .attach_printable_lazy(|| format!("Failed to add consolidated intent event {intent:?}"))
}
pub async fn log_payment_intent_delete(
@@ -353,11 +407,18 @@ impl KafkaProducer {
format!("Failed to add negative refund event {negative_event:?}")
})?;
};
+
self.log_event(&KafkaEvent::new(
&KafkaRefund::from_storage(refund),
tenant_id.clone(),
))
- .attach_printable_lazy(|| format!("Failed to add positive refund event {refund:?}"))
+ .attach_printable_lazy(|| format!("Failed to add positive refund event {refund:?}"))?;
+
+ self.log_event(&KafkaConsolidatedEvent::new(
+ &KafkaRefundEvent::from_storage(refund),
+ tenant_id.clone(),
+ ))
+ .attach_printable_lazy(|| format!("Failed to add consolidated refund event {refund:?}"))
}
pub async fn log_refund_delete(
@@ -389,11 +450,18 @@ impl KafkaProducer {
format!("Failed to add negative dispute event {negative_event:?}")
})?;
};
+
self.log_event(&KafkaEvent::new(
&KafkaDispute::from_storage(dispute),
tenant_id.clone(),
))
- .attach_printable_lazy(|| format!("Failed to add positive dispute event {dispute:?}"))
+ .attach_printable_lazy(|| format!("Failed to add positive dispute event {dispute:?}"))?;
+
+ self.log_event(&KafkaConsolidatedEvent::new(
+ &KafkaDisputeEvent::from_storage(dispute),
+ tenant_id.clone(),
+ ))
+ .attach_printable_lazy(|| format!("Failed to add consolidated dispute event {dispute:?}"))
}
#[cfg(feature = "payouts")]
@@ -437,6 +505,7 @@ impl KafkaProducer {
EventType::AuditEvent => &self.audit_events_topic,
#[cfg(feature = "payouts")]
EventType::Payout => &self.payout_analytics_topic,
+ EventType::Consolidated => &self.consolidated_events_topic,
}
}
}
diff --git a/crates/router/src/services/kafka/dispute_event.rs b/crates/router/src/services/kafka/dispute_event.rs
new file mode 100644
index 00000000000..71e0a11e04d
--- /dev/null
+++ b/crates/router/src/services/kafka/dispute_event.rs
@@ -0,0 +1,77 @@
+use diesel_models::enums as storage_enums;
+use masking::Secret;
+use time::OffsetDateTime;
+
+use crate::types::storage::dispute::Dispute;
+
+#[serde_with::skip_serializing_none]
+#[derive(serde::Serialize, Debug)]
+pub struct KafkaDisputeEvent<'a> {
+ pub dispute_id: &'a String,
+ pub dispute_amount: i64,
+ pub currency: &'a String,
+ pub dispute_stage: &'a storage_enums::DisputeStage,
+ pub dispute_status: &'a storage_enums::DisputeStatus,
+ pub payment_id: &'a String,
+ pub attempt_id: &'a String,
+ pub merchant_id: &'a String,
+ pub connector_status: &'a String,
+ pub connector_dispute_id: &'a String,
+ pub connector_reason: Option<&'a String>,
+ pub connector_reason_code: Option<&'a String>,
+ #[serde(default, with = "time::serde::timestamp::milliseconds::option")]
+ pub challenge_required_by: Option<OffsetDateTime>,
+ #[serde(default, with = "time::serde::timestamp::milliseconds::option")]
+ pub connector_created_at: Option<OffsetDateTime>,
+ #[serde(default, with = "time::serde::timestamp::milliseconds::option")]
+ pub connector_updated_at: Option<OffsetDateTime>,
+ #[serde(default, with = "time::serde::timestamp::milliseconds")]
+ pub created_at: OffsetDateTime,
+ #[serde(default, with = "time::serde::timestamp::milliseconds")]
+ pub modified_at: OffsetDateTime,
+ pub connector: &'a String,
+ pub evidence: &'a Secret<serde_json::Value>,
+ pub profile_id: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a String>,
+}
+
+impl<'a> KafkaDisputeEvent<'a> {
+ pub fn from_storage(dispute: &'a Dispute) -> Self {
+ Self {
+ dispute_id: &dispute.dispute_id,
+ dispute_amount: dispute.amount.parse::<i64>().unwrap_or_default(),
+ currency: &dispute.currency,
+ dispute_stage: &dispute.dispute_stage,
+ dispute_status: &dispute.dispute_status,
+ payment_id: &dispute.payment_id,
+ attempt_id: &dispute.attempt_id,
+ merchant_id: &dispute.merchant_id,
+ connector_status: &dispute.connector_status,
+ connector_dispute_id: &dispute.connector_dispute_id,
+ connector_reason: dispute.connector_reason.as_ref(),
+ connector_reason_code: dispute.connector_reason_code.as_ref(),
+ challenge_required_by: dispute.challenge_required_by.map(|i| i.assume_utc()),
+ connector_created_at: dispute.connector_created_at.map(|i| i.assume_utc()),
+ connector_updated_at: dispute.connector_updated_at.map(|i| i.assume_utc()),
+ created_at: dispute.created_at.assume_utc(),
+ modified_at: dispute.modified_at.assume_utc(),
+ connector: &dispute.connector,
+ evidence: &dispute.evidence,
+ profile_id: dispute.profile_id.as_ref(),
+ merchant_connector_id: dispute.merchant_connector_id.as_ref(),
+ }
+ }
+}
+
+impl<'a> super::KafkaMessage for KafkaDisputeEvent<'a> {
+ fn key(&self) -> String {
+ format!(
+ "{}_{}_{}",
+ self.merchant_id, self.payment_id, self.dispute_id
+ )
+ }
+
+ fn event_type(&self) -> crate::events::EventType {
+ crate::events::EventType::Dispute
+ }
+}
diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rs
new file mode 100644
index 00000000000..bb4d69eda27
--- /dev/null
+++ b/crates/router/src/services/kafka/payment_attempt_event.rs
@@ -0,0 +1,119 @@
+// use diesel_models::enums::MandateDetails;
+use common_utils::types::MinorUnit;
+use diesel_models::enums as storage_enums;
+use hyperswitch_domain_models::{
+ mandates::MandateDetails, payments::payment_attempt::PaymentAttempt,
+};
+use time::OffsetDateTime;
+
+#[serde_with::skip_serializing_none]
+#[derive(serde::Serialize, Debug)]
+pub struct KafkaPaymentAttemptEvent<'a> {
+ pub payment_id: &'a String,
+ pub merchant_id: &'a String,
+ pub attempt_id: &'a String,
+ pub status: storage_enums::AttemptStatus,
+ pub amount: MinorUnit,
+ pub currency: Option<storage_enums::Currency>,
+ pub save_to_locker: Option<bool>,
+ pub connector: Option<&'a String>,
+ pub error_message: Option<&'a String>,
+ pub offer_amount: Option<MinorUnit>,
+ pub surcharge_amount: Option<MinorUnit>,
+ pub tax_amount: Option<MinorUnit>,
+ pub payment_method_id: Option<&'a String>,
+ pub payment_method: Option<storage_enums::PaymentMethod>,
+ pub connector_transaction_id: Option<&'a String>,
+ pub capture_method: Option<storage_enums::CaptureMethod>,
+ #[serde(default, with = "time::serde::timestamp::milliseconds::option")]
+ pub capture_on: Option<OffsetDateTime>,
+ pub confirm: bool,
+ pub authentication_type: Option<storage_enums::AuthenticationType>,
+ #[serde(with = "time::serde::timestamp::milliseconds")]
+ pub created_at: OffsetDateTime,
+ #[serde(with = "time::serde::timestamp::milliseconds")]
+ pub modified_at: OffsetDateTime,
+ #[serde(default, with = "time::serde::timestamp::milliseconds::option")]
+ pub last_synced: Option<OffsetDateTime>,
+ pub cancellation_reason: Option<&'a String>,
+ pub amount_to_capture: Option<MinorUnit>,
+ pub mandate_id: Option<&'a String>,
+ pub browser_info: Option<String>,
+ pub error_code: Option<&'a String>,
+ pub connector_metadata: Option<String>,
+ // TODO: These types should implement copy ideally
+ pub payment_experience: Option<&'a storage_enums::PaymentExperience>,
+ pub payment_method_type: Option<&'a storage_enums::PaymentMethodType>,
+ pub payment_method_data: Option<String>,
+ pub error_reason: Option<&'a String>,
+ pub multiple_capture_count: Option<i16>,
+ pub amount_capturable: MinorUnit,
+ pub merchant_connector_id: Option<&'a String>,
+ pub net_amount: MinorUnit,
+ pub unified_code: Option<&'a String>,
+ pub unified_message: Option<&'a String>,
+ pub mandate_data: Option<&'a MandateDetails>,
+ pub client_source: Option<&'a String>,
+ pub client_version: Option<&'a String>,
+}
+
+impl<'a> KafkaPaymentAttemptEvent<'a> {
+ pub fn from_storage(attempt: &'a PaymentAttempt) -> Self {
+ Self {
+ payment_id: &attempt.payment_id,
+ merchant_id: &attempt.merchant_id,
+ attempt_id: &attempt.attempt_id,
+ status: attempt.status,
+ amount: attempt.amount,
+ currency: attempt.currency,
+ save_to_locker: attempt.save_to_locker,
+ connector: attempt.connector.as_ref(),
+ error_message: attempt.error_message.as_ref(),
+ offer_amount: attempt.offer_amount,
+ surcharge_amount: attempt.surcharge_amount,
+ tax_amount: attempt.tax_amount,
+ payment_method_id: attempt.payment_method_id.as_ref(),
+ payment_method: attempt.payment_method,
+ connector_transaction_id: attempt.connector_transaction_id.as_ref(),
+ capture_method: attempt.capture_method,
+ capture_on: attempt.capture_on.map(|i| i.assume_utc()),
+ confirm: attempt.confirm,
+ authentication_type: attempt.authentication_type,
+ created_at: attempt.created_at.assume_utc(),
+ modified_at: attempt.modified_at.assume_utc(),
+ last_synced: attempt.last_synced.map(|i| i.assume_utc()),
+ cancellation_reason: attempt.cancellation_reason.as_ref(),
+ amount_to_capture: attempt.amount_to_capture,
+ mandate_id: attempt.mandate_id.as_ref(),
+ browser_info: attempt.browser_info.as_ref().map(|v| v.to_string()),
+ error_code: attempt.error_code.as_ref(),
+ connector_metadata: attempt.connector_metadata.as_ref().map(|v| v.to_string()),
+ payment_experience: attempt.payment_experience.as_ref(),
+ payment_method_type: attempt.payment_method_type.as_ref(),
+ payment_method_data: attempt.payment_method_data.as_ref().map(|v| v.to_string()),
+ error_reason: attempt.error_reason.as_ref(),
+ multiple_capture_count: attempt.multiple_capture_count,
+ amount_capturable: attempt.amount_capturable,
+ merchant_connector_id: attempt.merchant_connector_id.as_ref(),
+ net_amount: attempt.net_amount,
+ unified_code: attempt.unified_code.as_ref(),
+ unified_message: attempt.unified_message.as_ref(),
+ mandate_data: attempt.mandate_data.as_ref(),
+ client_source: attempt.client_source.as_ref(),
+ client_version: attempt.client_version.as_ref(),
+ }
+ }
+}
+
+impl<'a> super::KafkaMessage for KafkaPaymentAttemptEvent<'a> {
+ fn key(&self) -> String {
+ format!(
+ "{}_{}_{}",
+ self.merchant_id, self.payment_id, self.attempt_id
+ )
+ }
+
+ fn event_type(&self) -> crate::events::EventType {
+ crate::events::EventType::PaymentAttempt
+ }
+}
diff --git a/crates/router/src/services/kafka/payment_intent_event.rs b/crates/router/src/services/kafka/payment_intent_event.rs
new file mode 100644
index 00000000000..a3fbd9ddc45
--- /dev/null
+++ b/crates/router/src/services/kafka/payment_intent_event.rs
@@ -0,0 +1,75 @@
+use common_utils::{id_type, types::MinorUnit};
+use diesel_models::enums as storage_enums;
+use hyperswitch_domain_models::payments::PaymentIntent;
+use time::OffsetDateTime;
+
+#[serde_with::skip_serializing_none]
+#[derive(serde::Serialize, Debug)]
+pub struct KafkaPaymentIntentEvent<'a> {
+ pub payment_id: &'a String,
+ pub merchant_id: &'a String,
+ pub status: storage_enums::IntentStatus,
+ pub amount: MinorUnit,
+ pub currency: Option<storage_enums::Currency>,
+ pub amount_captured: Option<MinorUnit>,
+ pub customer_id: Option<&'a id_type::CustomerId>,
+ pub description: Option<&'a String>,
+ pub return_url: Option<&'a String>,
+ pub connector_id: Option<&'a String>,
+ pub statement_descriptor_name: Option<&'a String>,
+ pub statement_descriptor_suffix: Option<&'a String>,
+ #[serde(with = "time::serde::timestamp::milliseconds")]
+ pub created_at: OffsetDateTime,
+ #[serde(with = "time::serde::timestamp::milliseconds")]
+ pub modified_at: OffsetDateTime,
+ #[serde(default, with = "time::serde::timestamp::milliseconds::option")]
+ pub last_synced: Option<OffsetDateTime>,
+ pub setup_future_usage: Option<storage_enums::FutureUsage>,
+ pub off_session: Option<bool>,
+ pub client_secret: Option<&'a String>,
+ pub active_attempt_id: String,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<&'a String>,
+ pub attempt_count: i16,
+ pub payment_confirm_source: Option<storage_enums::PaymentSource>,
+}
+
+impl<'a> KafkaPaymentIntentEvent<'a> {
+ pub fn from_storage(intent: &'a PaymentIntent) -> Self {
+ Self {
+ payment_id: &intent.payment_id,
+ merchant_id: &intent.merchant_id,
+ status: intent.status,
+ amount: intent.amount,
+ currency: intent.currency,
+ amount_captured: intent.amount_captured,
+ customer_id: intent.customer_id.as_ref(),
+ description: intent.description.as_ref(),
+ return_url: intent.return_url.as_ref(),
+ connector_id: intent.connector_id.as_ref(),
+ statement_descriptor_name: intent.statement_descriptor_name.as_ref(),
+ statement_descriptor_suffix: intent.statement_descriptor_suffix.as_ref(),
+ created_at: intent.created_at.assume_utc(),
+ modified_at: intent.modified_at.assume_utc(),
+ last_synced: intent.last_synced.map(|i| i.assume_utc()),
+ setup_future_usage: intent.setup_future_usage,
+ off_session: intent.off_session,
+ client_secret: intent.client_secret.as_ref(),
+ active_attempt_id: intent.active_attempt.get_id(),
+ business_country: intent.business_country,
+ business_label: intent.business_label.as_ref(),
+ attempt_count: intent.attempt_count,
+ payment_confirm_source: intent.payment_confirm_source,
+ }
+ }
+}
+
+impl<'a> super::KafkaMessage for KafkaPaymentIntentEvent<'a> {
+ fn key(&self) -> String {
+ format!("{}_{}", self.merchant_id, self.payment_id)
+ }
+
+ fn event_type(&self) -> crate::events::EventType {
+ crate::events::EventType::PaymentIntent
+ }
+}
diff --git a/crates/router/src/services/kafka/refund_event.rs b/crates/router/src/services/kafka/refund_event.rs
new file mode 100644
index 00000000000..6aa80b243c1
--- /dev/null
+++ b/crates/router/src/services/kafka/refund_event.rs
@@ -0,0 +1,74 @@
+use common_utils::types::MinorUnit;
+use diesel_models::{enums as storage_enums, refund::Refund};
+use time::OffsetDateTime;
+
+#[serde_with::skip_serializing_none]
+#[derive(serde::Serialize, Debug)]
+pub struct KafkaRefundEvent<'a> {
+ pub internal_reference_id: &'a String,
+ pub refund_id: &'a String, //merchant_reference id
+ pub payment_id: &'a String,
+ pub merchant_id: &'a String,
+ pub connector_transaction_id: &'a String,
+ pub connector: &'a String,
+ pub connector_refund_id: Option<&'a String>,
+ pub external_reference_id: Option<&'a String>,
+ pub refund_type: &'a storage_enums::RefundType,
+ pub total_amount: &'a MinorUnit,
+ pub currency: &'a storage_enums::Currency,
+ pub refund_amount: &'a MinorUnit,
+ pub refund_status: &'a storage_enums::RefundStatus,
+ pub sent_to_gateway: &'a bool,
+ pub refund_error_message: Option<&'a String>,
+ pub refund_arn: Option<&'a String>,
+ #[serde(default, with = "time::serde::timestamp::milliseconds")]
+ pub created_at: OffsetDateTime,
+ #[serde(default, with = "time::serde::timestamp::milliseconds")]
+ pub modified_at: OffsetDateTime,
+ pub description: Option<&'a String>,
+ pub attempt_id: &'a String,
+ pub refund_reason: Option<&'a String>,
+ pub refund_error_code: Option<&'a String>,
+}
+
+impl<'a> KafkaRefundEvent<'a> {
+ pub fn from_storage(refund: &'a Refund) -> Self {
+ Self {
+ internal_reference_id: &refund.internal_reference_id,
+ refund_id: &refund.refund_id,
+ payment_id: &refund.payment_id,
+ merchant_id: &refund.merchant_id,
+ connector_transaction_id: &refund.connector_transaction_id,
+ connector: &refund.connector,
+ connector_refund_id: refund.connector_refund_id.as_ref(),
+ external_reference_id: refund.external_reference_id.as_ref(),
+ refund_type: &refund.refund_type,
+ total_amount: &refund.total_amount,
+ currency: &refund.currency,
+ refund_amount: &refund.refund_amount,
+ refund_status: &refund.refund_status,
+ sent_to_gateway: &refund.sent_to_gateway,
+ refund_error_message: refund.refund_error_message.as_ref(),
+ refund_arn: refund.refund_arn.as_ref(),
+ created_at: refund.created_at.assume_utc(),
+ modified_at: refund.updated_at.assume_utc(),
+ description: refund.description.as_ref(),
+ attempt_id: &refund.attempt_id,
+ refund_reason: refund.refund_reason.as_ref(),
+ refund_error_code: refund.refund_error_code.as_ref(),
+ }
+ }
+}
+
+impl<'a> super::KafkaMessage for KafkaRefundEvent<'a> {
+ fn key(&self) -> String {
+ format!(
+ "{}_{}_{}_{}",
+ self.merchant_id, self.payment_id, self.attempt_id, self.refund_id
+ )
+ }
+
+ fn event_type(&self) -> crate::events::EventType {
+ crate::events::EventType::Refund
+ }
+}
|
feat
|
add consolidated kafka payment events (#4798)
|
437a8de8ebd8af97a7df51dd81174cf36ca44e5f
|
2024-12-05 14:39:34
|
Mani Chandra
|
fix(api_models): Fix `wasm` build problems caused by `actix-multipart` (#6747)
| false
|
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index eb706dc913c..e5bf74c20c6 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -8,7 +8,7 @@ readme = "README.md"
license.workspace = true
[features]
-errors = ["dep:reqwest"]
+errors = ["dep:actix-web", "dep:reqwest"]
dummy_connector = ["euclid/dummy_connector", "common_enums/dummy_connector"]
detailed_errors = []
payouts = ["common_enums/payouts"]
@@ -21,10 +21,11 @@ v2 = ["common_utils/v2", "customer_v2"]
customer_v2 = ["common_utils/customer_v2"]
payment_methods_v2 = ["common_utils/payment_methods_v2"]
dynamic_routing = []
+control_center_theme = ["dep:actix-web", "dep:actix-multipart"]
[dependencies]
-actix-multipart = "0.6.1"
-actix-web = "4.5.1"
+actix-multipart = { version = "0.6.1", optional = true }
+actix-web = { version = "4.5.1", optional = true }
error-stack = "0.4.1"
indexmap = "2.3.0"
mime = "0.3.17"
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index 15146e304af..88c084d2f0b 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -2,11 +2,14 @@ use common_utils::events::{ApiEventMetric, ApiEventsType};
#[cfg(feature = "dummy_connector")]
use crate::user::sample_data::SampleDataRequest;
+#[cfg(feature = "control_center_theme")]
+use crate::user::theme::{
+ CreateThemeRequest, GetThemeResponse, UpdateThemeRequest, UploadFileRequest,
+};
use crate::user::{
dashboard_metadata::{
GetMetaDataRequest, GetMetaDataResponse, GetMultipleMetaDataPayload, SetMetaDataRequest,
},
- theme::{CreateThemeRequest, GetThemeResponse, UpdateThemeRequest, UploadFileRequest},
AcceptInviteFromEmailRequest, AuthSelectRequest, AuthorizeResponse, BeginTotpResponse,
ChangePasswordRequest, ConnectAccountRequest, CreateInternalUserRequest,
CreateUserAuthenticationMethodRequest, ForgotPasswordRequest, GetSsoAuthUrlRequest,
@@ -62,7 +65,14 @@ common_utils::impl_api_event_type!(
UpdateUserAuthenticationMethodRequest,
GetSsoAuthUrlRequest,
SsoSignInRequest,
- AuthSelectRequest,
+ AuthSelectRequest
+ )
+);
+
+#[cfg(feature = "control_center_theme")]
+common_utils::impl_api_event_type!(
+ Miscellaneous,
+ (
GetThemeResponse,
UploadFileRequest,
CreateThemeRequest,
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index 82291ddc92a..de0116058cb 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -8,6 +8,7 @@ use crate::user_role::UserStatus;
pub mod dashboard_metadata;
#[cfg(feature = "dummy_connector")]
pub mod sample_data;
+#[cfg(feature = "control_center_theme")]
pub mod theme;
#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index dde06fe832f..58815ad9249 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -123,7 +123,7 @@ x509-parser = "0.16.0"
# First party crates
analytics = { version = "0.1.0", path = "../analytics", optional = true, default-features = false }
-api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] }
+api_models = { version = "0.1.0", path = "../api_models", features = ["errors", "control_center_theme"] }
cards = { version = "0.1.0", path = "../cards" }
common_enums = { version = "0.1.0", path = "../common_enums" }
common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext", "logs", "metrics", "keymanager", "encryption_service"] }
|
fix
|
Fix `wasm` build problems caused by `actix-multipart` (#6747)
|
763ee094a6b4a2263c5528e87fad38e7e6bcf8de
|
2023-03-06 17:39:53
|
Pa1NarK
|
fix(errors): Replace PaymentMethod with PaymentModethodData in test.rs (#716)
| false
|
diff --git a/connector-template/test.rs b/connector-template/test.rs
index 1d961646fcc..bd65d9433a3 100644
--- a/connector-template/test.rs
+++ b/connector-template/test.rs
@@ -279,7 +279,7 @@ async fn should_fail_payment_for_incorrect_card_number() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_number: Secret::new("1234567891011".to_string()),
..utils::CCardType::default().0
}),
@@ -301,7 +301,7 @@ async fn should_fail_payment_for_empty_card_number() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_number: Secret::new(String::from("")),
..utils::CCardType::default().0
}),
@@ -324,7 +324,7 @@ async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
@@ -346,7 +346,7 @@ async fn should_fail_payment_for_invalid_exp_month() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_exp_month: Secret::new("20".to_string()),
..utils::CCardType::default().0
}),
@@ -368,7 +368,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_exp_year: Secret::new("2000".to_string()),
..utils::CCardType::default().0
}),
|
fix
|
Replace PaymentMethod with PaymentModethodData in test.rs (#716)
|
f1fd0b101791f20980e21e8fd8bf10fac3179209
|
2024-01-25 05:50:31
|
github-actions
|
chore(version): 2024.01.25.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3e300ccbb11..071f60d224f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.01.25.0
+
+### Refactors
+
+- **configs:** Add configs for deployments to environments ([#3265](https://github.com/juspay/hyperswitch/pull/3265)) ([`77c1bbb`](https://github.com/juspay/hyperswitch/commit/77c1bbb5a3fe3244cd988ac1260a4a31ae7fcd20))
+
+**Full Changelog:** [`2024.01.24.1...2024.01.25.0`](https://github.com/juspay/hyperswitch/compare/2024.01.24.1...2024.01.25.0)
+
+- - -
+
## 2024.01.24.1
### Features
|
chore
|
2024.01.25.0
|
a1fd36a1abea4d400386a00ccf182dfe9da5bcda
|
2024-03-06 15:00:16
|
Amisha Prabhat
|
feat(core): store customer_acceptance in the payment_methods table (#3885)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index ba0d963b8c1..86b09f2fa5a 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -348,9 +348,12 @@ pub struct PaymentsRequest {
#[remove_in(PaymentsUpdateRequest, PaymentsCreateRequest)]
pub client_secret: Option<String>,
- /// Passing this object during payments creates a mandate. The mandate_type sub object is passed by the server usually and the customer_acceptance sub object is usually passed by the SDK or client
+ /// Passing this object during payments creates a mandate. The mandate_type sub object is passed by the server.
pub mandate_data: Option<MandateData>,
+ /// Passing this object during payments confirm . The customer_acceptance sub object is usually passed by the SDK or client
+ pub customer_acceptance: Option<CustomerAcceptance>,
+
/// A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data
#[schema(max_length = 255, example = "mandate_iwer89rnjef349dni3")]
#[remove_in(PaymentsUpdateRequest)]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index ae2fb28aae5..f04c52042e0 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1145,8 +1145,8 @@ pub enum IntentStatus {
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum FutureUsage {
- #[default]
OffSession,
+ #[default]
OnSession,
}
diff --git a/crates/data_models/src/mandates.rs b/crates/data_models/src/mandates.rs
index b4478f84ee9..fa22a4e57d5 100644
--- a/crates/data_models/src/mandates.rs
+++ b/crates/data_models/src/mandates.rs
@@ -113,6 +113,16 @@ impl From<ApiCustomerAcceptance> for CustomerAcceptance {
}
}
+impl From<CustomerAcceptance> for ApiCustomerAcceptance {
+ fn from(value: CustomerAcceptance) -> Self {
+ Self {
+ acceptance_type: value.acceptance_type.into(),
+ accepted_at: value.accepted_at,
+ online: value.online.map(|d| d.into()),
+ }
+ }
+}
+
impl From<ApiAcceptanceType> for AcceptanceType {
fn from(value: ApiAcceptanceType) -> Self {
match value {
@@ -121,6 +131,14 @@ impl From<ApiAcceptanceType> for AcceptanceType {
}
}
}
+impl From<AcceptanceType> for ApiAcceptanceType {
+ fn from(value: AcceptanceType) -> Self {
+ match value {
+ AcceptanceType::Online => Self::Online,
+ AcceptanceType::Offline => Self::Offline,
+ }
+ }
+}
impl From<ApiOnlineMandate> for OnlineMandate {
fn from(value: ApiOnlineMandate) -> Self {
@@ -130,6 +148,14 @@ impl From<ApiOnlineMandate> for OnlineMandate {
}
}
}
+impl From<OnlineMandate> for ApiOnlineMandate {
+ fn from(value: OnlineMandate) -> Self {
+ Self {
+ ip_address: value.ip_address,
+ user_agent: value.user_agent,
+ }
+ }
+}
impl CustomerAcceptance {
pub fn get_ip_address(&self) -> Option<String> {
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index ec3bb7e4299..d07a8814c88 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -495,4 +495,5 @@ pub trait MandateBehaviour {
fn set_mandate_id(&mut self, new_mandate_id: Option<api_models::payments::MandateIds>);
fn get_payment_method_data(&self) -> api_models::payments::PaymentMethodData;
fn get_setup_mandate_details(&self) -> Option<&data_models::mandates::MandateData>;
+ fn get_customer_acceptance(&self) -> Option<api_models::payments::CustomerAcceptance>;
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index ce7f48405e2..4fdf957c842 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -81,6 +81,7 @@ pub async fn create_payment_method(
locker_id: Option<String>,
merchant_id: &str,
pm_metadata: Option<serde_json::Value>,
+ customer_acceptance: Option<serde_json::Value>,
payment_method_data: Option<Encryption>,
key_store: &domain::MerchantKeyStore,
) -> errors::CustomResult<storage::PaymentMethod, errors::ApiErrorResponse> {
@@ -100,6 +101,7 @@ pub async fn create_payment_method(
scheme: req.card_network.clone(),
metadata: pm_metadata.map(masking::Secret::new),
payment_method_data,
+ customer_acceptance: customer_acceptance.map(masking::Secret::new),
..storage::PaymentMethodNew::default()
})
.await
@@ -183,6 +185,7 @@ pub async fn get_or_insert_payment_method(
&merchant_account.merchant_id,
customer_id,
resp.metadata.clone().map(|val| val.expose()),
+ None,
locker_id,
)
.await
@@ -367,6 +370,7 @@ pub async fn add_payment_method(
merchant_id,
&customer_id,
pm_metadata.cloned(),
+ None,
locker_id,
)
.await?;
@@ -385,6 +389,7 @@ pub async fn insert_payment_method(
merchant_id: &str,
customer_id: &str,
pm_metadata: Option<serde_json::Value>,
+ customer_acceptance: Option<serde_json::Value>,
locker_id: Option<String>,
) -> errors::RouterResult<diesel_models::PaymentMethod> {
let pm_card_details = resp
@@ -400,6 +405,7 @@ pub async fn insert_payment_method(
locker_id,
merchant_id,
pm_metadata,
+ customer_acceptance,
pm_data_encrypted,
key_store,
)
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index aa44e5db22a..002502e9d9d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -15,7 +15,7 @@ use std::{fmt::Debug, marker::PhantomData, ops::Deref, time::Instant, vec::IntoI
use api_models::{self, enums, payments::HeaderPayload};
use common_utils::{ext_traits::AsyncExt, pii, types::Surcharge};
-use data_models::mandates::MandateData;
+use data_models::mandates::{CustomerAcceptance, MandateData};
use diesel_models::{ephemeral_key, fraud_check::FraudCheck};
use error_stack::{IntoReport, ResultExt};
use futures::future::join_all;
@@ -2050,6 +2050,7 @@ where
pub mandate_connector: Option<MandateConnectorDetails>,
pub currency: storage_enums::Currency,
pub setup_mandate: Option<MandateData>,
+ pub customer_acceptance: Option<CustomerAcceptance>,
pub address: PaymentAddress,
pub token: Option<String>,
pub confirm: Option<bool>,
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index d7d122c3252..cc2540aa221 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -99,7 +99,6 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
merchant_account,
self.request.payment_method_type,
key_store,
- is_mandate,
))
.await?;
Ok(mandate::mandate_procedure(
@@ -131,7 +130,6 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
&merchant_account,
self.request.payment_method_type,
&key_store,
- is_mandate,
))
.await;
@@ -294,6 +292,9 @@ impl mandate::MandateBehaviour for types::PaymentsAuthorizeData {
fn set_mandate_id(&mut self, new_mandate_id: Option<api_models::payments::MandateIds>) {
self.mandate_id = new_mandate_id;
}
+ fn get_customer_acceptance(&self) -> Option<api_models::payments::CustomerAcceptance> {
+ self.customer_acceptance.clone().map(From::from)
+ }
}
pub async fn authorize_preprocessing_steps<F: Clone>(
diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
index 3f43204b986..71d43989336 100644
--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -98,7 +98,7 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
)
.await
.to_setup_mandate_failed_response()?;
- let is_mandate = resp.request.setup_mandate_details.is_some();
+
let pm_id = Box::pin(tokenization::save_payment_method(
state,
connector,
@@ -107,7 +107,6 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
merchant_account,
self.request.payment_method_type,
key_store,
- is_mandate,
))
.await?;
mandate::mandate_procedure(
@@ -234,8 +233,6 @@ impl types::SetupMandateRouterData {
let payment_method_type = self.request.payment_method_type;
- let is_mandate = resp.request.setup_mandate_details.is_some();
-
let pm_id = Box::pin(tokenization::save_payment_method(
state,
connector,
@@ -244,7 +241,6 @@ impl types::SetupMandateRouterData {
merchant_account,
payment_method_type,
key_store,
- is_mandate,
))
.await?;
@@ -320,7 +316,6 @@ impl types::SetupMandateRouterData {
)
.await
.to_setup_mandate_failed_response()?;
- let is_mandate = resp.request.setup_mandate_details.is_some();
let pm_id = Box::pin(tokenization::save_payment_method(
state,
connector,
@@ -329,7 +324,6 @@ impl types::SetupMandateRouterData {
merchant_account,
self.request.payment_method_type,
key_store,
- is_mandate,
))
.await?;
let mandate = state
@@ -430,6 +424,9 @@ impl mandate::MandateBehaviour for types::SetupMandateRequestData {
fn get_setup_mandate_details(&self) -> Option<&data_models::mandates::MandateData> {
self.setup_mandate_details.as_ref()
}
+ fn get_customer_acceptance(&self) -> Option<api_models::payments::CustomerAcceptance> {
+ self.customer_acceptance.clone().map(From::from)
+ }
}
impl TryFrom<types::SetupMandateRequestData> for types::PaymentMethodTokenizationData {
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index d158a4bc942..eb476cfccdd 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -825,16 +825,6 @@ fn validate_new_mandate_request(
.clone()
.get_required_value("mandate_data")?;
- if api_enums::FutureUsage::OnSession
- == req
- .setup_future_usage
- .get_required_value("setup_future_usage")?
- {
- Err(report!(errors::ApiErrorResponse::PreconditionFailed {
- message: "`setup_future_usage` must be `off_session` for mandates".into()
- }))?
- };
-
// Only use this validation if the customer_acceptance is present
if mandate_data
.customer_acceptance
@@ -3862,3 +3852,17 @@ pub fn validate_session_expiry(session_expiry: u32) -> Result<(), errors::ApiErr
Ok(())
}
}
+
+// This function validates the mandate_data with its setup_future_usage
+pub fn validate_mandate_data_and_future_usage(
+ setup_future_usages: Option<api_enums::FutureUsage>,
+ mandate_details_present: bool,
+) -> Result<(), errors::ApiErrorResponse> {
+ if Some(api_enums::FutureUsage::OnSession) == setup_future_usages && mandate_details_present {
+ Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "`setup_future_usage` must be `off_session` for mandates".into(),
+ })
+ } else {
+ Ok(())
+ }
+}
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index caca29d8e2a..a38c7bbdd3c 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -147,6 +147,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: None,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 097b7ab40e1..1b09e9abce5 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -155,6 +155,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: None,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index e9d520e4abc..4a488a07eb3 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -200,6 +200,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: None,
address: payments::PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index f7e7598cf73..395f8e59dbc 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -215,6 +215,12 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
// The operation merges mandate data from both request and payment_attempt
let setup_mandate = setup_mandate.map(Into::into);
+ let mandate_details_present =
+ payment_attempt.mandate_details.is_some() || request.mandate_data.is_some();
+ helpers::validate_mandate_data_and_future_usage(
+ payment_intent.setup_future_usage,
+ mandate_details_present,
+ )?;
let profile_id = payment_intent
.profile_id
.as_ref()
@@ -239,6 +245,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector,
setup_mandate,
+ customer_acceptance: None,
token,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 111f1bed29c..529565c71e8 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -361,6 +361,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "browser_info",
})?;
+ let customer_acceptance = request.customer_acceptance.clone().map(From::from);
helpers::validate_card_data(
request
@@ -461,6 +462,12 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
sm
});
+ let mandate_details_present =
+ payment_attempt.mandate_details.is_some() || request.mandate_data.is_some();
+ helpers::validate_mandate_data_and_future_usage(
+ payment_intent.setup_future_usage,
+ mandate_details_present,
+ )?;
let n_request_payment_method_data = request
.payment_method_data
.as_ref()
@@ -539,6 +546,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector,
setup_mandate,
+ customer_acceptance,
token,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 3ba7092aeac..5ec8bfaf550 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -281,6 +281,12 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
payment_id: payment_id.clone(),
})?;
+ let mandate_details_present = payment_attempt.mandate_details.is_some();
+
+ helpers::validate_mandate_data_and_future_usage(
+ request.setup_future_usage,
+ mandate_details_present,
+ )?;
// connector mandate reference update history
let mandate_id = request
.mandate_id
@@ -355,6 +361,8 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
// The operation merges mandate data from both request and payment_attempt
let setup_mandate = setup_mandate.map(MandateData::from);
+ let customer_acceptance = request.customer_acceptance.clone().map(From::from);
+
let surcharge_details = request.surcharge_details.map(|request_surcharge_details| {
payments::types::SurchargeDetails::from((&request_surcharge_details, &payment_attempt))
});
@@ -368,6 +376,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.payment_method_data
.apply_additional_payment_data(additional_payment_data)
});
+
let amount = payment_attempt.get_total_amount().into();
let payment_data = PaymentData {
flow: PhantomData,
@@ -379,6 +388,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id,
mandate_connector,
setup_mandate,
+ customer_acceptance,
token,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 281ffdd06f7..a1416ea1908 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -143,6 +143,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: None,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 966600a5498..ed3eda8832b 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -167,6 +167,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
email: None,
mandate_id: None,
mandate_connector: None,
+ customer_acceptance: None,
token: None,
setup_mandate: None,
address: payments::PaymentAddress {
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 2ca413b73aa..650fef7e1bf 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -145,6 +145,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: payment_attempt.payment_token.clone(),
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index aa622b3558b..70f04ed364d 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -414,6 +414,7 @@ async fn get_tracker_for_sync<
}),
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: None,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 080667f4b48..81efdbabc4c 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -349,7 +349,12 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
// The operation merges mandate data from both request and payment_attempt
let setup_mandate = setup_mandate.map(Into::into);
-
+ let mandate_details_present =
+ payment_attempt.mandate_details.is_some() || request.mandate_data.is_some();
+ helpers::validate_mandate_data_and_future_usage(
+ payment_intent.setup_future_usage,
+ mandate_details_present,
+ )?;
let profile_id = payment_intent
.profile_id
.as_ref()
@@ -363,7 +368,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
id: profile_id.to_string(),
})?;
-
+ let customer_acceptance = request.customer_acceptance.clone().map(From::from);
let surcharge_details = request.surcharge_details.map(|request_surcharge_details| {
payments::types::SurchargeDetails::from((&request_surcharge_details, &payment_attempt))
});
@@ -379,6 +384,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_connector,
token,
setup_mandate,
+ customer_acceptance,
address: PaymentAddress {
shipping: shipping_address.as_ref().map(|a| a.into()),
billing: billing_address.as_ref().map(|a| a.into()),
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index 24292507c0e..96cbf9fb9db 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -120,6 +120,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
mandate_id: None,
mandate_connector: None,
setup_mandate: None,
+ customer_acceptance: None,
token: None,
address: PaymentAddress {
billing: None,
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 1f793e2e185..943550ef434 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -1,6 +1,9 @@
use api_models::payment_methods::PaymentMethodsData;
use common_enums::PaymentMethod;
-use common_utils::{ext_traits::ValueExt, pii};
+use common_utils::{
+ ext_traits::{Encode, ValueExt},
+ pii,
+};
use error_stack::{report, ResultExt};
use masking::ExposeInterface;
use router_env::{instrument, tracing};
@@ -34,7 +37,6 @@ pub async fn save_payment_method<F: Clone, FData>(
merchant_account: &domain::MerchantAccount,
payment_method_type: Option<storage_enums::PaymentMethodType>,
key_store: &domain::MerchantKeyStore,
- is_mandate: bool,
) -> RouterResult<Option<String>>
where
FData: mandate::MandateBehaviour,
@@ -67,16 +69,24 @@ where
} else {
None
};
- let future_usage_validation = resp
+
+ let mandate_data_customer_acceptance = resp
.request
- .get_setup_future_usage()
- .map(|future_usage| {
- (future_usage == storage_enums::FutureUsage::OffSession && is_mandate)
- || (future_usage == storage_enums::FutureUsage::OnSession && !is_mandate)
- })
- .unwrap_or(false);
+ .get_setup_mandate_details()
+ .and_then(|mandate_data| mandate_data.customer_acceptance.clone());
+
+ let customer_acceptance = resp
+ .request
+ .get_customer_acceptance()
+ .or(mandate_data_customer_acceptance.clone().map(From::from))
+ .map(|ca| ca.encode_to_value())
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to serialize customer acceptance to value")?;
- let pm_id = if future_usage_validation {
+ let pm_id = if resp.request.get_setup_future_usage().is_some()
+ && customer_acceptance.is_some()
+ {
let customer = maybe_customer.to_owned().get_required_value("customer")?;
let payment_method_create_request = helpers::get_payment_method_create_request(
Some(&resp.request.get_payment_method_data()),
@@ -181,6 +191,7 @@ where
locker_id,
merchant_id,
pm_metadata,
+ customer_acceptance,
pm_data_encrypted,
key_store,
)
@@ -243,6 +254,7 @@ where
&merchant_account.merchant_id,
&customer.customer_id,
resp.metadata.clone().map(|val| val.expose()),
+ customer_acceptance,
locker_id,
)
.await
@@ -357,6 +369,7 @@ where
locker_id,
merchant_id,
pm_metadata,
+ customer_acceptance,
pm_data_encrypted,
key_store,
)
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 7c7bac80cf0..8ccab155c69 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1141,6 +1141,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
| Some(RequestIncrementalAuthorization::Default)
),
metadata: additional_data.payment_data.payment_intent.metadata,
+ customer_acceptance: payment_data.customer_acceptance,
})
}
}
@@ -1436,6 +1437,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
off_session: payment_data.mandate_id.as_ref().map(|_| true),
mandate_id: payment_data.mandate_id.clone(),
setup_mandate_details: payment_data.setup_mandate,
+ customer_acceptance: payment_data.customer_acceptance,
router_return_url,
email: payment_data.email,
customer_name,
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index fcd2569ea99..7005e955dff 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -382,6 +382,7 @@ pub async fn save_payout_data_to_locker(
Some(stored_resp.card_reference),
&merchant_account.merchant_id,
None,
+ None,
card_details_encrypted,
key_store,
)
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 07691879d4a..106872fb43f 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -24,7 +24,7 @@ pub use api_models::{
use common_enums::MandateStatus;
pub use common_utils::request::{RequestBody, RequestContent};
use common_utils::{pii, pii::Email};
-use data_models::mandates::MandateData;
+use data_models::mandates::{CustomerAcceptance, MandateData};
use error_stack::{IntoReport, ResultExt};
use masking::Secret;
use serde::Serialize;
@@ -408,6 +408,7 @@ pub struct PaymentsAuthorizeData {
pub setup_future_usage: Option<storage_enums::FutureUsage>,
pub mandate_id: Option<api_models::payments::MandateIds>,
pub off_session: Option<bool>,
+ pub customer_acceptance: Option<CustomerAcceptance>,
pub setup_mandate_details: Option<MandateData>,
pub browser_info: Option<BrowserInformation>,
pub order_details: Option<Vec<api_models::payments::OrderDetailsWithAmount>>,
@@ -584,6 +585,7 @@ pub struct SetupMandateRequestData {
pub amount: Option<i64>,
pub confirm: bool,
pub statement_descriptor_suffix: Option<String>,
+ pub customer_acceptance: Option<CustomerAcceptance>,
pub mandate_id: Option<api_models::payments::MandateIds>,
pub setup_future_usage: Option<storage_enums::FutureUsage>,
pub off_session: Option<bool>,
@@ -1423,6 +1425,7 @@ impl From<&SetupMandateRouterData> for PaymentsAuthorizeData {
surcharge_details: None,
request_incremental_authorization: data.request.request_incremental_authorization,
metadata: None,
+ customer_acceptance: data.request.customer_acceptance.clone(),
}
}
}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index 221d16a8b46..4f3d6f7e296 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -50,6 +50,7 @@ impl VerifyConnectorData {
related_transaction_id: None,
statement_descriptor_suffix: None,
request_incremental_authorization: false,
+ customer_acceptance: None,
}
}
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index d3f8147fb26..5c4660805fb 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -72,6 +72,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
},
response: Err(types::ErrorResponse::default()),
payment_method_id: None,
diff --git a/crates/router/tests/connectors/adyen.rs b/crates/router/tests/connectors/adyen.rs
index 12812a70857..55f9f6b4b6b 100644
--- a/crates/router/tests/connectors/adyen.rs
+++ b/crates/router/tests/connectors/adyen.rs
@@ -170,6 +170,7 @@ impl AdyenTest {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
}
diff --git a/crates/router/tests/connectors/bitpay.rs b/crates/router/tests/connectors/bitpay.rs
index d24e20cd660..93043f37c9b 100644
--- a/crates/router/tests/connectors/bitpay.rs
+++ b/crates/router/tests/connectors/bitpay.rs
@@ -96,6 +96,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs
index a9d81d2bb62..7dd70d86695 100644
--- a/crates/router/tests/connectors/cashtocode.rs
+++ b/crates/router/tests/connectors/cashtocode.rs
@@ -70,6 +70,7 @@ impl CashtocodeTest {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
diff --git a/crates/router/tests/connectors/coinbase.rs b/crates/router/tests/connectors/coinbase.rs
index 7a872ecb585..b1fffb302cb 100644
--- a/crates/router/tests/connectors/coinbase.rs
+++ b/crates/router/tests/connectors/coinbase.rs
@@ -98,6 +98,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
diff --git a/crates/router/tests/connectors/cryptopay.rs b/crates/router/tests/connectors/cryptopay.rs
index d61a93c8b82..6eaf514db21 100644
--- a/crates/router/tests/connectors/cryptopay.rs
+++ b/crates/router/tests/connectors/cryptopay.rs
@@ -96,6 +96,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
diff --git a/crates/router/tests/connectors/opennode.rs b/crates/router/tests/connectors/opennode.rs
index 8415be949a0..4702012597e 100644
--- a/crates/router/tests/connectors/opennode.rs
+++ b/crates/router/tests/connectors/opennode.rs
@@ -97,6 +97,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 8f749a0b2ff..83380f76073 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -915,6 +915,7 @@ impl Default for PaymentAuthorizeType {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
};
Self(data)
}
diff --git a/crates/router/tests/connectors/worldline.rs b/crates/router/tests/connectors/worldline.rs
index c5b12a0b0b2..ba946b296bf 100644
--- a/crates/router/tests/connectors/worldline.rs
+++ b/crates/router/tests/connectors/worldline.rs
@@ -106,6 +106,7 @@ impl WorldlineTest {
surcharge_details: None,
request_incremental_authorization: false,
metadata: None,
+ customer_acceptance: None,
})
}
}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index ac90185dacf..781e121a5b0 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -12724,6 +12724,14 @@
],
"nullable": true
},
+ "customer_acceptance": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CustomerAcceptance"
+ }
+ ],
+ "nullable": true
+ },
"mandate_id": {
"type": "string",
"description": "A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data",
@@ -13081,6 +13089,14 @@
],
"nullable": true
},
+ "customer_acceptance": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CustomerAcceptance"
+ }
+ ],
+ "nullable": true
+ },
"mandate_id": {
"type": "string",
"description": "A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data",
@@ -13562,6 +13578,14 @@
],
"nullable": true
},
+ "customer_acceptance": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CustomerAcceptance"
+ }
+ ],
+ "nullable": true
+ },
"mandate_id": {
"type": "string",
"description": "A unique identifier to link the payment to a mandate. To do Recurring payments after a mandate has been created, pass the mandate_id instead of payment_method_data",
@@ -14572,6 +14596,14 @@
],
"nullable": true
},
+ "customer_acceptance": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CustomerAcceptance"
+ }
+ ],
+ "nullable": true
+ },
"browser_info": {
"allOf": [
{
diff --git a/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json b/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json
index f7573b64a60..9988d0e2cb1 100644
--- a/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
index b66df150887..9570f0f0b8d 100644
--- a/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/aci/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"shipping": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/aci/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/aci/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
index f7573b64a60..9988d0e2cb1 100644
--- a/postman/collection-dir/aci/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
+++ b/postman/collection-dir/aci/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
index 80dad74bb60..0bf892efdf5 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
@@ -60,6 +60,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json
index 08e62dca6e9..a515beb2661 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json
@@ -60,6 +60,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"shipping": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/request.json
index 21c079e0ad0..eecdf810746 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario16-Bank debit-ach/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/request.json
index 1ec9a829a48..660ef06c518 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario17-Bank debit-Bacs/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
index 9260edb1a99..397f164511f 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario19-Add card flow/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
@@ -89,12 +97,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
index 9260edb1a99..397f164511f 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario20-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
@@ -89,12 +97,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
index 9260edb1a99..397f164511f 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
@@ -89,12 +97,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
index 93e802128f2..40a78911a9a 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario11-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario11-Create a recurring payment with greater mandate amount/Payments - Create/request.json
index e3d19912b79..d152474c374 100644
--- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario11-Create a recurring payment with greater mandate amount/Payments - Create/request.json
+++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario11-Create a recurring payment with greater mandate amount/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
index e37391b78b5..43eb0c9cc12 100644
--- a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
@@ -87,12 +95,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/nmi/Flow Testcases/Happy Cases/Scenario12-Add card flow/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Add card flow/Payments - Create/request.json
index 056b9269a29..d0320b09975 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario12-Add card flow/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
index 1d85fee7356..fe4adccda47 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json
index 73457bf3197..aaa993e4eef 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario15-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario15-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
index ffda1aef2d7..050f353af53 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario15-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario15-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
index 97cce7936c4..63d1eeba233 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
index 9699acd8bb3..962144d6bc6 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
@@ -57,6 +57,14 @@
}
},
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
index 9699acd8bb3..962144d6bc6 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
@@ -57,6 +57,14 @@
}
},
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
diff --git a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount Copy/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount Copy/Payments - Create/request.json
index 7aeaf601cc6..2cbfe4a20f1 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount Copy/Payments - Create/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount Copy/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario6-Create Wallet - Paypal/Payments - Create/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario6-Create Wallet - Paypal/Payments - Create/request.json
index 824bfb49230..7201fa121be 100644
--- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario6-Create Wallet - Paypal/Payments - Create/request.json
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario6-Create Wallet - Paypal/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/request.json
index efa17534b1d..f5da408b2f3 100644
--- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/request.json
@@ -45,6 +45,14 @@
"wallet": {
"paypal_redirect": {}
}
+ },
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
}
}
},
diff --git a/postman/collection-dir/shift4/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/shift4/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
index 57d625e7c39..fbbd60339e9 100644
--- a/postman/collection-dir/shift4/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
+++ b/postman/collection-dir/shift4/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
index 93bcc23194f..9d0fac32c1f 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
index 3ffbe03a605..b5ef6b1afe2 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Create a mandate and recurring payment/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
@@ -98,12 +106,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
index 9df18b5e886..61f007ede68 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"shipping": {
"address": {
"line1": "1467",
@@ -86,12 +94,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
index eda0801c9cc..78d949505f4 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
@@ -23,9 +23,7 @@
"confirm": true,
"business_label": "default",
"capture_method": "automatic",
- "connector": [
- "stripe"
- ],
+ "connector": ["stripe"],
"customer_id": "klarna",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "three_ds",
@@ -55,6 +53,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "online",
+ "accepted_at": "2022-09-10T10:11:12Z",
+ "online": {
+ "ip_address": "123.32.25.123",
+ "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36"
+ }
+ },
"payment_method": "bank_debit",
"payment_method_type": "ach",
"payment_method_data": {
@@ -85,12 +91,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/request.json
index 20b99223ac4..43515f184b5 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Confirm/request.json
@@ -52,6 +52,7 @@
}
}
},
+ "setup_future_usage": "off_session",
"mandate_data": {
"customer_acceptance": {
"acceptance_type": "offline",
@@ -73,7 +74,14 @@
}
}
},
- "setup_future_usage": "off_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
@@ -90,14 +98,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id",
- "confirm"
- ],
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id", "confirm"],
"variable": [
{
"key": "id",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json
index 785122a83c5..beeb5b3983f 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json
@@ -71,12 +71,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
index 2b86201e2fe..1b1757b9a49 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
@@ -57,6 +57,14 @@
}
},
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json
index 2019bae8790..2ac0cacfb99 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
@@ -93,12 +101,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
index 4f02f7b6809..150106cfded 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
@@ -93,12 +101,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json
index 988bc4b800b..d73166871cd 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
@@ -93,12 +101,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
index 60e56bb581c..6a9836d232c 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
@@ -87,12 +95,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Happy Cases/Scenario28-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json
index d14ae6582c8..7e28058ccf6 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json
@@ -35,6 +35,14 @@
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_data": {
"card": {
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json
index d14ae6582c8..7e28058ccf6 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_data": {
"card": {
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
index 6d1bc5e0a0d..a3e0f52b8d7 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario8-Create a failure card payment with confirm true/Payments - Create/request.json
@@ -35,6 +35,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
@@ -87,12 +95,8 @@
},
"url": {
"raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "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/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
index a5c9391cf74..b5ef6b1afe2 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json
@@ -59,6 +59,14 @@
}
}
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json b/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json
index ac22dac750c..cc330f3c8f7 100644
--- a/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json
@@ -33,6 +33,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
index 7afc6d61c49..fd84bcaadb5 100644
--- a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
index 778f8872687..2f295eba3a8 100644
--- a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Confirm/request.json
@@ -51,6 +51,14 @@
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"order_details": [
{
"amount": 6540,
@@ -60,6 +68,7 @@
]
}
},
+
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
"host": ["{{baseUrl}}"],
diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
index a6aef6ecb71..042a4bc1f73 100644
--- a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
index ee354325323..bed15211eea 100644
--- a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario4-Create 3DS payment/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "off_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"order_details": [
{
"amount": 6540,
diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json
index 01fa4013653..91a932b12d9 100644
--- a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
diff --git a/postman/collection-dir/zen/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/QuickStart/Payments - Create/request.json
index ee354325323..aa51751ae1e 100644
--- a/postman/collection-dir/zen/Flow Testcases/QuickStart/Payments - Create/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/QuickStart/Payments - Create/request.json
@@ -31,7 +31,15 @@
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
- "setup_future_usage": "off_session",
+ "setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"order_details": [
{
"amount": 6540,
diff --git a/postman/collection-dir/zen/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json
index a6aef6ecb71..042a4bc1f73 100644
--- a/postman/collection-dir/zen/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json
+++ b/postman/collection-dir/zen/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json
@@ -32,6 +32,14 @@
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"setup_future_usage": "on_session",
+ "customer_acceptance": {
+ "acceptance_type": "offline",
+ "accepted_at": "1963-05-03T04:07:52.723Z",
+ "online": {
+ "ip_address": "127.0.0.1",
+ "user_agent": "amet irure esse"
+ }
+ },
"billing": {
"address": {
"line1": "1467",
|
feat
|
store customer_acceptance in the payment_methods table (#3885)
|
962b9978d651e3cc9185b2f6f849c7f255868077
|
2024-09-26 05:54:27
|
github-actions
|
chore(version): 2024.09.26.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a144f31820..47883c05b25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.09.26.0
+
+### Features
+
+- **router:** Add payment_intent_data and modify api models of create intent request and response for v2 ([#6016](https://github.com/juspay/hyperswitch/pull/6016)) ([`9a605af`](https://github.com/juspay/hyperswitch/commit/9a605afe372a0602127090da59e35ac9ca7396e1))
+
+### Bug Fixes
+
+- **api_key:** Fix api key `list` and `update` endpoints for v2 ([#5980](https://github.com/juspay/hyperswitch/pull/5980)) ([`cda690b`](https://github.com/juspay/hyperswitch/commit/cda690bf39bc1c26634ed8ba07539196bed59257))
+- **connector:** Pass Samsung Pay `public_key_hash` in the confirm call ([#6017](https://github.com/juspay/hyperswitch/pull/6017)) ([`4eec6ca`](https://github.com/juspay/hyperswitch/commit/4eec6ca4b05202dea1f5400007c5f143142b65e4))
+
+### Miscellaneous Tasks
+
+- **nix:** Unbreak `flake.nix` ([#5867](https://github.com/juspay/hyperswitch/pull/5867)) ([`4dac86c`](https://github.com/juspay/hyperswitch/commit/4dac86cebfc098dba84b4b1dfedb5712ce04e913))
+- Address some clippy lints arising from v2 code ([#6015](https://github.com/juspay/hyperswitch/pull/6015)) ([`dec0a57`](https://github.com/juspay/hyperswitch/commit/dec0a57f76991e584462a16d9fbdfbc442d08bd5))
+
+**Full Changelog:** [`2024.09.25.0...2024.09.26.0`](https://github.com/juspay/hyperswitch/compare/2024.09.25.0...2024.09.26.0)
+
+- - -
+
## 2024.09.25.0
### Features
|
chore
|
2024.09.26.0
|
35666f57bff0aed60c6e06efeeefa94ff15681c9
|
2024-08-29 19:38:29
|
Gnanasundari24
|
fix(cypress): fix compilation errors due to filename mismatch (#5740)
| false
|
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
index 9641e297582..09f237d7d47 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
@@ -1,6 +1,6 @@
import * as fixtures from "../../fixtures/imports";
import State from "../../utils/State";
-import * as utils from "../RoutingUtils/utils";
+import * as utils from "../RoutingUtils/Utils";
let globalState;
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
index 6ddd4c12c6f..e0b1ee589de 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
@@ -1,6 +1,6 @@
import * as fixtures from "../../fixtures/imports";
import State from "../../utils/State";
-import * as utils from "../RoutingUtils/utils";
+import * as utils from "../RoutingUtils/Utils";
let globalState;
@@ -39,7 +39,7 @@ describe("Volume Based Routing Test", () => {
});
});
- afterEach("flush global state", () => {
+ after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
@@ -166,7 +166,7 @@ describe("Volume Based Routing Test", () => {
});
});
- afterEach("flush global state", () => {
+ after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
it("list-mca-by-mid", () => {
diff --git a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
index b8a85f38049..320c5ed8393 100644
--- a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
+++ b/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
@@ -1,10 +1,12 @@
import * as fixtures from "../../fixtures/imports";
import State from "../../utils/State";
-import * as utils from "../RoutingUtils/utils";
+import * as utils from "../RoutingUtils/Utils";
let globalState;
describe("Rule Based Routing Test", () => {
+ let should_continue = true;
+
context("Create Jwt Token", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
|
fix
|
fix compilation errors due to filename mismatch (#5740)
|
81e3d9df901d1b874dcbd5cd01f0b5532ae981a1
|
2024-10-03 15:51:07
|
DEEPANSHU BANSAL
|
fix(bug): [IATAPAY] Fix PCM value for UPI_COLLECT (#6207)
| false
|
diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs
index fde80abd259..9f3cb9fe6e8 100644
--- a/crates/router/src/connector/iatapay/transformers.rs
+++ b/crates/router/src/connector/iatapay/transformers.rs
@@ -85,7 +85,7 @@ pub struct PayerInfo {
#[derive(Debug, Serialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum PreferredCheckoutMethod {
- Vpa,
+ Vpa, //Passing this in UPI_COLLECT will trigger an S2S payment call which is not required.
Qr,
}
@@ -102,6 +102,7 @@ pub struct IatapayPaymentsRequest {
notification_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
payer_info: Option<PayerInfo>,
+ #[serde(skip_serializing_if = "Option::is_none")]
preferred_checkout_method: Option<PreferredCheckoutMethod>,
}
@@ -137,7 +138,7 @@ impl
upi_data.vpa_id.map(|id| PayerInfo {
token_id: id.switch_strategy(),
}),
- Some(PreferredCheckoutMethod::Vpa),
+ None,
),
domain::UpiData::UpiIntent(_) => (
common_enums::CountryAlpha2::IN,
|
fix
|
[IATAPAY] Fix PCM value for UPI_COLLECT (#6207)
|
7a1651d26b553112e098d55f54653859fa794782
|
2024-07-04 05:46:53
|
github-actions
|
chore(version): 2024.07.04.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bf81a70889..87c3c587ddd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,21 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.07.04.0
+
+### Features
+
+- **pm_auth:** Added balance check for PM auth bank account ([#5054](https://github.com/juspay/hyperswitch/pull/5054)) ([`f513c8e`](https://github.com/juspay/hyperswitch/commit/f513c8e4daa95a6ceb89ce616e3d55058708fb2a))
+
+### Refactors
+
+- **migrations:** Add commands to make file to run migrations for api v2 ([#5169](https://github.com/juspay/hyperswitch/pull/5169)) ([`ff23e2f`](https://github.com/juspay/hyperswitch/commit/ff23e2f7d3de77cbb03a837de20e1435d1632d68))
+- **payment_methods:** Add appropriate missing logs ([#5190](https://github.com/juspay/hyperswitch/pull/5190)) ([`e85407f`](https://github.com/juspay/hyperswitch/commit/e85407fc5344e983732077d4fdcae85ad59bfd10))
+
+**Full Changelog:** [`2024.07.03.0...2024.07.04.0`](https://github.com/juspay/hyperswitch/compare/2024.07.03.0...2024.07.04.0)
+
+- - -
+
## 2024.07.03.0
### Features
|
chore
|
2024.07.04.0
|
0d5c6faae06c9e6e793a271c121a43818fb3e53f
|
2025-02-14 19:48:02
|
Anurag
|
fix(cypress): Resolve cypress issue for NMI connector (#7267)
| false
|
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
index d39b45172af..501aa4d3fde 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
@@ -114,7 +114,7 @@ export const connectorDetails = {
Response: {
status: 200,
body: {
- status: "processing",
+ status: "requires_capture",
},
},
},
@@ -308,7 +308,7 @@ export const connectorDetails = {
Response: {
status: 200,
body: {
- status: "processing",
+ status: "requires_capture",
},
},
},
|
fix
|
Resolve cypress issue for NMI connector (#7267)
|
1d73be08fb3a747ab22ee42eed9f396d78a949dd
|
2023-09-22 12:24:36
|
Hrithikesh
|
fix(connector): fix dispute webhook failure bug in checkout during get_webhook_resource_object (#2257)
| false
|
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index 332de31330d..0c1ab2493d6 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -1217,7 +1217,7 @@ impl api::IncomingWebhook for Checkout {
.parse_struct("CheckoutWebhookBody")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
let resource_object = if checkout::is_chargeback_event(&event_type_data.transaction_type)
- && checkout::is_refund_event(&event_type_data.transaction_type)
+ || checkout::is_refund_event(&event_type_data.transaction_type)
{
// if other event, just return the json data.
let resource_object_data: checkout::CheckoutWebhookObjectResource = request
|
fix
|
fix dispute webhook failure bug in checkout during get_webhook_resource_object (#2257)
|
b760cba5460395487c63ea4363665b0d7e5a6118
|
2023-05-08 19:42:30
|
SamraatBansal
|
fix(connector): [ACI] Add amount currency conversion and update error codes (#1065)
| false
|
diff --git a/crates/router/src/connector/aci/result_codes.rs b/crates/router/src/connector/aci/result_codes.rs
index 1fae4079646..84502c46ee6 100644
--- a/crates/router/src/connector/aci/result_codes.rs
+++ b/crates/router/src/connector/aci/result_codes.rs
@@ -1,4 +1,4 @@
-pub(super) const FAILURE_CODES: [&str; 499] = [
+pub(super) const FAILURE_CODES: [&str; 501] = [
"100.370.100",
"100.370.110",
"100.370.111",
@@ -10,6 +10,8 @@ pub(super) const FAILURE_CODES: [&str; 499] = [
"100.380.306",
"100.380.401",
"100.380.501",
+ "100.395.502",
+ "100.396.101",
"100.400.000",
"100.400.001",
"100.400.002",
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index e4eb7a15854..acb17849299 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};
use super::result_codes::{FAILURE_CODES, PENDING_CODES, SUCCESSFUL_CODES};
use crate::{
+ connector::utils,
core::errors,
services,
types::{self, api, storage::enums},
@@ -35,7 +36,7 @@ impl TryFrom<&types::ConnectorAuthType> for AciAuthType {
#[serde(rename_all = "camelCase")]
pub struct AciPaymentsRequest {
pub entity_id: String,
- pub amount: i64,
+ pub amount: String,
pub currency: String,
pub payment_type: AciPaymentType,
#[serde(flatten)]
@@ -200,7 +201,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
let aci_payment_request = Self {
payment_method: payment_details,
entity_id: auth.entity_id,
- amount: item.request.amount,
+ amount: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
currency: item.request.currency.to_string(),
payment_type: AciPaymentType::Debit,
};
@@ -349,7 +350,7 @@ impl<F, T>
#[derive(Default, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AciRefundRequest {
- pub amount: i64,
+ pub amount: String,
pub currency: String,
pub payment_type: AciPaymentType,
pub entity_id: String,
@@ -358,7 +359,8 @@ pub struct AciRefundRequest {
impl<F> TryFrom<&types::RefundsRouterData<F>> for AciRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
- let amount = item.request.refund_amount;
+ let amount =
+ utils::to_currency_base_unit(item.request.refund_amount, item.request.currency)?;
let currency = item.request.currency;
let payment_type = AciPaymentType::Refund;
let auth = AciAuthType::try_from(&item.connector_auth_type)?;
|
fix
|
[ACI] Add amount currency conversion and update error codes (#1065)
|
fa7add19eeb09f8ab12970fa8ed66270f45883c3
|
2024-07-10 12:11:25
|
github-actions
|
chore(version): 2024.07.10.1
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3eaba4e9705..3efc332fa0d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.07.10.1
+
+### Refactors
+
+- **connector:** Wasm changes for razorpay ([#5265](https://github.com/juspay/hyperswitch/pull/5265)) ([`c016407`](https://github.com/juspay/hyperswitch/commit/c0164076881a0ce561ced98e7da61bf6904ba60b))
+
+**Full Changelog:** [`2024.07.10.0...2024.07.10.1`](https://github.com/juspay/hyperswitch/compare/2024.07.10.0...2024.07.10.1)
+
+- - -
+
## 2024.07.10.0
### Features
|
chore
|
2024.07.10.1
|
e79524b295544a959ec4c0dbdb71e5538adebc9d
|
2024-05-15 16:44:04
|
preetamrevankar
|
ci(cypress): Added 3DS Refund flow (#4635)
| false
|
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
index d45aa6dfec9..68ce768b417 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
@@ -342,3 +342,318 @@ describe("Card - Refund flow test", () => {
});
});
+
+
+ context("Card - Full Refund flow test for 3DS", () => {
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm 3DS", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 6500, det, globalState);
+ });
+ });
+
+ context("Card - Partial Refund flow test for 3DS", () => {
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm 3DS", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 1200, det, globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 1200, det, globalState);
+ });
+ });
+
+ context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => {
+
+ it("create+confirm-payment-call-test", () => {
+ console.log("confirm -> " + globalState.get("connectorId"));
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 6540, det, globalState);
+ });
+
+ });
+
+ context("Partially Refund Card-ThreeDS payment flow test Create+Confirm", () => {
+
+ it("create+confirm-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 3000, det, globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 3000, det, globalState);
+ });
+
+ it("sync-refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.syncRefundCallTest(det, globalState);
+ });
+
+ });
+
+ context("Card - Full Refund for fully captured 3DS payment", () => {
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+
+ it("confirm-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 6500, det, globalState);
+ });
+
+ it("sync-refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.syncRefundCallTest(det, globalState);
+ });
+ });
+
+ context("Card - Partial Refund for fully captured 3DS payment", () => {
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("confirm-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 5000, det, globalState);
+ });
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 500, det, globalState);
+ });
+
+ it("sync-refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.syncRefundCallTest(det, globalState);
+ });
+
+ });
+
+ context("Card - Full Refund for partially captured 3DS payment", () => {
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("confirm-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 4000, det, globalState);
+ });
+
+ it("sync-refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.syncRefundCallTest(det, globalState);
+ });
+ });
+
+ context("Card - partial Refund for partially captured 3DS payment", () => {
+
+ it("create-payment-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("confirm-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.confirmCallTest(confirmBody, det, true, globalState);
+ });
+
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ })
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("capture-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.refundCallTest(refundBody, 3000, det, globalState);
+ });
+
+ it("sync-refund-call-test", () => {
+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
+ cy.syncRefundCallTest(det, globalState);
+ });
+ });
+
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
index d92b66e965f..92b5f50981a 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js
@@ -40,7 +40,7 @@ card_pm:{
"MandateSingleUse3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
index 540152eb6c3..523e6003ae5 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js
@@ -39,7 +39,7 @@ card_pm:{
"MandateSingleUse3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",
diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
index ec81ddc20c7..c200adf64c5 100644
--- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js
@@ -39,7 +39,7 @@ card_pm:{
"MandateSingleUse3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
- "paymentSuccessfulStatus": "requires_customer_action",
+ "paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",
diff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.json
index e75aab9d00f..c96284ea99b 100644
--- a/cypress-tests/cypress/fixtures/create-mandate-cit.json
+++ b/cypress-tests/cypress/fixtures/create-mandate-cit.json
@@ -11,7 +11,7 @@
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
- "return_url": "https://duck.com",
+ "return_url": "https://hyperswitch.io",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index e6518f70257..3eeeb5a1454 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -498,6 +498,7 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, co
expect(response.body).to.have.property("next_action")
.to.have.property("redirect_to_url");
const nextActionUrl = response.body.next_action.redirect_to_url;
+ globalState.set("nextActionUrl", response.body.next_action.redirect_to_url);
cy.log(response.body);
cy.log(nextActionUrl);
} else if (response.body.authentication_type === "no_three_ds") {
|
ci
|
Added 3DS Refund flow (#4635)
|
1ac8c92c4bd2259cdd8bf755210bcb3c0eb31472
|
2024-10-14 15:41:56
|
Riddhiagrawal001
|
feat(payments): support for card_network filter in payments list (#5994)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index cda790b5959..c7c998cc2b0 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -4389,6 +4389,8 @@ pub struct PaymentListFilterConstraints {
/// The order in which payments list should be sorted
#[serde(default)]
pub order: Order,
+ /// The List of all the card networks to filter payments list
+ pub card_network: Option<Vec<enums::CardNetwork>>,
}
#[derive(Clone, Debug, serde::Serialize)]
pub struct PaymentListFilters {
@@ -4418,6 +4420,8 @@ pub struct PaymentListFiltersV2 {
pub payment_method: HashMap<enums::PaymentMethod, HashSet<enums::PaymentMethodType>>,
/// The list of available authentication types
pub authentication_type: Vec<enums::AuthenticationType>,
+ /// The list of available card networks
+ pub card_network: Vec<enums::CardNetwork>,
}
#[derive(Clone, Debug, serde::Serialize)]
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 562e5d205c0..be2b3547110 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -1294,6 +1294,7 @@ pub struct PaymentIntentListParams {
pub ending_before_id: Option<id_type::PaymentId>,
pub limit: Option<u32>,
pub order: api_models::payments::Order,
+ pub card_network: Option<Vec<storage_enums::CardNetwork>>,
}
impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchConstraints {
@@ -1327,6 +1328,7 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCo
ending_before_id: ending_before,
limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V1)),
order: Default::default(),
+ card_network: None,
}))
}
}
@@ -1351,6 +1353,7 @@ impl From<common_utils::types::TimeRange> for PaymentIntentFetchConstraints {
ending_before_id: None,
limit: None,
order: Default::default(),
+ card_network: None,
}))
}
}
@@ -1373,6 +1376,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
authentication_type,
merchant_connector_id,
order,
+ card_network,
} = value;
if let Some(payment_intent_id) = payment_id {
Self::Single { payment_intent_id }
@@ -1395,6 +1399,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentF
ending_before_id: None,
limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V2)),
order,
+ card_network,
}))
}
}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index c581b104739..f148bcdfbfa 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3902,6 +3902,7 @@ pub async fn get_payment_filters(
status: enums::IntentStatus::iter().collect(),
payment_method: payment_method_types_map,
authentication_type: enums::AuthenticationType::iter().collect(),
+ card_network: enums::CardNetwork::iter().collect(),
},
))
}
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 4c7232f6f3f..f5c3deeb18c 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -939,6 +939,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
None => query,
};
+ if let Some(card_network) = ¶ms.card_network {
+ query = query.filter(pa_dsl::card_network.eq_any(card_network.clone()));
+ }
query
}
};
|
feat
|
support for card_network filter in payments list (#5994)
|
ec15ddd0d0ed942fedec525406df3005d494b8d4
|
2023-12-01 19:07:17
|
Apoorv Dixit
|
feat(user): add user_list and switch_list apis (#3033)
| false
|
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index 3ac65830eb8..8b7cd02c935 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -7,7 +7,7 @@ use crate::user::{
GetMetaDataRequest, GetMetaDataResponse, GetMultipleMetaDataPayload, SetMetaDataRequest,
},
ChangePasswordRequest, ConnectAccountRequest, ConnectAccountResponse,
- CreateInternalUserRequest, SwitchMerchantIdRequest, UserMerchantCreate,
+ CreateInternalUserRequest, GetUsersResponse, SwitchMerchantIdRequest, UserMerchantCreate,
};
impl ApiEventMetric for ConnectAccountResponse {
@@ -29,7 +29,8 @@ common_utils::impl_misc_api_event_type!(
SetMetaDataRequest,
SwitchMerchantIdRequest,
CreateInternalUserRequest,
- UserMerchantCreate
+ UserMerchantCreate,
+ GetUsersResponse
);
#[cfg(feature = "dummy_connector")]
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index e6e8546c674..36d730f5118 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -1,5 +1,7 @@
use common_utils::pii;
use masking::Secret;
+
+use crate::user_role::UserStatus;
pub mod dashboard_metadata;
#[cfg(feature = "dummy_connector")]
pub mod sample_data;
@@ -45,3 +47,18 @@ pub struct CreateInternalUserRequest {
pub struct UserMerchantCreate {
pub company_name: String,
}
+
+#[derive(Debug, serde::Serialize)]
+pub struct GetUsersResponse(pub Vec<UserDetails>);
+
+#[derive(Debug, serde::Serialize)]
+pub struct UserDetails {
+ pub user_id: String,
+ pub email: pii::Email,
+ pub name: Secret<String>,
+ pub role_id: String,
+ pub role_name: String,
+ pub status: UserStatus,
+ #[serde(with = "common_utils::custom_serde::iso8601")]
+ pub last_modified_at: time::PrimitiveDateTime,
+}
diff --git a/crates/api_models/src/user_role.rs b/crates/api_models/src/user_role.rs
index 521d17e7342..735cd240b6e 100644
--- a/crates/api_models/src/user_role.rs
+++ b/crates/api_models/src/user_role.rs
@@ -80,3 +80,9 @@ pub struct UpdateUserRoleRequest {
pub user_id: String,
pub role_id: String,
}
+
+#[derive(Debug, serde::Serialize)]
+pub enum UserStatus {
+ Active,
+ InvitationSent,
+}
diff --git a/crates/diesel_models/src/query/dashboard_metadata.rs b/crates/diesel_models/src/query/dashboard_metadata.rs
index 03e4a2dab38..44fd24c7acf 100644
--- a/crates/diesel_models/src/query/dashboard_metadata.rs
+++ b/crates/diesel_models/src/query/dashboard_metadata.rs
@@ -5,7 +5,10 @@ use crate::{
enums,
query::generics,
schema::dashboard_metadata::dsl,
- user::dashboard_metadata::{DashboardMetadata, DashboardMetadataNew},
+ user::dashboard_metadata::{
+ DashboardMetadata, DashboardMetadataNew, DashboardMetadataUpdate,
+ DashboardMetadataUpdateInternal,
+ },
PgPooledConn, StorageResult,
};
@@ -17,6 +20,31 @@ impl DashboardMetadataNew {
}
impl DashboardMetadata {
+ pub async fn update(
+ conn: &PgPooledConn,
+ user_id: Option<String>,
+ merchant_id: String,
+ org_id: String,
+ data_key: enums::DashboardMetadata,
+ dashboard_metadata_update: DashboardMetadataUpdate,
+ ) -> StorageResult<Self> {
+ generics::generic_update_with_unique_predicate_get_result::<
+ <Self as HasTable>::Table,
+ _,
+ _,
+ _,
+ >(
+ conn,
+ dsl::user_id
+ .eq(user_id.to_owned())
+ .and(dsl::merchant_id.eq(merchant_id.to_owned()))
+ .and(dsl::org_id.eq(org_id.to_owned()))
+ .and(dsl::data_key.eq(data_key.to_owned())),
+ DashboardMetadataUpdateInternal::from(dashboard_metadata_update),
+ )
+ .await
+ }
+
pub async fn find_user_scoped_dashboard_metadata(
conn: &PgPooledConn,
user_id: String,
diff --git a/crates/diesel_models/src/query/user.rs b/crates/diesel_models/src/query/user.rs
index aa1d8471d21..b4d5976ba29 100644
--- a/crates/diesel_models/src/query/user.rs
+++ b/crates/diesel_models/src/query/user.rs
@@ -1,13 +1,24 @@
-use diesel::{associations::HasTable, ExpressionMethods};
-use error_stack::report;
-use router_env::tracing::{self, instrument};
+use async_bb8_diesel::AsyncRunQueryDsl;
+use diesel::{
+ associations::HasTable, debug_query, result::Error as DieselError, ExpressionMethods,
+ JoinOnDsl, QueryDsl,
+};
+use error_stack::{report, IntoReport};
+use router_env::{
+ logger,
+ tracing::{self, instrument},
+};
pub mod sample_data;
use crate::{
errors::{self},
query::generics,
- schema::users::dsl,
+ schema::{
+ user_roles::{self, dsl as user_roles_dsl},
+ users::dsl as users_dsl,
+ },
user::*,
+ user_role::UserRole,
PgPooledConn, StorageResult,
};
@@ -22,7 +33,7 @@ impl User {
pub async fn find_by_user_email(conn: &PgPooledConn, user_email: &str) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::email.eq(user_email.to_owned()),
+ users_dsl::email.eq(user_email.to_owned()),
)
.await
}
@@ -30,7 +41,7 @@ impl User {
pub async fn find_by_user_id(conn: &PgPooledConn, user_id: &str) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::user_id.eq(user_id.to_owned()),
+ users_dsl::user_id.eq(user_id.to_owned()),
)
.await
}
@@ -42,7 +53,7 @@ impl User {
) -> StorageResult<Self> {
generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>(
conn,
- dsl::user_id.eq(user_id.to_owned()),
+ users_dsl::user_id.eq(user_id.to_owned()),
UserUpdateInternal::from(user),
)
.await?
@@ -56,8 +67,28 @@ impl User {
pub async fn delete_by_user_id(conn: &PgPooledConn, user_id: &str) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(
conn,
- dsl::user_id.eq(user_id.to_owned()),
+ users_dsl::user_id.eq(user_id.to_owned()),
)
.await
}
+
+ pub async fn find_joined_users_and_roles_by_merchant_id(
+ conn: &PgPooledConn,
+ mid: &str,
+ ) -> StorageResult<Vec<(Self, UserRole)>> {
+ let query = Self::table()
+ .inner_join(user_roles::table.on(user_roles_dsl::user_id.eq(users_dsl::user_id)))
+ .filter(user_roles_dsl::merchant_id.eq(mid.to_owned()));
+
+ logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
+
+ query
+ .get_results_async::<(Self, UserRole)>(conn)
+ .await
+ .into_report()
+ .map_err(|err| match err.current_context() {
+ DieselError::NotFound => err.change_context(errors::DatabaseError::NotFound),
+ _ => err.change_context(errors::DatabaseError::Others),
+ })
+ }
}
diff --git a/crates/diesel_models/src/user/dashboard_metadata.rs b/crates/diesel_models/src/user/dashboard_metadata.rs
index 018808f1c0d..1eeb61d6135 100644
--- a/crates/diesel_models/src/user/dashboard_metadata.rs
+++ b/crates/diesel_models/src/user/dashboard_metadata.rs
@@ -33,3 +33,40 @@ pub struct DashboardMetadataNew {
pub last_modified_by: String,
pub last_modified_at: PrimitiveDateTime,
}
+
+#[derive(
+ router_derive::Setter, Clone, Debug, Insertable, router_derive::DebugAsDisplay, AsChangeset,
+)]
+#[diesel(table_name = dashboard_metadata)]
+pub struct DashboardMetadataUpdateInternal {
+ pub data_key: enums::DashboardMetadata,
+ pub data_value: serde_json::Value,
+ pub last_modified_by: String,
+ pub last_modified_at: PrimitiveDateTime,
+}
+
+pub enum DashboardMetadataUpdate {
+ UpdateData {
+ data_key: enums::DashboardMetadata,
+ data_value: serde_json::Value,
+ last_modified_by: String,
+ },
+}
+
+impl From<DashboardMetadataUpdate> for DashboardMetadataUpdateInternal {
+ fn from(metadata_update: DashboardMetadataUpdate) -> Self {
+ let last_modified_at = common_utils::date_time::now();
+ match metadata_update {
+ DashboardMetadataUpdate::UpdateData {
+ data_key,
+ data_value,
+ last_modified_by,
+ } => Self {
+ data_key,
+ data_value,
+ last_modified_by,
+ last_modified_at,
+ },
+ }
+ }
+}
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index b38fb4cf4ae..7d0d599cc4e 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -324,3 +324,29 @@ pub async fn create_merchant_account(
Ok(ApplicationResponse::StatusOk)
}
+
+pub async fn list_merchant_ids_for_user(
+ state: AppState,
+ user: auth::UserFromToken,
+) -> UserResponse<Vec<String>> {
+ Ok(ApplicationResponse::Json(
+ utils::user::get_merchant_ids_for_user(state, &user.user_id).await?,
+ ))
+}
+
+pub async fn get_users_for_merchant_account(
+ state: AppState,
+ user_from_token: auth::UserFromToken,
+) -> UserResponse<user_api::GetUsersResponse> {
+ let users = state
+ .store
+ .find_users_and_roles_by_merchant_id(user_from_token.merchant_id.as_str())
+ .await
+ .change_context(UserErrors::InternalServerError)
+ .attach_printable("No users for given merchant id")?
+ .into_iter()
+ .filter_map(|(user, role)| domain::UserAndRoleJoined(user, role).try_into().ok())
+ .collect();
+
+ Ok(ApplicationResponse::Json(user_api::GetUsersResponse(users)))
+}
diff --git a/crates/router/src/db/dashboard_metadata.rs b/crates/router/src/db/dashboard_metadata.rs
index 2e8129398ca..ec24b4ed07d 100644
--- a/crates/router/src/db/dashboard_metadata.rs
+++ b/crates/router/src/db/dashboard_metadata.rs
@@ -14,6 +14,14 @@ pub trait DashboardMetadataInterface {
&self,
metadata: storage::DashboardMetadataNew,
) -> CustomResult<storage::DashboardMetadata, errors::StorageError>;
+ async fn update_metadata(
+ &self,
+ user_id: Option<String>,
+ merchant_id: String,
+ org_id: String,
+ data_key: enums::DashboardMetadata,
+ dashboard_metadata_update: storage::DashboardMetadataUpdate,
+ ) -> CustomResult<storage::DashboardMetadata, errors::StorageError>;
async fn find_user_scoped_dashboard_metadata(
&self,
@@ -44,6 +52,28 @@ impl DashboardMetadataInterface for Store {
.into_report()
}
+ async fn update_metadata(
+ &self,
+ user_id: Option<String>,
+ merchant_id: String,
+ org_id: String,
+ data_key: enums::DashboardMetadata,
+ dashboard_metadata_update: storage::DashboardMetadataUpdate,
+ ) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ storage::DashboardMetadata::update(
+ &conn,
+ user_id,
+ merchant_id,
+ org_id,
+ data_key,
+ dashboard_metadata_update,
+ )
+ .await
+ .map_err(Into::into)
+ .into_report()
+ }
+
async fn find_user_scoped_dashboard_metadata(
&self,
user_id: &str,
@@ -121,6 +151,41 @@ impl DashboardMetadataInterface for MockDb {
Ok(metadata_new)
}
+ async fn update_metadata(
+ &self,
+ user_id: Option<String>,
+ merchant_id: String,
+ org_id: String,
+ data_key: enums::DashboardMetadata,
+ dashboard_metadata_update: storage::DashboardMetadataUpdate,
+ ) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
+ let mut dashboard_metadata = self.dashboard_metadata.lock().await;
+
+ let dashboard_metadata_to_update = dashboard_metadata
+ .iter_mut()
+ .find(|metadata| {
+ metadata.user_id == user_id
+ && metadata.merchant_id == merchant_id
+ && metadata.org_id == org_id
+ && metadata.data_key == data_key
+ })
+ .ok_or(errors::StorageError::MockDbError)?;
+
+ match dashboard_metadata_update {
+ storage::DashboardMetadataUpdate::UpdateData {
+ data_key,
+ data_value,
+ last_modified_by,
+ } => {
+ dashboard_metadata_to_update.data_key = data_key;
+ dashboard_metadata_to_update.data_value = data_value;
+ dashboard_metadata_to_update.last_modified_by = last_modified_by;
+ dashboard_metadata_to_update.last_modified_at = common_utils::date_time::now();
+ }
+ }
+ Ok(dashboard_metadata_to_update.clone())
+ }
+
async fn find_user_scoped_dashboard_metadata(
&self,
user_id: &str,
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 60a2fb4c2bb..32548e36b6f 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1878,6 +1878,15 @@ impl UserInterface for KafkaStore {
) -> CustomResult<bool, errors::StorageError> {
self.diesel_store.delete_user_by_user_id(user_id).await
}
+
+ async fn find_users_and_roles_by_merchant_id(
+ &self,
+ merchant_id: &str,
+ ) -> CustomResult<Vec<(storage::User, user_storage::UserRole)>, errors::StorageError> {
+ self.diesel_store
+ .find_users_and_roles_by_merchant_id(merchant_id)
+ .await
+ }
}
impl RedisConnInterface for KafkaStore {
@@ -1930,6 +1939,25 @@ impl DashboardMetadataInterface for KafkaStore {
self.diesel_store.insert_metadata(metadata).await
}
+ async fn update_metadata(
+ &self,
+ user_id: Option<String>,
+ merchant_id: String,
+ org_id: String,
+ data_key: enums::DashboardMetadata,
+ dashboard_metadata_update: storage::DashboardMetadataUpdate,
+ ) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
+ self.diesel_store
+ .update_metadata(
+ user_id,
+ merchant_id,
+ org_id,
+ data_key,
+ dashboard_metadata_update,
+ )
+ .await
+ }
+
async fn find_user_scoped_dashboard_metadata(
&self,
user_id: &str,
diff --git a/crates/router/src/db/user.rs b/crates/router/src/db/user.rs
index be0554ec69a..e3dda965f9c 100644
--- a/crates/router/src/db/user.rs
+++ b/crates/router/src/db/user.rs
@@ -1,4 +1,4 @@
-use diesel_models::user as storage;
+use diesel_models::{user as storage, user_role::UserRole};
use error_stack::{IntoReport, ResultExt};
use masking::Secret;
@@ -37,6 +37,11 @@ pub trait UserInterface {
&self,
user_id: &str,
) -> CustomResult<bool, errors::StorageError>;
+
+ async fn find_users_and_roles_by_merchant_id(
+ &self,
+ merchant_id: &str,
+ ) -> CustomResult<Vec<(storage::User, UserRole)>, errors::StorageError>;
}
#[async_trait::async_trait]
@@ -97,6 +102,17 @@ impl UserInterface for Store {
.map_err(Into::into)
.into_report()
}
+
+ async fn find_users_and_roles_by_merchant_id(
+ &self,
+ merchant_id: &str,
+ ) -> CustomResult<Vec<(storage::User, UserRole)>, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ storage::User::find_joined_users_and_roles_by_merchant_id(&conn, merchant_id)
+ .await
+ .map_err(Into::into)
+ .into_report()
+ }
}
#[async_trait::async_trait]
@@ -222,45 +238,11 @@ impl UserInterface for MockDb {
users.remove(user_index);
Ok(true)
}
-}
-#[cfg(feature = "kafka_events")]
-#[async_trait::async_trait]
-impl UserInterface for super::KafkaStore {
- async fn insert_user(
- &self,
- user_data: storage::UserNew,
- ) -> CustomResult<storage::User, errors::StorageError> {
- self.diesel_store.insert_user(user_data).await
- }
- async fn find_user_by_email(
+ async fn find_users_and_roles_by_merchant_id(
&self,
- user_email: &str,
- ) -> CustomResult<storage::User, errors::StorageError> {
- self.diesel_store.find_user_by_email(user_email).await
- }
-
- async fn find_user_by_id(
- &self,
- user_id: &str,
- ) -> CustomResult<storage::User, errors::StorageError> {
- self.diesel_store.find_user_by_id(user_id).await
- }
-
- async fn update_user_by_user_id(
- &self,
- user_id: &str,
- user: storage::UserUpdate,
- ) -> CustomResult<storage::User, errors::StorageError> {
- self.diesel_store
- .update_user_by_user_id(user_id, user)
- .await
- }
-
- async fn delete_user_by_user_id(
- &self,
- user_id: &str,
- ) -> CustomResult<bool, errors::StorageError> {
- self.diesel_store.delete_user_by_user_id(user_id).await
+ _merchant_id: &str,
+ ) -> CustomResult<Vec<(storage::User, UserRole)>, errors::StorageError> {
+ Err(errors::StorageError::MockDbError)?
}
}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 9c83583bc6a..a145f3e7e5d 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -839,6 +839,8 @@ impl User {
web::resource("/create_merchant")
.route(web::post().to(user_merchant_account_create)),
)
+ .service(web::resource("/switch/list").route(web::get().to(list_merchant_ids_for_user)))
+ .service(web::resource("/user/list").route(web::get().to(get_user_details)))
// User Role APIs
.service(web::resource("/permission_info").route(web::get().to(get_authorization_info)))
.service(web::resource("/user/update_role").route(web::post().to(update_user_role)))
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 04b2b0dc953..6aa2bbad0b1 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -157,7 +157,9 @@ impl From<Flow> for ApiIdentifier {
| Flow::SwitchMerchant
| Flow::UserMerchantAccountCreate
| Flow::GenerateSampleData
- | Flow::DeleteSampleData => Self::User,
+ | Flow::DeleteSampleData
+ | Flow::UserMerchantAccountList
+ | Flow::GetUserDetails => Self::User,
Flow::ListRoles | Flow::GetRole | Flow::UpdateUserRole | Flow::GetAuthorizationInfo => {
Self::UserRole
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 78aecea2444..97bd7054da9 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -204,3 +204,34 @@ pub async fn delete_sample_data(
))
.await
}
+
+pub async fn list_merchant_ids_for_user(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+) -> HttpResponse {
+ let flow = Flow::UserMerchantAccountList;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ (),
+ |state, user, _| user_core::list_merchant_ids_for_user(state, user),
+ &auth::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
+pub async fn get_user_details(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
+ let flow = Flow::GetUserDetails;
+ Box::pin(api::server_wrap(
+ flow,
+ state.clone(),
+ &req,
+ (),
+ |state, user, _| user_core::get_users_for_merchant_account(state, user),
+ &auth::JWTAuth(Permission::UsersRead),
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs
index 0c7760f84d3..082b29d8094 100644
--- a/crates/router/src/types/domain/user.rs
+++ b/crates/router/src/types/domain/user.rs
@@ -27,7 +27,7 @@ use crate::{
routes::AppState,
services::{
authentication::{AuthToken, UserFromToken},
- authorization::info,
+ authorization::{info, predefined_permissions},
},
types::transformers::ForeignFrom,
utils::user::password,
@@ -671,3 +671,30 @@ impl TryFrom<info::PermissionInfo> for user_role_api::PermissionInfo {
})
}
}
+
+pub struct UserAndRoleJoined(pub storage_user::User, pub UserRole);
+
+impl TryFrom<UserAndRoleJoined> for user_api::UserDetails {
+ type Error = ();
+ fn try_from(user_and_role: UserAndRoleJoined) -> Result<Self, Self::Error> {
+ let status = match user_and_role.1.status {
+ UserStatus::Active => user_role_api::UserStatus::Active,
+ UserStatus::InvitationSent => user_role_api::UserStatus::InvitationSent,
+ };
+
+ let role_id = user_and_role.1.role_id;
+ let role_name = predefined_permissions::get_role_name_from_id(role_id.as_str())
+ .ok_or(())?
+ .to_string();
+
+ Ok(Self {
+ user_id: user_and_role.0.user_id,
+ email: user_and_role.0.email,
+ name: user_and_role.0.name,
+ role_id,
+ status,
+ role_name,
+ last_modified_at: user_and_role.1.last_modified_at,
+ })
+ }
+}
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index c29e78c7141..696aa409004 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -1,3 +1,4 @@
+use diesel_models::enums::UserStatus;
use error_stack::ResultExt;
use crate::{
@@ -51,3 +52,19 @@ impl UserFromToken {
Ok(user)
}
}
+
+pub async fn get_merchant_ids_for_user(state: AppState, user_id: &str) -> UserResult<Vec<String>> {
+ Ok(state
+ .store
+ .list_user_roles_by_user_id(user_id)
+ .await
+ .change_context(UserErrors::InternalServerError)?
+ .into_iter()
+ .filter_map(|ele| {
+ if ele.status == UserStatus::Active {
+ return Some(ele.merchant_id);
+ }
+ None
+ })
+ .collect())
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index c844a6aeded..f54a5a82baa 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -283,6 +283,10 @@ pub enum Flow {
GenerateSampleData,
/// Delete Sample Data
DeleteSampleData,
+ /// List merchant accounts for user
+ UserMerchantAccountList,
+ /// Get users for merchant account
+ GetUserDetails,
}
///
|
feat
|
add user_list and switch_list apis (#3033)
|
9009ab2896ef9c8df9045c288af5ad601ec7fcd7
|
2023-09-21 16:04:08
|
Prajjwal Kumar
|
fix(env): remove EUR currency from clearpay_afterpay in stripe connector (#2213)
| false
|
diff --git a/config/development.toml b/config/development.toml
index ff981732cea..85bc93822a0 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -241,9 +241,9 @@ ideal = { country = "NL", currency = "EUR" }
[pm_filters.stripe]
google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }
apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US" }
-klarna = { country = "AT,BE,DK,FI,FR,DE,IE,IT,NL,NO,ES,SE,GB,US", currency = "EUR,USD,GBP,DKK,SEK,NOK" }
+klarna = { country = "US", currency = "USD" }
affirm = { country = "US", currency = "USD" }
-afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD,EUR" }
+afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD" }
giropay = { country = "DE", currency = "EUR" }
eps = { country = "AT", currency = "EUR" }
sofort = { country = "AT,BE,DE,IT,NL,ES", currency = "EUR" }
|
fix
|
remove EUR currency from clearpay_afterpay in stripe connector (#2213)
|
9ba8ec348b1e377521386d751c2a924ad843ce8d
|
2023-07-25 17:07:54
|
Sai Harsha Vardhan
|
feat(connector): [Stripe, Adyen, Checkout] Add reference ID support for retries (#1735)
| false
|
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 462d4d3818a..62e4bac31ab 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1712,7 +1712,7 @@ impl<'a>
amount,
merchant_account: auth_type.merchant_account,
payment_method,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
return_url,
shopper_interaction,
recurring_processing_model,
@@ -1751,7 +1751,7 @@ impl<'a> TryFrom<(&types::PaymentsAuthorizeRouterData, &api::Card)> for AdyenPay
amount,
merchant_account: auth_type.merchant_account,
payment_method,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
return_url,
shopper_interaction,
recurring_processing_model,
@@ -1800,7 +1800,7 @@ impl<'a>
amount,
merchant_account: auth_type.merchant_account,
payment_method,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
return_url,
browser_info,
shopper_interaction,
@@ -1852,7 +1852,7 @@ impl<'a>
amount,
merchant_account: auth_type.merchant_account,
payment_method,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
return_url,
shopper_interaction,
recurring_processing_model,
@@ -1937,7 +1937,7 @@ impl<'a> TryFrom<(&types::PaymentsAuthorizeRouterData, &api::WalletData)>
amount,
merchant_account: auth_type.merchant_account,
payment_method,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
return_url,
shopper_interaction,
recurring_processing_model,
@@ -1986,7 +1986,7 @@ impl<'a> TryFrom<(&types::PaymentsAuthorizeRouterData, &api::PayLaterData)>
amount,
merchant_account: auth_type.merchant_account,
payment_method,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
return_url,
shopper_interaction,
recurring_processing_model,
@@ -2013,7 +2013,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for AdyenCancelRequest {
let auth_type = AdyenAuthType::try_from(&item.connector_auth_type)?;
Ok(Self {
merchant_account: auth_type.merchant_account,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
})
}
}
@@ -2096,7 +2096,7 @@ pub fn get_adyen_response(
mandate_reference,
connector_metadata: None,
network_txn_id,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(response.merchant_reference),
};
Ok((status, error, payments_response_data))
}
@@ -2236,7 +2236,7 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for AdyenCaptureRequest {
let auth_type = AdyenAuthType::try_from(&item.connector_auth_type)?;
Ok(Self {
merchant_account: auth_type.merchant_account,
- reference: item.payment_id.to_string(),
+ reference: item.connector_request_reference_id.clone(),
amount: Amount {
currency: item.request.currency.to_string(),
value: item.request.amount_to_capture,
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 1f246d26573..ed366b34495 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -148,6 +148,7 @@ pub struct PaymentsRequest {
#[serde(flatten)]
pub return_url: ReturnUrl,
pub capture: bool,
+ pub reference: String,
}
#[derive(Debug, Serialize)]
@@ -246,6 +247,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentsRequest {
three_ds,
return_url,
capture,
+ reference: item.connector_request_reference_id.clone(),
})
}
}
@@ -323,6 +325,7 @@ pub struct PaymentsResponse {
#[serde(rename = "_links")]
links: Links,
balances: Option<Balances>,
+ reference: Option<String>,
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]
@@ -347,12 +350,14 @@ impl TryFrom<types::PaymentsResponseRouterData<PaymentsResponse>>
item.data.request.capture_method,
)),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(
+ item.response.reference.unwrap_or(item.response.id),
+ ),
}),
..item.data
})
@@ -376,12 +381,14 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponse>>
item.response.balances,
)),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(
+ item.response.reference.unwrap_or(item.response.id),
+ ),
}),
..item.data
})
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 45f7ffcd0fc..9d9906f0a2a 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1262,7 +1262,7 @@ impl TryFrom<&payments::GooglePayWalletData> for StripePaymentMethodData {
impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
- let metadata_order_id = item.payment_id.to_string();
+ let metadata_order_id = item.connector_request_reference_id.clone();
let metadata_txn_id = format!("{}_{}_{}", item.merchant_id, item.payment_id, "1");
let metadata_txn_uuid = Uuid::new_v4().to_string(); //Fetch autogenerated txn_uuid from Database.
@@ -1498,7 +1498,7 @@ fn get_payment_method_type_for_saved_payment_method_payment(
impl TryFrom<&types::VerifyRouterData> for SetupIntentRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::VerifyRouterData) -> Result<Self, Self::Error> {
- let metadata_order_id = item.payment_id.to_string();
+ let metadata_order_id = item.connector_request_reference_id.clone();
let metadata_txn_id = format!("{}_{}_{}", item.merchant_id, item.payment_id, "1");
let metadata_txn_uuid = Uuid::new_v4().to_string();
@@ -1887,12 +1887,12 @@ impl<F, T>
// statement_descriptor_suffix: item.response.statement_descriptor_suffix.map(|x| x.as_str()),
// three_ds_form,
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data,
mandate_reference,
connector_metadata,
network_txn_id,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(item.response.id),
}),
amount_captured: item.response.amount_received,
..item.data
@@ -2010,7 +2010,7 @@ impl<F, T>
mandate_reference,
connector_metadata,
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(item.response.id.clone()),
}),
Err,
);
@@ -2046,12 +2046,12 @@ impl<F, T>
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data,
mandate_reference,
connector_metadata: None,
network_txn_id: Option::foreign_from(item.response.latest_attempt),
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(item.response.id),
}),
..item.data
})
@@ -2538,12 +2538,12 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, ChargesResponse, T, types::Payme
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: None,
mandate_reference: None,
connector_metadata: Some(connector_metadata),
network_txn_id: None,
- connector_response_reference_id: None,
+ connector_response_reference_id: Some(item.response.id),
}),
..item.data
})
|
feat
|
[Stripe, Adyen, Checkout] Add reference ID support for retries (#1735)
|
6d30989f595bdad2b38754ea13e29b5ba1bc1a4b
|
2022-12-13 18:14:19
|
Sanchith Hegde
|
fix(redis_interface): fix derps in `HSET` and `HSETNX` command wrappers (#129)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index ad690392c9f..48bc181e281 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1292,7 +1292,6 @@ dependencies = [
"rand",
"redis-protocol",
"semver",
- "serde_json",
"sha-1",
"tokio",
"tokio-native-tls",
diff --git a/crates/redis_interface/Cargo.toml b/crates/redis_interface/Cargo.toml
index 3ba08e08638..88941eaa932 100644
--- a/crates/redis_interface/Cargo.toml
+++ b/crates/redis_interface/Cargo.toml
@@ -9,7 +9,7 @@ license = "Apache-2.0"
[dependencies]
error-stack = "0.2.4"
-fred = { version = "5.2.0", features = ["metrics", "partial-tracing", "serde-json"] }
+fred = { version = "5.2.0", features = ["metrics", "partial-tracing"] }
serde = { version = "1.0.149", features = ["derive"] }
thiserror = "1.0.37"
diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs
index 13eeee5043a..dfb89b0c1d6 100644
--- a/crates/redis_interface/src/commands.rs
+++ b/crates/redis_interface/src/commands.rs
@@ -20,7 +20,7 @@ use router_env::{tracing, tracing::instrument};
use crate::{
errors,
- types::{RedisEntryId, SetNXReply},
+ types::{HsetnxReply, RedisEntryId, SetnxReply},
};
impl super::RedisConnectionPool {
@@ -142,7 +142,7 @@ impl super::RedisConnectionPool {
&self,
key: &str,
value: V,
- ) -> CustomResult<SetNXReply, errors::RedisError>
+ ) -> CustomResult<SetnxReply, errors::RedisError>
where
V: TryInto<RedisValue> + Debug,
V::Error: Into<fred::error::RedisError>,
@@ -203,28 +203,13 @@ impl super::RedisConnectionPool {
.change_context(errors::RedisError::SetHashFailed)
}
- #[instrument(level = "DEBUG", skip(self))]
- pub async fn serialize_and_set_hash_fields<V>(
- &self,
- key: &str,
- values: V,
- ) -> CustomResult<(), errors::RedisError>
- where
- V: serde::Serialize + Debug,
- {
- let serialized = Encode::<V>::encode_to_value(&values)
- .change_context(errors::RedisError::JsonSerializationFailed)?;
-
- self.set_hash_fields(key, serialized).await
- }
-
#[instrument(level = "DEBUG", skip(self))]
pub async fn set_hash_field_if_not_exist<V>(
&self,
key: &str,
field: &str,
value: V,
- ) -> CustomResult<SetNXReply, errors::RedisError>
+ ) -> CustomResult<HsetnxReply, errors::RedisError>
where
V: TryInto<RedisValue> + Debug,
V::Error: Into<fred::error::RedisError>,
@@ -242,7 +227,7 @@ impl super::RedisConnectionPool {
key: &str,
field: &str,
value: V,
- ) -> CustomResult<SetNXReply, errors::RedisError>
+ ) -> CustomResult<HsetnxReply, errors::RedisError>
where
V: serde::Serialize + Debug,
{
diff --git a/crates/redis_interface/src/types.rs b/crates/redis_interface/src/types.rs
index 129c587298e..311f7a213c2 100644
--- a/crates/redis_interface/src/types.rs
+++ b/crates/redis_interface/src/types.rs
@@ -67,18 +67,18 @@ impl From<&RedisEntryId> for fred::types::XID {
}
#[derive(Eq, PartialEq)]
-pub enum SetNXReply {
+pub enum SetnxReply {
KeySet,
KeyNotSet, // Existing key
}
-impl fred::types::FromRedis for SetNXReply {
+impl fred::types::FromRedis for SetnxReply {
fn from_value(value: fred::types::RedisValue) -> Result<Self, fred::error::RedisError> {
match value {
// Returns String ( "OK" ) in case of success
- fred::types::RedisValue::String(_) => Ok(SetNXReply::KeySet),
+ fred::types::RedisValue::String(_) => Ok(Self::KeySet),
// Return Null in case of failure
- fred::types::RedisValue::Null => Ok(SetNXReply::KeyNotSet),
+ fred::types::RedisValue::Null => Ok(Self::KeyNotSet),
// Unexpected behaviour
_ => Err(fred::error::RedisError::new(
fred::error::RedisErrorKind::Unknown,
@@ -87,3 +87,22 @@ impl fred::types::FromRedis for SetNXReply {
}
}
}
+
+#[derive(Eq, PartialEq)]
+pub enum HsetnxReply {
+ KeySet,
+ KeyNotSet, // Existing key
+}
+
+impl fred::types::FromRedis for HsetnxReply {
+ fn from_value(value: fred::types::RedisValue) -> Result<Self, fred::error::RedisError> {
+ match value {
+ fred::types::RedisValue::Integer(1) => Ok(Self::KeySet),
+ fred::types::RedisValue::Integer(0) => Ok(Self::KeyNotSet),
+ _ => Err(fred::error::RedisError::new(
+ fred::error::RedisErrorKind::Unknown,
+ "Unexpected HSETNX command reply",
+ )),
+ }
+ }
+}
diff --git a/crates/router/src/db/payment_attempt.rs b/crates/router/src/db/payment_attempt.rs
index 1aa10f577e1..18b8fd967b5 100644
--- a/crates/router/src/db/payment_attempt.rs
+++ b/crates/router/src/db/payment_attempt.rs
@@ -305,7 +305,7 @@ impl PaymentAttemptInterface for MockDb {
mod storage {
use common_utils::date_time;
use error_stack::{IntoReport, ResultExt};
- use redis_interface::{RedisEntryId, SetNXReply};
+ use redis_interface::{HsetnxReply, RedisEntryId};
use super::PaymentAttemptInterface;
use crate::{
@@ -377,11 +377,11 @@ mod storage {
.serialize_and_set_hash_field_if_not_exist(&key, "pa", &created_attempt)
.await
{
- Ok(SetNXReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue(
+ Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue(
format!("Payment Attempt already exists for payment_id: {}", key),
))
.into_report(),
- Ok(SetNXReply::KeySet) => {
+ Ok(HsetnxReply::KeySet) => {
let conn = pg_connection(&self.master_pool).await;
let query = payment_attempt
.insert_query(&conn)
@@ -430,9 +430,12 @@ mod storage {
let updated_attempt = payment_attempt.clone().apply_changeset(this.clone());
// Check for database presence as well Maybe use a read replica here ?
+ let redis_value = serde_json::to_string(&updated_attempt)
+ .into_report()
+ .change_context(errors::StorageError::KVError)?;
let updated_attempt = self
.redis_conn
- .serialize_and_set_hash_fields(&key, ("pa", &updated_attempt))
+ .set_hash_fields(&key, ("pa", &redis_value))
.await
.map(|_| updated_attempt)
.change_context(errors::StorageError::KVError)?;
diff --git a/crates/router/src/db/payment_intent.rs b/crates/router/src/db/payment_intent.rs
index 678248f406a..c88419f8a79 100644
--- a/crates/router/src/db/payment_intent.rs
+++ b/crates/router/src/db/payment_intent.rs
@@ -41,7 +41,7 @@ pub trait PaymentIntentInterface {
mod storage {
use common_utils::date_time;
use error_stack::{IntoReport, ResultExt};
- use redis_interface::{RedisEntryId, SetNXReply};
+ use redis_interface::{HsetnxReply, RedisEntryId};
use super::PaymentIntentInterface;
use crate::{
@@ -100,11 +100,11 @@ mod storage {
.serialize_and_set_hash_field_if_not_exist(&key, "pi", &created_intent)
.await
{
- Ok(SetNXReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue(
+ Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue(
format!("Payment Intent already exists for payment_id: {key}"),
))
.into_report(),
- Ok(SetNXReply::KeySet) => {
+ Ok(HsetnxReply::KeySet) => {
let conn = pg_connection(&self.master_pool).await;
let query = new
.insert_query(&conn)
@@ -153,9 +153,12 @@ mod storage {
let updated_intent = payment_intent.clone().apply_changeset(this.clone());
// Check for database presence as well Maybe use a read replica here ?
+ let redis_value = serde_json::to_string(&updated_intent)
+ .into_report()
+ .change_context(errors::StorageError::KVError)?;
let updated_intent = self
.redis_conn
- .serialize_and_set_hash_fields(&key, ("pi", &updated_intent))
+ .set_hash_fields(&key, ("pi", &redis_value))
.await
.map(|_| updated_intent)
.change_context(errors::StorageError::KVError)?;
diff --git a/crates/router/src/db/queue.rs b/crates/router/src/db/queue.rs
index 8494409380c..448bf958f8d 100644
--- a/crates/router/src/db/queue.rs
+++ b/crates/router/src/db/queue.rs
@@ -1,4 +1,4 @@
-use redis_interface::{errors::RedisError, RedisEntryId, SetNXReply};
+use redis_interface::{errors::RedisError, RedisEntryId, SetnxReply};
use router_env::logger;
use super::{MockDb, Store};
@@ -70,7 +70,7 @@ impl QueueInterface for Store {
let conn = self.redis_conn.clone();
let is_lock_acquired = conn.set_key_if_not_exist(lock_key, lock_val).await;
match is_lock_acquired {
- Ok(SetNXReply::KeySet) => match conn.set_expiry(lock_key, ttl).await {
+ Ok(SetnxReply::KeySet) => match conn.set_expiry(lock_key, ttl).await {
Ok(()) => true,
#[allow(unused_must_use)]
@@ -80,7 +80,7 @@ impl QueueInterface for Store {
false
}
},
- Ok(SetNXReply::KeyNotSet) => {
+ Ok(SetnxReply::KeyNotSet) => {
logger::error!(%tag, "Lock not acquired, previous fetch still in progress");
false
}
|
fix
|
fix derps in `HSET` and `HSETNX` command wrappers (#129)
|
22cee8cdd9567545cd61587a8158aca754d77e0a
|
2023-04-21 02:51:08
|
Jagan
|
fix(connector): [coinbase] update cancel status on user cancelling the payment (#922)
| false
|
diff --git a/crates/router/src/connector/coinbase/transformers.rs b/crates/router/src/connector/coinbase/transformers.rs
index 9e2b185fee9..fcd8cd24b28 100644
--- a/crates/router/src/connector/coinbase/transformers.rs
+++ b/crates/router/src/connector/coinbase/transformers.rs
@@ -80,6 +80,7 @@ impl From<CoinbasePaymentStatus> for enums::AttemptStatus {
CoinbasePaymentStatus::Expired => Self::Failure,
CoinbasePaymentStatus::New => Self::AuthenticationPending,
CoinbasePaymentStatus::Unresolved => Self::Unresolved,
+ CoinbasePaymentStatus::Canceled => Self::Voided,
_ => Self::Pending,
}
}
|
fix
|
[coinbase] update cancel status on user cancelling the payment (#922)
|
601c1744b6f15eb14ecfa3edede3159c32c53492
|
2023-10-06 13:10:13
|
Chethan Rao
|
refactor: add support for passing context generic to api calls (#2433)
| false
|
diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index e44ce0a1fd3..1076dfe410f 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -6,7 +6,7 @@ use router_env::{instrument, tracing, Flow};
use crate::{
compatibility::{stripe::errors, wrap},
- core::{api_locking::GetLockingInput, payments},
+ core::{api_locking::GetLockingInput, payment_methods::Oss, payments},
routes,
services::{api, authentication as auth},
types::api::{self as api_types},
@@ -50,7 +50,7 @@ pub async fn payment_intents_create(
&req,
create_payment_req,
|state, auth, req| {
- payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -109,7 +109,7 @@ pub async fn payment_intents_retrieve(
&req,
payload,
|state, auth, payload| {
- payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _, Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -172,7 +172,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -236,7 +236,7 @@ pub async fn payment_intents_update(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -302,7 +302,7 @@ pub async fn payment_intents_confirm(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -358,7 +358,7 @@ pub async fn payment_intents_capture(
&req,
payload,
|state, auth, payload| {
- payments::payments_core::<api_types::Capture, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::Capture, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -418,7 +418,7 @@ pub async fn payment_intents_cancel(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::Void, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::Void, api_types::PaymentsResponse, _, _, _, Oss>(
state,
auth.merchant_account,
auth.key_store,
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index b9da2f8e3ee..311498e1af5 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -9,7 +9,7 @@ use crate::{
stripe::{errors, payment_intents::types as stripe_payment_types},
wrap,
},
- core::{api_locking, payments},
+ core::{api_locking, payment_methods::Oss, payments},
routes,
services::{api, authentication as auth},
types::api as api_types,
@@ -54,7 +54,14 @@ pub async fn setup_intents_create(
&req,
create_payment_req,
|state, auth, req| {
- payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<
+ api_types::SetupMandate,
+ api_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
state,
auth.merchant_account,
auth.key_store,
@@ -113,7 +120,7 @@ pub async fn setup_intents_retrieve(
&req,
payload,
|state, auth, payload| {
- payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _, Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -178,7 +185,14 @@ pub async fn setup_intents_update(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<
+ api_types::SetupMandate,
+ api_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
state,
auth.merchant_account,
auth.key_store,
@@ -244,7 +258,14 @@ pub async fn setup_intents_confirm(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<
+ api_types::SetupMandate,
+ api_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
state,
auth.merchant_account,
auth.key_store,
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index f1d641adbe5..850daeba75f 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -1,3 +1,99 @@
pub mod cards;
pub mod transformers;
pub mod vault;
+
+pub use api_models::{
+ enums::{Connector, PayoutConnectors},
+ payouts as payout_types,
+};
+pub use common_utils::request::RequestBody;
+use data_models::payments::{payment_attempt::PaymentAttempt, payment_intent::PaymentIntent};
+use diesel_models::enums;
+
+use crate::{
+ core::{errors::RouterResult, payments::helpers},
+ routes::AppState,
+ types::api::{self, payments},
+};
+
+pub struct Oss;
+
+#[async_trait::async_trait]
+pub trait PaymentMethodRetrieve {
+ async fn retrieve_payment_method(
+ pm_data: &Option<payments::PaymentMethodData>,
+ state: &AppState,
+ payment_intent: &PaymentIntent,
+ payment_attempt: &PaymentAttempt,
+ ) -> RouterResult<(Option<payments::PaymentMethodData>, Option<String>)>;
+}
+
+#[async_trait::async_trait]
+impl PaymentMethodRetrieve for Oss {
+ async fn retrieve_payment_method(
+ pm_data: &Option<payments::PaymentMethodData>,
+ state: &AppState,
+ payment_intent: &PaymentIntent,
+ payment_attempt: &PaymentAttempt,
+ ) -> RouterResult<(Option<payments::PaymentMethodData>, Option<String>)> {
+ match pm_data {
+ pm_opt @ Some(pm @ api::PaymentMethodData::Card(_)) => {
+ let payment_token = helpers::store_payment_method_data_in_vault(
+ state,
+ payment_attempt,
+ payment_intent,
+ enums::PaymentMethod::Card,
+ pm,
+ )
+ .await?;
+
+ Ok((pm_opt.to_owned(), payment_token))
+ }
+ pm @ Some(api::PaymentMethodData::PayLater(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::Crypto(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::BankDebit(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::Upi(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::Voucher(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::Reward) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::CardRedirect(_)) => Ok((pm.to_owned(), None)),
+ pm @ Some(api::PaymentMethodData::GiftCard(_)) => Ok((pm.to_owned(), None)),
+ pm_opt @ Some(pm @ api::PaymentMethodData::BankTransfer(_)) => {
+ let payment_token = helpers::store_payment_method_data_in_vault(
+ state,
+ payment_attempt,
+ payment_intent,
+ enums::PaymentMethod::BankTransfer,
+ pm,
+ )
+ .await?;
+
+ Ok((pm_opt.to_owned(), payment_token))
+ }
+ pm_opt @ Some(pm @ api::PaymentMethodData::Wallet(_)) => {
+ let payment_token = helpers::store_payment_method_data_in_vault(
+ state,
+ payment_attempt,
+ payment_intent,
+ enums::PaymentMethod::Wallet,
+ pm,
+ )
+ .await?;
+
+ Ok((pm_opt.to_owned(), payment_token))
+ }
+ pm_opt @ Some(pm @ api::PaymentMethodData::BankRedirect(_)) => {
+ let payment_token = helpers::store_payment_method_data_in_vault(
+ state,
+ payment_attempt,
+ payment_intent,
+ enums::PaymentMethod::BankRedirect,
+ pm,
+ )
+ .await?;
+
+ Ok((pm_opt.to_owned(), payment_token))
+ }
+ _ => Ok((None, None)),
+ }
+ }
+}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 1b6d93596f1..cc84a13616d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -18,6 +18,8 @@ use futures::future::join_all;
use helpers::ApplePayData;
use masking::Secret;
use router_env::{instrument, tracing};
+#[cfg(feature = "olap")]
+use router_types::transformers::ForeignFrom;
use scheduler::{db::process_tracker::ProcessTrackerExt, errors as sch_errors, utils as pt_utils};
use time;
@@ -31,12 +33,11 @@ use self::{
operations::{payment_complete_authorize, BoxedOperation, Operation},
};
use super::errors::StorageErrorExt;
-#[cfg(feature = "olap")]
-use crate::types::transformers::ForeignFrom;
use crate::{
configs::settings::PaymentMethodTypeTokenFilter,
core::{
errors::{self, CustomResult, RouterResponse, RouterResult},
+ payment_methods::PaymentMethodRetrieve,
utils,
},
db::StorageInterface,
@@ -56,7 +57,7 @@ use crate::{
#[allow(clippy::too_many_arguments)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
-pub async fn payments_operation_core<F, Req, Op, FData>(
+pub async fn payments_operation_core<F, Req, Op, FData, Ctx>(
state: &AppState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
@@ -69,7 +70,7 @@ pub async fn payments_operation_core<F, Req, Op, FData>(
where
F: Send + Clone + Sync,
Req: Authenticate,
- Op: Operation<F, Req> + Send + Sync,
+ Op: Operation<F, Req, Ctx> + Send + Sync,
// To create connector flow specific interface data
PaymentData<F>: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
@@ -80,10 +81,11 @@ where
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
// To perform router related operation for PaymentResponse
- PaymentResponse: Operation<F, FData>,
+ PaymentResponse: Operation<F, FData, Ctx>,
FData: Send + Sync,
+ Ctx: PaymentMethodRetrieve,
{
- let operation: BoxedOperation<'_, F, Req> = Box::new(operation);
+ let operation: BoxedOperation<'_, F, Req, Ctx> = Box::new(operation);
tracing::Span::current().record("merchant_id", merchant_account.merchant_id.as_str());
let (operation, validate_result) = operation
@@ -239,7 +241,7 @@ where
}
#[allow(clippy::too_many_arguments)]
-pub async fn payments_core<F, Res, Req, Op, FData>(
+pub async fn payments_core<F, Res, Req, Op, FData, Ctx>(
state: AppState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
@@ -252,31 +254,33 @@ pub async fn payments_core<F, Res, Req, Op, FData>(
where
F: Send + Clone + Sync,
FData: Send + Sync,
- Op: Operation<F, Req> + Send + Sync + Clone,
+ Op: Operation<F, Req, Ctx> + Send + Sync + Clone,
Req: Debug + Authenticate,
Res: transformers::ToResponse<Req, PaymentData<F>, Op>,
// To create connector flow specific interface data
PaymentData<F>: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
router_types::RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
+ Ctx: PaymentMethodRetrieve,
// To construct connector flow specific api
dyn router_types::api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
// To perform router related operation for PaymentResponse
- PaymentResponse: Operation<F, FData>,
+ PaymentResponse: Operation<F, FData, Ctx>,
{
- let (payment_data, req, customer, connector_http_status_code) = payments_operation_core(
- &state,
- merchant_account,
- key_store,
- operation.clone(),
- req,
- call_connector_action,
- auth_flow,
- header_payload,
- )
- .await?;
+ let (payment_data, req, customer, connector_http_status_code) =
+ payments_operation_core::<_, _, _, _, Ctx>(
+ &state,
+ merchant_account,
+ key_store,
+ operation.clone(),
+ req,
+ call_connector_action,
+ auth_flow,
+ header_payload,
+ )
+ .await?;
Res::generate_response(
Some(req),
@@ -306,7 +310,7 @@ pub struct PaymentsRedirectResponseData {
}
#[async_trait::async_trait]
-pub trait PaymentRedirectFlow: Sync {
+pub trait PaymentRedirectFlow<Ctx: PaymentMethodRetrieve>: Sync {
async fn call_payment_flow(
&self,
state: &AppState,
@@ -402,7 +406,7 @@ pub trait PaymentRedirectFlow: Sync {
pub struct PaymentRedirectCompleteAuthorize;
#[async_trait::async_trait]
-impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
+impl<Ctx: PaymentMethodRetrieve> PaymentRedirectFlow<Ctx> for PaymentRedirectCompleteAuthorize {
async fn call_payment_flow(
&self,
state: &AppState,
@@ -422,7 +426,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
}),
..Default::default()
};
- payments_core::<api::CompleteAuthorize, api::PaymentsResponse, _, _, _>(
+ payments_core::<api::CompleteAuthorize, api::PaymentsResponse, _, _, _, Ctx>(
state.clone(),
merchant_account,
merchant_key_store,
@@ -492,7 +496,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
pub struct PaymentRedirectSync;
#[async_trait::async_trait]
-impl PaymentRedirectFlow for PaymentRedirectSync {
+impl<Ctx: PaymentMethodRetrieve> PaymentRedirectFlow<Ctx> for PaymentRedirectSync {
async fn call_payment_flow(
&self,
state: &AppState,
@@ -517,7 +521,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
expand_attempts: None,
expand_captures: None,
};
- payments_core::<api::PSync, api::PaymentsResponse, _, _, _>(
+ payments_core::<api::PSync, api::PaymentsResponse, _, _, _, Ctx>(
state.clone(),
merchant_account,
merchant_key_store,
@@ -552,12 +556,12 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
#[allow(clippy::too_many_arguments)]
#[instrument(skip_all)]
-pub async fn call_connector_service<F, RouterDReq, ApiRequest>(
+pub async fn call_connector_service<F, RouterDReq, ApiRequest, Ctx>(
state: &AppState,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
connector: api::ConnectorData,
- operation: &BoxedOperation<'_, F, ApiRequest>,
+ operation: &BoxedOperation<'_, F, ApiRequest, Ctx>,
payment_data: &mut PaymentData<F>,
customer: &Option<domain::Customer>,
call_connector_action: CallConnectorAction,
@@ -573,6 +577,7 @@ where
PaymentData<F>: ConstructFlowSpecificData<F, RouterDReq, router_types::PaymentsResponseData>,
router_types::RouterData<F, RouterDReq, router_types::PaymentsResponseData>:
Feature<F, RouterDReq> + Send,
+ Ctx: PaymentMethodRetrieve,
// To construct connector flow specific api
dyn api::Connector:
@@ -767,7 +772,7 @@ where
router_data_res
}
-pub async fn call_multiple_connectors_service<F, Op, Req>(
+pub async fn call_multiple_connectors_service<F, Op, Req, Ctx>(
state: &AppState,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
@@ -787,9 +792,10 @@ where
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, Req, router_types::PaymentsResponseData>,
+ Ctx: PaymentMethodRetrieve,
// To perform router related operation for PaymentResponse
- PaymentResponse: Operation<F, Req>,
+ PaymentResponse: Operation<F, Req, Ctx>,
{
let call_connectors_start_time = Instant::now();
let mut join_handlers = Vec::with_capacity(connectors.len());
@@ -969,12 +975,12 @@ where
}
}
-async fn complete_preprocessing_steps_if_required<F, Req, Q>(
+async fn complete_preprocessing_steps_if_required<F, Req, Q, Ctx>(
state: &AppState,
connector: &api::ConnectorData,
payment_data: &PaymentData<F>,
mut router_data: router_types::RouterData<F, Req, router_types::PaymentsResponseData>,
- operation: &BoxedOperation<'_, F, Q>,
+ operation: &BoxedOperation<'_, F, Q, Ctx>,
should_continue_payment: bool,
) -> RouterResult<(
router_types::RouterData<F, Req, router_types::PaymentsResponseData>,
@@ -1256,15 +1262,16 @@ pub enum TokenizationAction {
}
#[allow(clippy::too_many_arguments)]
-pub async fn get_connector_tokenization_action_when_confirm_true<F, Req>(
+pub async fn get_connector_tokenization_action_when_confirm_true<F, Req, Ctx>(
state: &AppState,
- operation: &BoxedOperation<'_, F, Req>,
+ operation: &BoxedOperation<'_, F, Req, Ctx>,
payment_data: &mut PaymentData<F>,
validate_result: &operations::ValidateResult<'_>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<(PaymentData<F>, TokenizationAction)>
where
F: Send + Clone,
+ Ctx: PaymentMethodRetrieve,
{
let connector = payment_data.payment_attempt.connector.to_owned();
@@ -1364,14 +1371,15 @@ where
Ok(payment_data_and_tokenization_action)
}
-pub async fn tokenize_in_router_when_confirm_false<F, Req>(
+pub async fn tokenize_in_router_when_confirm_false<F, Req, Ctx>(
state: &AppState,
- operation: &BoxedOperation<'_, F, Req>,
+ operation: &BoxedOperation<'_, F, Req, Ctx>,
payment_data: &mut PaymentData<F>,
validate_result: &operations::ValidateResult<'_>,
) -> RouterResult<PaymentData<F>>
where
F: Send + Clone,
+ Ctx: PaymentMethodRetrieve,
{
// On confirm is false and only router related
let payment_data = if !is_operation_confirm(operation) {
@@ -1454,15 +1462,16 @@ pub struct CustomerDetails {
pub phone_country_code: Option<String>,
}
-pub fn if_not_create_change_operation<'a, Op, F>(
+pub fn if_not_create_change_operation<'a, Op, F, Ctx>(
status: storage_enums::IntentStatus,
confirm: Option<bool>,
current: &'a Op,
-) -> BoxedOperation<'_, F, api::PaymentsRequest>
+) -> BoxedOperation<'_, F, api::PaymentsRequest, Ctx>
where
F: Send + Clone,
- Op: Operation<F, api::PaymentsRequest> + Send + Sync,
- &'a Op: Operation<F, api::PaymentsRequest>,
+ Op: Operation<F, api::PaymentsRequest, Ctx> + Send + Sync,
+ &'a Op: Operation<F, api::PaymentsRequest, Ctx>,
+ Ctx: PaymentMethodRetrieve,
{
if confirm.unwrap_or(false) {
Box::new(PaymentConfirm)
@@ -1476,15 +1485,16 @@ where
}
}
-pub fn is_confirm<'a, F: Clone + Send, R, Op>(
+pub fn is_confirm<'a, F: Clone + Send, R, Op, Ctx>(
operation: &'a Op,
confirm: Option<bool>,
-) -> BoxedOperation<'_, F, R>
+) -> BoxedOperation<'_, F, R, Ctx>
where
- PaymentConfirm: Operation<F, R>,
- &'a PaymentConfirm: Operation<F, R>,
- Op: Operation<F, R> + Send + Sync,
- &'a Op: Operation<F, R>,
+ PaymentConfirm: Operation<F, R, Ctx>,
+ &'a PaymentConfirm: Operation<F, R, Ctx>,
+ Op: Operation<F, R, Ctx> + Send + Sync,
+ &'a Op: Operation<F, R, Ctx>,
+ Ctx: PaymentMethodRetrieve,
{
if confirm.unwrap_or(false) {
Box::new(&PaymentConfirm)
@@ -1777,8 +1787,8 @@ where
Ok(())
}
-pub async fn get_connector_choice<F, Req>(
- operation: &BoxedOperation<'_, F, Req>,
+pub async fn get_connector_choice<F, Req, Ctx>(
+ operation: &BoxedOperation<'_, F, Req, Ctx>,
state: &AppState,
req: &Req,
merchant_account: &domain::MerchantAccount,
@@ -1787,6 +1797,7 @@ pub async fn get_connector_choice<F, Req>(
) -> RouterResult<Option<api::ConnectorCallType>>
where
F: Send + Clone,
+ Ctx: PaymentMethodRetrieve,
{
let connector_choice = operation
.to_domain()?
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 139a2fb6807..9a089666558 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -36,7 +36,7 @@ use crate::{
consts::{self, BASE64_ENGINE},
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
- payment_methods::{cards, vault},
+ payment_methods::{cards, vault, PaymentMethodRetrieve},
payments,
},
db::StorageInterface,
@@ -936,10 +936,11 @@ where
}
}
-pub fn response_operation<'a, F, R>() -> BoxedOperation<'a, F, R>
+pub fn response_operation<'a, F, R, Ctx>() -> BoxedOperation<'a, F, R, Ctx>
where
F: Send + Clone,
- PaymentResponse: Operation<F, R>,
+ Ctx: PaymentMethodRetrieve,
+ PaymentResponse: Operation<F, R, Ctx>,
{
Box::new(PaymentResponse)
}
@@ -1149,14 +1150,14 @@ pub async fn get_connector_default(
}
#[instrument(skip_all)]
-pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
- operation: BoxedOperation<'a, F, R>,
+pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>(
+ operation: BoxedOperation<'a, F, R, Ctx>,
db: &dyn StorageInterface,
payment_data: &mut PaymentData<F>,
req: Option<CustomerDetails>,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
-) -> CustomResult<(BoxedOperation<'a, F, R>, Option<domain::Customer>), errors::StorageError> {
+) -> CustomResult<(BoxedOperation<'a, F, R, Ctx>, Option<domain::Customer>), errors::StorageError> {
let request_customer_details = req
.get_required_value("customer")
.change_context(errors::StorageError::ValueNotFound("customer".to_owned()))?;
@@ -1302,12 +1303,15 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
))
}
-pub async fn make_pm_data<'a, F: Clone, R>(
- operation: BoxedOperation<'a, F, R>,
+pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>(
+ operation: BoxedOperation<'a, F, R, Ctx>,
state: &'a AppState,
payment_data: &mut PaymentData<F>,
-) -> RouterResult<(BoxedOperation<'a, F, R>, Option<api::PaymentMethodData>)> {
- let request = &payment_data.payment_method_data;
+) -> RouterResult<(
+ BoxedOperation<'a, F, R, Ctx>,
+ Option<api::PaymentMethodData>,
+)> {
+ let request = &payment_data.payment_method_data.clone();
let token = payment_data.token.clone();
let hyperswitch_token = match payment_data.mandate_id {
@@ -1418,89 +1422,19 @@ pub async fn make_pm_data<'a, F: Clone, R>(
None => None,
})
}
- (pm_opt @ Some(pm @ api::PaymentMethodData::Card(_)), _) => {
- if should_store_payment_method_data_in_vault(
- &state.conf.temp_locker_disable_config,
- payment_data.payment_attempt.connector.clone(),
- enums::PaymentMethod::Card,
- ) {
- let parent_payment_method_token = store_in_vault_and_generate_ppmt(
- state,
- pm,
- &payment_data.payment_intent,
- &payment_data.payment_attempt,
- enums::PaymentMethod::Card,
- )
- .await?;
- payment_data.token = Some(parent_payment_method_token);
- }
- Ok(pm_opt.to_owned())
- }
- (pm @ Some(api::PaymentMethodData::PayLater(_)), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::Crypto(_)), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::BankDebit(_)), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::Upi(_)), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::Voucher(_)), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::Reward), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::CardRedirect(_)), _) => Ok(pm.to_owned()),
- (pm @ Some(api::PaymentMethodData::GiftCard(_)), _) => Ok(pm.to_owned()),
- (pm_opt @ Some(pm @ api::PaymentMethodData::BankTransfer(_)), _) => {
- if should_store_payment_method_data_in_vault(
- &state.conf.temp_locker_disable_config,
- payment_data.payment_attempt.connector.clone(),
- enums::PaymentMethod::BankTransfer,
- ) {
- let parent_payment_method_token = store_in_vault_and_generate_ppmt(
- state,
- pm,
- &payment_data.payment_intent,
- &payment_data.payment_attempt,
- enums::PaymentMethod::BankTransfer,
- )
- .await?;
-
- payment_data.token = Some(parent_payment_method_token);
- }
+ (Some(_), _) => {
+ let payment_method_data = Ctx::retrieve_payment_method(
+ request,
+ state,
+ &payment_data.payment_intent,
+ &payment_data.payment_attempt,
+ )
+ .await?;
- Ok(pm_opt.to_owned())
- }
- (pm_opt @ Some(pm @ api::PaymentMethodData::Wallet(_)), _) => {
- if should_store_payment_method_data_in_vault(
- &state.conf.temp_locker_disable_config,
- payment_data.payment_attempt.connector.clone(),
- enums::PaymentMethod::Wallet,
- ) {
- let parent_payment_method_token = store_in_vault_and_generate_ppmt(
- state,
- pm,
- &payment_data.payment_intent,
- &payment_data.payment_attempt,
- enums::PaymentMethod::Wallet,
- )
- .await?;
+ payment_data.token = payment_method_data.1;
- payment_data.token = Some(parent_payment_method_token);
- }
- Ok(pm_opt.to_owned())
- }
- (pm_opt @ Some(pm @ api::PaymentMethodData::BankRedirect(_)), _) => {
- if should_store_payment_method_data_in_vault(
- &state.conf.temp_locker_disable_config,
- payment_data.payment_attempt.connector.clone(),
- enums::PaymentMethod::BankRedirect,
- ) {
- let parent_payment_method_token = store_in_vault_and_generate_ppmt(
- state,
- pm,
- &payment_data.payment_intent,
- &payment_data.payment_attempt,
- enums::PaymentMethod::BankRedirect,
- )
- .await?;
- payment_data.token = Some(parent_payment_method_token);
- }
- Ok(pm_opt.to_owned())
+ Ok(payment_method_data.0)
}
_ => Ok(None),
}?;
@@ -1538,6 +1472,32 @@ pub async fn store_in_vault_and_generate_ppmt(
Ok(parent_payment_method_token)
}
+pub async fn store_payment_method_data_in_vault(
+ state: &AppState,
+ payment_attempt: &PaymentAttempt,
+ payment_intent: &PaymentIntent,
+ payment_method: enums::PaymentMethod,
+ payment_method_data: &api::PaymentMethodData,
+) -> RouterResult<Option<String>> {
+ if should_store_payment_method_data_in_vault(
+ &state.conf.temp_locker_disable_config,
+ payment_attempt.connector.clone(),
+ payment_method,
+ ) {
+ let parent_payment_method_token = store_in_vault_and_generate_ppmt(
+ state,
+ payment_method_data,
+ payment_intent,
+ payment_attempt,
+ payment_method,
+ )
+ .await?;
+
+ return Ok(Some(parent_payment_method_token));
+ }
+
+ Ok(None)
+}
pub fn should_store_payment_method_data_in_vault(
temp_locker_disable_config: &TempLockerDisableConfig,
option_connector: Option<String>,
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index b0c7a5ae126..d198cd562a7 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -27,7 +27,10 @@ pub use self::{
};
use super::{helpers, CustomerDetails, PaymentData};
use crate::{
- core::errors::{self, CustomResult, RouterResult},
+ core::{
+ errors::{self, CustomResult, RouterResult},
+ payment_methods::PaymentMethodRetrieve,
+ },
db::StorageInterface,
routes::AppState,
services,
@@ -38,26 +41,26 @@ use crate::{
},
};
-pub type BoxedOperation<'a, F, T> = Box<dyn Operation<F, T> + Send + Sync + 'a>;
+pub type BoxedOperation<'a, F, T, Ctx> = Box<dyn Operation<F, T, Ctx> + Send + Sync + 'a>;
-pub trait Operation<F: Clone, T>: Send + std::fmt::Debug {
- fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F, T> + Send + Sync)> {
+pub trait Operation<F: Clone, T, Ctx: PaymentMethodRetrieve>: Send + std::fmt::Debug {
+ fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F, T, Ctx> + Send + Sync)> {
Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("validate request interface not found for {self:?}"))
}
fn to_get_tracker(
&self,
- ) -> RouterResult<&(dyn GetTracker<F, PaymentData<F>, T> + Send + Sync)> {
+ ) -> RouterResult<&(dyn GetTracker<F, PaymentData<F>, T, Ctx> + Send + Sync)> {
Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("get tracker interface not found for {self:?}"))
}
- fn to_domain(&self) -> RouterResult<&dyn Domain<F, T>> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, T, Ctx>> {
Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("domain interface not found for {self:?}"))
}
fn to_update_tracker(
&self,
- ) -> RouterResult<&(dyn UpdateTracker<F, PaymentData<F>, T> + Send + Sync)> {
+ ) -> RouterResult<&(dyn UpdateTracker<F, PaymentData<F>, T, Ctx> + Send + Sync)> {
Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("update tracker interface not found for {self:?}"))
}
@@ -80,16 +83,16 @@ pub struct ValidateResult<'a> {
}
#[allow(clippy::type_complexity)]
-pub trait ValidateRequest<F, R> {
+pub trait ValidateRequest<F, R, Ctx: PaymentMethodRetrieve> {
fn validate_request<'a, 'b>(
&'b self,
request: &R,
merchant_account: &'a domain::MerchantAccount,
- ) -> RouterResult<(BoxedOperation<'b, F, R>, ValidateResult<'a>)>;
+ ) -> RouterResult<(BoxedOperation<'b, F, R, Ctx>, ValidateResult<'a>)>;
}
#[async_trait]
-pub trait GetTracker<F, D, R>: Send {
+pub trait GetTracker<F, D, R, Ctx: PaymentMethodRetrieve>: Send {
#[allow(clippy::too_many_arguments)]
async fn get_trackers<'a>(
&'a self,
@@ -100,11 +103,11 @@ pub trait GetTracker<F, D, R>: Send {
merchant_account: &domain::MerchantAccount,
mechant_key_store: &domain::MerchantKeyStore,
auth_flow: services::AuthFlow,
- ) -> RouterResult<(BoxedOperation<'a, F, R>, D, Option<CustomerDetails>)>;
+ ) -> RouterResult<(BoxedOperation<'a, F, R, Ctx>, D, Option<CustomerDetails>)>;
}
#[async_trait]
-pub trait Domain<F: Clone, R>: Send + Sync {
+pub trait Domain<F: Clone, R, Ctx: PaymentMethodRetrieve>: Send + Sync {
/// This will fetch customer details, (this operation is flow specific)
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -112,7 +115,7 @@ pub trait Domain<F: Clone, R>: Send + Sync {
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
merchant_key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<(BoxedOperation<'a, F, R>, Option<domain::Customer>), errors::StorageError>;
+ ) -> CustomResult<(BoxedOperation<'a, F, R, Ctx>, Option<domain::Customer>), errors::StorageError>;
#[allow(clippy::too_many_arguments)]
async fn make_pm_data<'a>(
@@ -120,7 +123,10 @@ pub trait Domain<F: Clone, R>: Send + Sync {
state: &'a AppState,
payment_data: &mut PaymentData<F>,
storage_scheme: enums::MerchantStorageScheme,
- ) -> RouterResult<(BoxedOperation<'a, F, R>, Option<api::PaymentMethodData>)>;
+ ) -> RouterResult<(
+ BoxedOperation<'a, F, R, Ctx>,
+ Option<api::PaymentMethodData>,
+ )>;
async fn add_task_to_process_tracker<'a>(
&'a self,
@@ -144,7 +150,7 @@ pub trait Domain<F: Clone, R>: Send + Sync {
#[async_trait]
#[allow(clippy::too_many_arguments)]
-pub trait UpdateTracker<F, D, Req>: Send {
+pub trait UpdateTracker<F, D, Req, Ctx: PaymentMethodRetrieve>: Send {
async fn update_trackers<'b>(
&'b self,
db: &dyn StorageInterface,
@@ -155,7 +161,7 @@ pub trait UpdateTracker<F, D, Req>: Send {
mechant_key_store: &domain::MerchantKeyStore,
frm_suggestion: Option<FrmSuggestion>,
header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, Req>, D)>
+ ) -> RouterResult<(BoxedOperation<'b, F, Req, Ctx>, D)>
where
F: 'b + Send;
}
@@ -175,10 +181,13 @@ pub trait PostUpdateTracker<F, D, R>: Send {
}
#[async_trait]
-impl<F: Clone + Send, Op: Send + Sync + Operation<F, api::PaymentsRetrieveRequest>>
- Domain<F, api::PaymentsRetrieveRequest> for Op
+impl<
+ F: Clone + Send,
+ Ctx: PaymentMethodRetrieve,
+ Op: Send + Sync + Operation<F, api::PaymentsRetrieveRequest, Ctx>,
+ > Domain<F, api::PaymentsRetrieveRequest, Ctx> for Op
where
- for<'a> &'a Op: Operation<F, api::PaymentsRetrieveRequest>,
+ for<'a> &'a Op: Operation<F, api::PaymentsRetrieveRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -189,7 +198,7 @@ where
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRetrieveRequest>,
+ BoxedOperation<'a, F, api::PaymentsRetrieveRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -225,7 +234,7 @@ where
payment_data: &mut PaymentData<F>,
_storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRetrieveRequest>,
+ BoxedOperation<'a, F, api::PaymentsRetrieveRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
helpers::make_pm_data(Box::new(self), state, payment_data).await
@@ -233,10 +242,13 @@ where
}
#[async_trait]
-impl<F: Clone + Send, Op: Send + Sync + Operation<F, api::PaymentsCaptureRequest>>
- Domain<F, api::PaymentsCaptureRequest> for Op
+impl<
+ F: Clone + Send,
+ Ctx: PaymentMethodRetrieve,
+ Op: Send + Sync + Operation<F, api::PaymentsCaptureRequest, Ctx>,
+ > Domain<F, api::PaymentsCaptureRequest, Ctx> for Op
where
- for<'a> &'a Op: Operation<F, api::PaymentsCaptureRequest>,
+ for<'a> &'a Op: Operation<F, api::PaymentsCaptureRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -247,7 +259,7 @@ where
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsCaptureRequest>,
+ BoxedOperation<'a, F, api::PaymentsCaptureRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -271,7 +283,7 @@ where
_payment_data: &mut PaymentData<F>,
_storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsCaptureRequest>,
+ BoxedOperation<'a, F, api::PaymentsCaptureRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
Ok((Box::new(self), None))
@@ -290,10 +302,13 @@ where
}
#[async_trait]
-impl<F: Clone + Send, Op: Send + Sync + Operation<F, api::PaymentsCancelRequest>>
- Domain<F, api::PaymentsCancelRequest> for Op
+impl<
+ F: Clone + Send,
+ Ctx: PaymentMethodRetrieve,
+ Op: Send + Sync + Operation<F, api::PaymentsCancelRequest, Ctx>,
+ > Domain<F, api::PaymentsCancelRequest, Ctx> for Op
where
- for<'a> &'a Op: Operation<F, api::PaymentsCancelRequest>,
+ for<'a> &'a Op: Operation<F, api::PaymentsCancelRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -304,7 +319,7 @@ where
merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsCancelRequest>,
+ BoxedOperation<'a, F, api::PaymentsCancelRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -329,7 +344,7 @@ where
_payment_data: &mut PaymentData<F>,
_storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsCancelRequest>,
+ BoxedOperation<'a, F, api::PaymentsCancelRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
Ok((Box::new(self), None))
@@ -348,10 +363,13 @@ where
}
#[async_trait]
-impl<F: Clone + Send, Op: Send + Sync + Operation<F, api::PaymentsRejectRequest>>
- Domain<F, api::PaymentsRejectRequest> for Op
+impl<
+ F: Clone + Send,
+ Ctx: PaymentMethodRetrieve,
+ Op: Send + Sync + Operation<F, api::PaymentsRejectRequest, Ctx>,
+ > Domain<F, api::PaymentsRejectRequest, Ctx> for Op
where
- for<'a> &'a Op: Operation<F, api::PaymentsRejectRequest>,
+ for<'a> &'a Op: Operation<F, api::PaymentsRejectRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -362,7 +380,7 @@ where
_merchant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRejectRequest>,
+ BoxedOperation<'a, F, api::PaymentsRejectRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -377,7 +395,7 @@ where
_payment_data: &mut PaymentData<F>,
_storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRejectRequest>,
+ BoxedOperation<'a, F, api::PaymentsRejectRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
Ok((Box::new(self), None))
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 871e906ee9d..d7b3d743b95 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -11,6 +11,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
utils as core_utils,
},
@@ -31,7 +32,9 @@ use crate::{
pub struct PaymentApprove;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentApprove {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentApprove
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -43,7 +46,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -262,7 +265,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentApprove {
+impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest, Ctx>
+ for PaymentApprove
+{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -272,7 +277,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentApprove {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -295,7 +300,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentApprove {
payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
let (op, payment_method_data) =
@@ -334,7 +339,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentApprove {
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentApprove {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentApprove
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -346,7 +353,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
_merchant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -366,14 +376,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentApprove {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::PaymentsRequest, Ctx>
+ for PaymentApprove
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRequest>,
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
let given_payment_id = match &request.payment_id {
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index f2964a4e48c..72006946c20 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -11,6 +11,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
db::StorageInterface,
@@ -29,7 +30,9 @@ use crate::{
pub struct PaymentCancel;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for PaymentCancel {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest, Ctx> for PaymentCancel
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -41,7 +44,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsCancelRequest>,
+ BoxedOperation<'a, F, api::PaymentsCancelRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -176,7 +179,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for PaymentCancel {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest, Ctx> for PaymentCancel
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -189,7 +194,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsCancelRequest>,
+ BoxedOperation<'b, F, api::PaymentsCancelRequest, Ctx>,
PaymentData<F>,
)>
where
@@ -231,14 +236,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelRequest> for
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsCancelRequest> for PaymentCancel {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ ValidateRequest<F, api::PaymentsCancelRequest, Ctx> for PaymentCancel
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsCancelRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsCancelRequest>,
+ BoxedOperation<'b, F, api::PaymentsCancelRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
Ok((
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index c3b915f9d34..bd64ebac632 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -11,6 +11,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, types::MultipleCaptureData},
},
db::StorageInterface,
@@ -29,8 +30,8 @@ use crate::{
pub struct PaymentCapture;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest>
- for PaymentCapture
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest, Ctx> for PaymentCapture
{
#[instrument(skip_all)]
async fn get_trackers<'a>(
@@ -43,7 +44,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptu
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsCaptureRequest>,
+ BoxedOperation<'a, F, api::PaymentsCaptureRequest, Ctx>,
payments::PaymentData<F>,
Option<payments::CustomerDetails>,
)> {
@@ -236,7 +237,8 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptu
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest>
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRequest, Ctx>
for PaymentCapture
{
#[instrument(skip_all)]
@@ -251,7 +253,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRe
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsCaptureRequest>,
+ BoxedOperation<'b, F, api::PaymentsCaptureRequest, Ctx>,
payments::PaymentData<F>,
)>
where
@@ -274,14 +276,16 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCaptureRe
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsCaptureRequest> for PaymentCapture {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ ValidateRequest<F, api::PaymentsCaptureRequest, Ctx> for PaymentCapture
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsCaptureRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsCaptureRequest>,
+ BoxedOperation<'b, F, api::PaymentsCaptureRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
Ok((
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 1ee7bec135f..db2c9e27c9b 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -10,6 +10,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
utils as core_utils,
},
@@ -30,7 +31,9 @@ use crate::{
pub struct CompleteAuthorize;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for CompleteAuthorize {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for CompleteAuthorize
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -42,7 +45,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -257,7 +260,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for CompleteAuthorize {
+impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest, Ctx>
+ for CompleteAuthorize
+{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -267,7 +272,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for CompleteAuthorize {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -290,7 +295,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for CompleteAuthorize {
payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
let (op, payment_method_data) =
@@ -329,7 +334,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for CompleteAuthorize {
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for CompleteAuthorize {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for CompleteAuthorize
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -341,7 +348,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Comple
_merchant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -349,14 +359,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Comple
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for CompleteAuthorize {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::PaymentsRequest, Ctx>
+ for CompleteAuthorize
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRequest>,
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
let given_payment_id = match &request.payment_id {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 2d35ef61ff6..761264e4798 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -12,6 +12,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
db::StorageInterface,
@@ -30,7 +31,9 @@ use crate::{
#[operation(ops = "all", flow = "authorize")]
pub struct PaymentConfirm;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentConfirm
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -42,7 +45,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
key_store: &domain::MerchantKeyStore,
auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -364,7 +367,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest, Ctx>
+ for PaymentConfirm
+{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -374,7 +379,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentConfirm {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -397,7 +402,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentConfirm {
payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
let (op, payment_method_data) =
@@ -436,7 +441,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentConfirm {
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentConfirm
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -448,7 +455,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
key_store: &domain::MerchantKeyStore,
frm_suggestion: Option<FrmSuggestion>,
header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -597,14 +607,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentConfirm {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::PaymentsRequest, Ctx>
+ for PaymentConfirm
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRequest>,
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
helpers::validate_customer_details_in_request(request)?;
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 17d8d5f6c3d..479b0e2ccee 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -14,6 +14,7 @@ use crate::{
consts,
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
utils::{self as core_utils},
},
@@ -39,7 +40,9 @@ pub struct PaymentCreate;
/// The `get_trackers` function for `PaymentsCreate` is an entrypoint for new payments
/// This will create all the entities required for a new payment from the request
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentCreate {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentCreate
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -51,7 +54,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
merchant_key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -231,7 +234,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.await
.transpose()?;
- let operation = payments::if_not_create_change_operation::<_, F>(
+ let operation = payments::if_not_create_change_operation::<_, F, Ctx>(
payment_intent.status,
request.confirm,
self,
@@ -299,7 +302,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentCreate {
+impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest, Ctx>
+ for PaymentCreate
+{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -309,7 +314,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentCreate {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -332,7 +337,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentCreate {
payment_data: &mut PaymentData<F>,
_storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
helpers::make_pm_data(Box::new(self), state, payment_data).await
@@ -362,7 +367,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentCreate {
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentCreate {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentCreate
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -374,7 +381,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
_merchant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -444,14 +454,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentCreate {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::PaymentsRequest, Ctx>
+ for PaymentCreate
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRequest>,
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
helpers::validate_customer_details_in_request(request)?;
diff --git a/crates/router/src/core/payments/operations/payment_method_validate.rs b/crates/router/src/core/payments/operations/payment_method_validate.rs
index 2f260ee3e0a..0ff49279f3c 100644
--- a/crates/router/src/core/payments/operations/payment_method_validate.rs
+++ b/crates/router/src/core/payments/operations/payment_method_validate.rs
@@ -12,6 +12,7 @@ use crate::{
consts,
core::{
errors::{self, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, Operation, PaymentData},
utils as core_utils,
},
@@ -31,14 +32,16 @@ use crate::{
#[operation(ops = "all", flow = "verify")]
pub struct PaymentMethodValidate;
-impl<F: Send + Clone> ValidateRequest<F, api::VerifyRequest> for PaymentMethodValidate {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::VerifyRequest, Ctx>
+ for PaymentMethodValidate
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::VerifyRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::VerifyRequest>,
+ BoxedOperation<'b, F, api::VerifyRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
let request_merchant_id = request.merchant_id.as_deref();
@@ -63,7 +66,9 @@ impl<F: Send + Clone> ValidateRequest<F, api::VerifyRequest> for PaymentMethodVa
}
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::VerifyRequest> for PaymentMethodValidate {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::VerifyRequest, Ctx> for PaymentMethodValidate
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -75,7 +80,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::VerifyRequest> for Paym
_mechant_key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::VerifyRequest>,
+ BoxedOperation<'a, F, api::VerifyRequest, Ctx>,
PaymentData<F>,
Option<payments::CustomerDetails>,
)> {
@@ -204,7 +209,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::VerifyRequest> for Paym
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::VerifyRequest> for PaymentMethodValidate {
+impl<F: Clone, Ctx: PaymentMethodRetrieve> UpdateTracker<F, PaymentData<F>, api::VerifyRequest, Ctx>
+ for PaymentMethodValidate
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -216,7 +223,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::VerifyRequest> for PaymentM
_mechant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::VerifyRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::VerifyRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -245,11 +255,11 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::VerifyRequest> for PaymentM
}
#[async_trait]
-impl<F, Op> Domain<F, api::VerifyRequest> for Op
+impl<F, Op, Ctx: PaymentMethodRetrieve> Domain<F, api::VerifyRequest, Ctx> for Op
where
F: Clone + Send,
- Op: Send + Sync + Operation<F, api::VerifyRequest>,
- for<'a> &'a Op: Operation<F, api::VerifyRequest>,
+ Op: Send + Sync + Operation<F, api::VerifyRequest, Ctx>,
+ for<'a> &'a Op: Operation<F, api::VerifyRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -260,7 +270,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::VerifyRequest>,
+ BoxedOperation<'a, F, api::VerifyRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -283,7 +293,7 @@ where
payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::VerifyRequest>,
+ BoxedOperation<'a, F, api::VerifyRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
helpers::make_pm_data(Box::new(self), state, payment_data).await
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index fe52d1b89d5..c9a24b8fb84 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -10,6 +10,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
db::StorageInterface,
@@ -28,7 +29,9 @@ use crate::{
pub struct PaymentReject;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsRejectRequest> for PaymentReject {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, PaymentsRejectRequest, Ctx> for PaymentReject
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -40,7 +43,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsRejectRequest> for P
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, PaymentsRejectRequest>,
+ BoxedOperation<'a, F, PaymentsRejectRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -162,7 +165,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, PaymentsRejectRequest> for P
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, PaymentsRejectRequest> for PaymentReject {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, PaymentsRejectRequest, Ctx> for PaymentReject
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -174,7 +179,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, PaymentsRejectRequest> for Payme
_mechant_key_store: &domain::MerchantKeyStore,
_should_decline_transaction: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, PaymentsRejectRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, PaymentsRejectRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -220,14 +228,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, PaymentsRejectRequest> for Payme
}
}
-impl<F: Send + Clone> ValidateRequest<F, PaymentsRejectRequest> for PaymentReject {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, PaymentsRejectRequest, Ctx>
+ for PaymentReject
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &PaymentsRejectRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, PaymentsRejectRequest>,
+ BoxedOperation<'b, F, PaymentsRejectRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
Ok((
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index d3cb4f818f0..712515b2e87 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
mandate,
+ payment_methods::PaymentMethodRetrieve,
payments::{types::MultipleCaptureData, PaymentData},
utils as core_utils,
},
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 938441962b2..261275296f1 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -11,6 +11,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, PaymentData},
},
db::StorageInterface,
@@ -29,8 +30,8 @@ use crate::{
pub struct PaymentSession;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
- for PaymentSession
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest, Ctx> for PaymentSession
{
#[instrument(skip_all)]
async fn get_trackers<'a>(
@@ -43,7 +44,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsSessionRequest>,
+ BoxedOperation<'a, F, api::PaymentsSessionRequest, Ctx>,
PaymentData<F>,
Option<payments::CustomerDetails>,
)> {
@@ -198,7 +199,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest> for PaymentSession {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest, Ctx> for PaymentSession
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -211,7 +214,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest> for
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsSessionRequest>,
+ BoxedOperation<'b, F, api::PaymentsSessionRequest, Ctx>,
PaymentData<F>,
)>
where
@@ -234,14 +237,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionRequest> for
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsSessionRequest> for PaymentSession {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ ValidateRequest<F, api::PaymentsSessionRequest, Ctx> for PaymentSession
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsSessionRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsSessionRequest>,
+ BoxedOperation<'b, F, api::PaymentsSessionRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
//paymentid is already generated and should be sent in the request
@@ -261,10 +266,13 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsSessionRequest> for Paymen
}
#[async_trait]
-impl<F: Clone + Send, Op: Send + Sync + Operation<F, api::PaymentsSessionRequest>>
- Domain<F, api::PaymentsSessionRequest> for Op
+impl<
+ F: Clone + Send,
+ Ctx: PaymentMethodRetrieve,
+ Op: Send + Sync + Operation<F, api::PaymentsSessionRequest, Ctx>,
+ > Domain<F, api::PaymentsSessionRequest, Ctx> for Op
where
- for<'a> &'a Op: Operation<F, api::PaymentsSessionRequest>,
+ for<'a> &'a Op: Operation<F, api::PaymentsSessionRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -275,7 +283,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> errors::CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsSessionRequest>,
+ BoxedOperation<'a, F, api::PaymentsSessionRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -298,7 +306,7 @@ where
_payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsSessionRequest>,
+ BoxedOperation<'b, F, api::PaymentsSessionRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
//No payment method data for this operation
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 2d34d409979..07015810039 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -10,6 +10,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
db::StorageInterface,
@@ -28,7 +29,9 @@ use crate::{
pub struct PaymentStart;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> for PaymentStart {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsStartRequest, Ctx> for PaymentStart
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -40,7 +43,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
mechant_key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsStartRequest>,
+ BoxedOperation<'a, F, api::PaymentsStartRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -171,7 +174,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest> for PaymentStart {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest, Ctx> for PaymentStart
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -184,7 +189,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest> for P
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsStartRequest>,
+ BoxedOperation<'b, F, api::PaymentsStartRequest, Ctx>,
PaymentData<F>,
)>
where
@@ -194,14 +199,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest> for P
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsStartRequest> for PaymentStart {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::PaymentsStartRequest, Ctx>
+ for PaymentStart
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsStartRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsStartRequest>,
+ BoxedOperation<'b, F, api::PaymentsStartRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
let request_merchant_id = Some(&request.merchant_id[..]);
@@ -227,10 +234,13 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsStartRequest> for PaymentS
}
#[async_trait]
-impl<F: Clone + Send, Op: Send + Sync + Operation<F, api::PaymentsStartRequest>>
- Domain<F, api::PaymentsStartRequest> for Op
+impl<
+ F: Clone + Send,
+ Ctx: PaymentMethodRetrieve,
+ Op: Send + Sync + Operation<F, api::PaymentsStartRequest, Ctx>,
+ > Domain<F, api::PaymentsStartRequest, Ctx> for Op
where
- for<'a> &'a Op: Operation<F, api::PaymentsStartRequest>,
+ for<'a> &'a Op: Operation<F, api::PaymentsStartRequest, Ctx>,
{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
@@ -241,7 +251,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsStartRequest>,
+ BoxedOperation<'a, F, api::PaymentsStartRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -264,7 +274,7 @@ where
payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsStartRequest>,
+ BoxedOperation<'a, F, api::PaymentsStartRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
if payment_data
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 80830efd13d..6e0ef2f4bac 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -11,7 +11,11 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
- payments::{helpers, operations, types, CustomerDetails, PaymentAddress, PaymentData},
+ payment_methods::PaymentMethodRetrieve,
+ payments::{
+ helpers, operations, types as payment_types, CustomerDetails, PaymentAddress,
+ PaymentData,
+ },
},
db::StorageInterface,
routes::AppState,
@@ -27,31 +31,39 @@ use crate::{
#[operation(ops = "all", flow = "sync")]
pub struct PaymentStatus;
-impl<F: Send + Clone> Operation<F, api::PaymentsRequest> for PaymentStatus {
- fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsRequest>> {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> Operation<F, api::PaymentsRequest, Ctx>
+ for PaymentStatus
+{
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsRequest, Ctx>> {
Ok(self)
}
fn to_update_tracker(
&self,
- ) -> RouterResult<&(dyn UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> + Send + Sync)>
- {
+ ) -> RouterResult<
+ &(dyn UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> + Send + Sync),
+ > {
Ok(self)
}
}
-impl<F: Send + Clone> Operation<F, api::PaymentsRequest> for &PaymentStatus {
- fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsRequest>> {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> Operation<F, api::PaymentsRequest, Ctx>
+ for &PaymentStatus
+{
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, api::PaymentsRequest, Ctx>> {
Ok(*self)
}
fn to_update_tracker(
&self,
- ) -> RouterResult<&(dyn UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> + Send + Sync)>
- {
+ ) -> RouterResult<
+ &(dyn UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> + Send + Sync),
+ > {
Ok(*self)
}
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentStatus {
+impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest, Ctx>
+ for PaymentStatus
+{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -61,7 +73,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentStatus {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -84,7 +96,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentStatus {
payment_data: &mut PaymentData<F>,
_storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
helpers::make_pm_data(Box::new(self), state, payment_data).await
@@ -114,7 +126,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentStatus {
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentStatus {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentStatus
+{
async fn update_trackers<'b>(
&'b self,
_db: &dyn StorageInterface,
@@ -125,7 +139,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -134,7 +151,9 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest> for PaymentStatus {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest, Ctx> for PaymentStatus
+{
async fn update_trackers<'b>(
&'b self,
_db: &dyn StorageInterface,
@@ -146,7 +165,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest> fo
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRetrieveRequest>,
+ BoxedOperation<'b, F, api::PaymentsRetrieveRequest, Ctx>,
PaymentData<F>,
)>
where
@@ -157,8 +176,8 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest> fo
}
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest>
- for PaymentStatus
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest, Ctx> for PaymentStatus
{
#[instrument(skip_all)]
async fn get_trackers<'a>(
@@ -171,7 +190,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRetrieveRequest>,
+ BoxedOperation<'a, F, api::PaymentsRetrieveRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -191,7 +210,8 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRetrieveRequest
async fn get_tracker_for_sync<
'a,
F: Send + Clone,
- Op: Operation<F, api::PaymentsRetrieveRequest> + 'a + Send + Sync,
+ Ctx: PaymentMethodRetrieve,
+ Op: Operation<F, api::PaymentsRetrieveRequest, Ctx> + 'a + Send + Sync,
>(
payment_id: &api::PaymentIdType,
merchant_account: &domain::MerchantAccount,
@@ -201,7 +221,7 @@ async fn get_tracker_for_sync<
operation: Op,
storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRetrieveRequest>,
+ BoxedOperation<'a, F, api::PaymentsRetrieveRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -282,7 +302,7 @@ async fn get_tracker_for_sync<
.attach_printable_lazy(|| {
format!("Error while retrieving capture list for, merchant_id: {}, payment_id: {payment_id_str}", merchant_account.merchant_id)
})?;
- Some(types::MultipleCaptureData::new_for_sync(
+ Some(payment_types::MultipleCaptureData::new_for_sync(
captures,
request.expand_captures,
)?)
@@ -388,13 +408,15 @@ async fn get_tracker_for_sync<
))
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRetrieveRequest> for PaymentStatus {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ ValidateRequest<F, api::PaymentsRetrieveRequest, Ctx> for PaymentStatus
+{
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsRetrieveRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRetrieveRequest>,
+ BoxedOperation<'b, F, api::PaymentsRetrieveRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
let request_merchant_id = request.merchant_id.as_deref();
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 04f36d51c2c..9e0ef76d3e7 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -11,6 +11,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
utils as core_utils,
},
@@ -30,7 +31,9 @@ use crate::{
pub struct PaymentUpdate;
#[async_trait]
-impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentUpdate {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
+ GetTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentUpdate
+{
#[instrument(skip_all)]
async fn get_trackers<'a>(
&'a self,
@@ -42,7 +45,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
key_store: &domain::MerchantKeyStore,
auth_flow: services::AuthFlow,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
PaymentData<F>,
Option<CustomerDetails>,
)> {
@@ -268,7 +271,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
})
.await
.transpose()?;
- let next_operation: BoxedOperation<'a, F, api::PaymentsRequest> =
+ let next_operation: BoxedOperation<'a, F, api::PaymentsRequest, Ctx> =
if request.confirm.unwrap_or(false) {
Box::new(operations::PaymentConfirm)
} else {
@@ -350,7 +353,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}
#[async_trait]
-impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentUpdate {
+impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest, Ctx>
+ for PaymentUpdate
+{
#[instrument(skip_all)]
async fn get_or_create_customer_details<'a>(
&'a self,
@@ -360,7 +365,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentUpdate {
key_store: &domain::MerchantKeyStore,
) -> CustomResult<
(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<domain::Customer>,
),
errors::StorageError,
@@ -383,7 +388,7 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentUpdate {
payment_data: &mut PaymentData<F>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> RouterResult<(
- BoxedOperation<'a, F, api::PaymentsRequest>,
+ BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
Option<api::PaymentMethodData>,
)> {
helpers::make_pm_data(Box::new(self), state, payment_data).await
@@ -413,7 +418,9 @@ impl<F: Clone + Send> Domain<F, api::PaymentsRequest> for PaymentUpdate {
}
#[async_trait]
-impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for PaymentUpdate {
+impl<F: Clone, Ctx: PaymentMethodRetrieve>
+ UpdateTracker<F, PaymentData<F>, api::PaymentsRequest, Ctx> for PaymentUpdate
+{
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
@@ -425,7 +432,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: api::HeaderPayload,
- ) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest>, PaymentData<F>)>
+ ) -> RouterResult<(
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
+ PaymentData<F>,
+ )>
where
F: 'b + Send,
{
@@ -556,14 +566,16 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
}
}
-impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentUpdate {
+impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::PaymentsRequest, Ctx>
+ for PaymentUpdate
+{
#[instrument(skip_all)]
fn validate_request<'a, 'b>(
&'b self,
request: &api::PaymentsRequest,
merchant_account: &'a domain::MerchantAccount,
) -> RouterResult<(
- BoxedOperation<'b, F, api::PaymentsRequest>,
+ BoxedOperation<'b, F, api::PaymentsRequest, Ctx>,
operations::ValidateResult<'a>,
)> {
helpers::validate_customer_details_in_request(request)?;
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index b647c8a97d7..530d445b50d 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -20,6 +20,7 @@ use crate::{
core::{
api_locking,
errors::{self, ConnectorErrorExt, CustomResult, RouterResponse},
+ payment_methods::PaymentMethodRetrieve,
payments, refunds,
},
db::StorageInterface,
@@ -39,7 +40,10 @@ use crate::{
const OUTGOING_WEBHOOK_TIMEOUT_SECS: u64 = 5;
const MERCHANT_ID: &str = "merchant_id";
-pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
+pub async fn payments_incoming_webhook_flow<
+ W: types::OutgoingWebhookType,
+ Ctx: PaymentMethodRetrieve,
+>(
state: AppState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
@@ -74,27 +78,28 @@ pub async fn payments_incoming_webhook_flow<W: types::OutgoingWebhookType>(
.perform_locking_action(&state, merchant_account.merchant_id.to_string())
.await?;
- let response = payments::payments_core::<api::PSync, api::PaymentsResponse, _, _, _>(
- state.clone(),
- merchant_account.clone(),
- key_store,
- payments::operations::PaymentStatus,
- api::PaymentsRetrieveRequest {
- resource_id: id,
- merchant_id: Some(merchant_account.merchant_id.clone()),
- force_sync: true,
- connector: None,
- param: None,
- merchant_connector_details: None,
- client_secret: None,
- expand_attempts: None,
- expand_captures: None,
- },
- services::AuthFlow::Merchant,
- consume_or_trigger_flow,
- HeaderPayload::default(),
- )
- .await;
+ let response =
+ payments::payments_core::<api::PSync, api::PaymentsResponse, _, _, _, Ctx>(
+ state.clone(),
+ merchant_account.clone(),
+ key_store,
+ payments::operations::PaymentStatus,
+ api::PaymentsRetrieveRequest {
+ resource_id: id,
+ merchant_id: Some(merchant_account.merchant_id.clone()),
+ force_sync: true,
+ connector: None,
+ param: None,
+ merchant_connector_details: None,
+ client_secret: None,
+ expand_attempts: None,
+ expand_captures: None,
+ },
+ services::AuthFlow::Merchant,
+ consume_or_trigger_flow,
+ HeaderPayload::default(),
+ )
+ .await;
lock_action
.free_lock_action(&state, merchant_account.merchant_id.to_owned())
@@ -531,7 +536,7 @@ pub async fn disputes_incoming_webhook_flow<W: types::OutgoingWebhookType>(
}
}
-async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType>(
+async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetrieve>(
state: AppState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
@@ -553,7 +558,7 @@ async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType>(
payment_token: payment_attempt.payment_token,
..Default::default()
};
- payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _, Ctx>(
state.clone(),
merchant_account.to_owned(),
key_store,
@@ -824,7 +829,7 @@ pub async fn trigger_webhook_to_merchant<W: types::OutgoingWebhookType>(
Ok(())
}
-pub async fn webhooks_wrapper<W: types::OutgoingWebhookType>(
+pub async fn webhooks_wrapper<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetrieve>(
state: AppState,
req: &actix_web::HttpRequest,
merchant_account: domain::MerchantAccount,
@@ -832,7 +837,7 @@ pub async fn webhooks_wrapper<W: types::OutgoingWebhookType>(
connector_name_or_mca_id: &str,
body: actix_web::web::Bytes,
) -> RouterResponse<serde_json::Value> {
- let (application_response, _webhooks_response_tracker) = webhooks_core::<W>(
+ let (application_response, _webhooks_response_tracker) = webhooks_core::<W, Ctx>(
state,
req,
merchant_account,
@@ -846,7 +851,8 @@ pub async fn webhooks_wrapper<W: types::OutgoingWebhookType>(
}
#[instrument(skip_all)]
-pub async fn webhooks_core<W: types::OutgoingWebhookType>(
+
+pub async fn webhooks_core<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetrieve>(
state: AppState,
req: &actix_web::HttpRequest,
merchant_account: domain::MerchantAccount,
@@ -1044,7 +1050,7 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
};
match flow_type {
- api::WebhookFlow::Payment => payments_incoming_webhook_flow::<W>(
+ api::WebhookFlow::Payment => payments_incoming_webhook_flow::<W, Ctx>(
state.clone(),
merchant_account,
key_store,
@@ -1078,7 +1084,7 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
.await
.attach_printable("Incoming webhook flow for disputes failed")?,
- api::WebhookFlow::BankTransfer => bank_transfer_webhook_flow::<W>(
+ api::WebhookFlow::BankTransfer => bank_transfer_webhook_flow::<W, Ctx>(
state.clone(),
merchant_account,
key_store,
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 9d7cf220a3a..b760aa83aaa 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -10,6 +10,7 @@ use crate::{
self as app,
core::{
errors::http_not_implemented,
+ payment_methods::{Oss, PaymentMethodRetrieve},
payments::{self, PaymentRedirectFlow},
},
openapi::examples::{
@@ -106,7 +107,7 @@ pub async fn payments_create(
&req,
payload,
|state, auth, req| {
- authorize_verify_select(
+ authorize_verify_select::<_, Oss>(
payments::PaymentCreate,
state,
auth.merchant_account,
@@ -160,8 +161,15 @@ pub async fn payments_start(
state,
&req,
payload,
- |state,auth, req| {
- payments::payments_core::<api_types::Authorize, payment_types::PaymentsResponse, _, _, _>(
+ |state, auth, req| {
+ payments::payments_core::<
+ api_types::Authorize,
+ payment_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
state,
auth.merchant_account,
auth.key_store,
@@ -227,7 +235,7 @@ pub async fn payments_retrieve(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -288,7 +296,7 @@ pub async fn payments_retrieve_with_gateway_creds(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -354,7 +362,7 @@ pub async fn payments_update(
&req,
payload,
|state, auth, req| {
- authorize_verify_select(
+ authorize_verify_select::<_, Oss>(
payments::PaymentUpdate,
state,
auth.merchant_account,
@@ -430,7 +438,7 @@ pub async fn payments_confirm(
&req,
payload,
|state, auth, req| {
- authorize_verify_select(
+ authorize_verify_select::<_, Oss>(
payments::PaymentConfirm,
state,
auth.merchant_account,
@@ -485,7 +493,14 @@ pub async fn payments_capture(
&req,
payload,
|state, auth, payload| {
- payments::payments_core::<api_types::Capture, payment_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<
+ api_types::Capture,
+ payment_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
state,
auth.merchant_account,
auth.key_store,
@@ -539,6 +554,7 @@ pub async fn payments_connector_session(
_,
_,
_,
+ Oss,
>(
state,
auth.merchant_account,
@@ -600,7 +616,8 @@ pub async fn payments_redirect_response(
&req,
payload,
|state, auth, req| {
- payments::PaymentRedirectSync {}.handle_payments_redirect_response(
+ <payments::PaymentRedirectSync as PaymentRedirectFlow<Oss>>::handle_payments_redirect_response(
+ &payments::PaymentRedirectSync {},
state,
auth.merchant_account,
auth.key_store,
@@ -657,7 +674,8 @@ pub async fn payments_redirect_response_with_creds_identifier(
&req,
payload,
|state, auth, req| {
- payments::PaymentRedirectSync {}.handle_payments_redirect_response(
+ <payments::PaymentRedirectSync as PaymentRedirectFlow<Oss>>::handle_payments_redirect_response(
+ &payments::PaymentRedirectSync {},
state,
auth.merchant_account,
auth.key_store,
@@ -696,7 +714,9 @@ pub async fn payments_complete_authorize(
&req,
payload,
|state, auth, req| {
- payments::PaymentRedirectCompleteAuthorize {}.handle_payments_redirect_response(
+
+ <payments::PaymentRedirectCompleteAuthorize as PaymentRedirectFlow<Oss>>::handle_payments_redirect_response(
+ &payments::PaymentRedirectCompleteAuthorize {},
state,
auth.merchant_account,
auth.key_store,
@@ -745,7 +765,7 @@ pub async fn payments_cancel(
&req,
payload,
|state, auth, req| {
- payments::payments_core::<api_types::Void, payment_types::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api_types::Void, payment_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@@ -846,7 +866,7 @@ pub async fn get_filters_for_payments(
)
.await
}
-async fn authorize_verify_select<Op>(
+async fn authorize_verify_select<Op, Ctx>(
operation: Op,
state: app::AppState,
merchant_account: domain::MerchantAccount,
@@ -856,13 +876,18 @@ async fn authorize_verify_select<Op>(
auth_flow: api::AuthFlow,
) -> app::core::errors::RouterResponse<api_models::payments::PaymentsResponse>
where
+ Ctx: PaymentMethodRetrieve,
Op: Sync
+ Clone
+ std::fmt::Debug
- + payments::operations::Operation<api_types::Authorize, api_models::payments::PaymentsRequest>
+ payments::operations::Operation<
+ api_types::Authorize,
+ api_models::payments::PaymentsRequest,
+ Ctx,
+ > + payments::operations::Operation<
api_types::SetupMandate,
api_models::payments::PaymentsRequest,
+ Ctx,
>,
{
// TODO: Change for making it possible for the flow to be inferred internally or through validation layer
@@ -874,23 +899,26 @@ where
match req.payment_type.unwrap_or_default() {
api_models::enums::PaymentType::Normal
| api_models::enums::PaymentType::RecurringMandate
- | api_models::enums::PaymentType::NewMandate => payments::payments_core::<
- api_types::Authorize,
- payment_types::PaymentsResponse,
- _,
- _,
- _,
- >(
- state,
- merchant_account,
- key_store,
- operation,
- req,
- auth_flow,
- payments::CallConnectorAction::Trigger,
- header_payload,
- )
- .await,
+ | api_models::enums::PaymentType::NewMandate => {
+ payments::payments_core::<
+ api_types::Authorize,
+ payment_types::PaymentsResponse,
+ _,
+ _,
+ _,
+ Ctx,
+ >(
+ state,
+ merchant_account,
+ key_store,
+ operation,
+ req,
+ auth_flow,
+ payments::CallConnectorAction::Trigger,
+ header_payload,
+ )
+ .await
+ }
api_models::enums::PaymentType::SetupMandate => {
payments::payments_core::<
api_types::SetupMandate,
@@ -898,6 +926,7 @@ where
_,
_,
_,
+ Ctx,
>(
state,
merchant_account,
diff --git a/crates/router/src/routes/webhooks.rs b/crates/router/src/routes/webhooks.rs
index 0bbc6add436..f9fee54d16f 100644
--- a/crates/router/src/routes/webhooks.rs
+++ b/crates/router/src/routes/webhooks.rs
@@ -5,6 +5,7 @@ use super::app::AppState;
use crate::{
core::{
api_locking,
+ payment_methods::Oss,
webhooks::{self, types},
},
services::{api, authentication as auth},
@@ -26,7 +27,7 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
&req,
body,
|state, auth, body| {
- webhooks::webhooks_wrapper::<W>(
+ webhooks::webhooks_wrapper::<W, Oss>(
state.to_owned(),
&req,
auth.merchant_account,
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index 744cce31327..4dbf97081a6 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -8,7 +8,10 @@ use scheduler::{
};
use crate::{
- core::payments::{self as payment_flows, operations},
+ core::{
+ payment_methods::Oss,
+ payments::{self as payment_flows, operations},
+ },
db::StorageInterface,
errors,
routes::AppState,
@@ -55,7 +58,7 @@ impl ProcessTrackerWorkflow<AppState> for PaymentsSyncWorkflow {
.await?;
let (payment_data, _, _, _) =
- payment_flows::payments_operation_core::<api::PSync, _, _, _>(
+ payment_flows::payments_operation_core::<api::PSync, _, _, _, Oss>(
state,
merchant_account.clone(),
key_store,
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 1bff639d346..551960ac138 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -4,7 +4,7 @@ mod utils;
use router::{
configs,
- core::payments,
+ core::{payment_methods::Oss, payments},
db::StorageImpl,
routes, services,
types::{
@@ -361,7 +361,7 @@ async fn payments_create_core() {
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
let actual_response =
- payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _, Oss>(
state,
merchant_account,
key_store,
@@ -531,7 +531,7 @@ async fn payments_create_core_adyen_no_redirect() {
vec![],
));
let actual_response =
- payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
+ payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _, Oss>(
state,
merchant_account,
key_store,
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 91b2a454eea..96ed131dc6f 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -3,7 +3,7 @@
mod utils;
use router::{
- core::payments,
+ core::{payment_methods::Oss, payments},
db::StorageImpl,
types::api::{self, enums as api_enums},
*,
@@ -120,19 +120,25 @@ async fn payments_create_core() {
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
- let actual_response =
- router::core::payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
- state,
- merchant_account,
- key_store,
- payments::PaymentCreate,
- req,
- services::AuthFlow::Merchant,
- payments::CallConnectorAction::Trigger,
- api::HeaderPayload::default(),
- )
- .await
- .unwrap();
+ let actual_response = router::core::payments::payments_core::<
+ api::Authorize,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
+ state,
+ merchant_account,
+ key_store,
+ payments::PaymentCreate,
+ req,
+ services::AuthFlow::Merchant,
+ payments::CallConnectorAction::Trigger,
+ api::HeaderPayload::default(),
+ )
+ .await
+ .unwrap();
assert_eq!(expected_response, actual_response);
}
@@ -292,18 +298,24 @@ async fn payments_create_core_adyen_no_redirect() {
},
vec![],
));
- let actual_response =
- router::core::payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _>(
- state,
- merchant_account,
- key_store,
- payments::PaymentCreate,
- req,
- services::AuthFlow::Merchant,
- payments::CallConnectorAction::Trigger,
- api::HeaderPayload::default(),
- )
- .await
- .unwrap();
+ let actual_response = router::core::payments::payments_core::<
+ api::Authorize,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
+ state,
+ merchant_account,
+ key_store,
+ payments::PaymentCreate,
+ req,
+ services::AuthFlow::Merchant,
+ payments::CallConnectorAction::Trigger,
+ api::HeaderPayload::default(),
+ )
+ .await
+ .unwrap();
assert_eq!(expected_response, actual_response);
}
diff --git a/crates/router_derive/src/macros/operation.rs b/crates/router_derive/src/macros/operation.rs
index cf71370a293..fb0ef35ef58 100644
--- a/crates/router_derive/src/macros/operation.rs
+++ b/crates/router_derive/src/macros/operation.rs
@@ -61,7 +61,7 @@ impl Derives {
let req_type = Conversion::get_req_type(self);
quote! {
#[automatically_derived]
- impl<F:Send+Clone> Operation<F,#req_type> for #struct_name {
+ impl<F:Send+Clone,Ctx: PaymentMethodRetrieve,> Operation<F,#req_type,Ctx> for #struct_name {
#(#fns)*
}
}
@@ -75,7 +75,7 @@ impl Derives {
let req_type = Conversion::get_req_type(self);
quote! {
#[automatically_derived]
- impl<F:Send+Clone> Operation<F,#req_type> for &#struct_name {
+ impl<F:Send+Clone,Ctx: PaymentMethodRetrieve,> Operation<F,#req_type,Ctx> for &#struct_name {
#(#ref_fns)*
}
}
@@ -138,22 +138,22 @@ impl Conversion {
let req_type = Self::get_req_type(ident);
match self {
Self::ValidateRequest => quote! {
- fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F,#req_type> + Send + Sync)> {
+ fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F,#req_type,Ctx> + Send + Sync)> {
Ok(self)
}
},
Self::GetTracker => quote! {
- fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<F,PaymentData<F>,#req_type> + Send + Sync)> {
+ fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<F,PaymentData<F>,#req_type,Ctx> + Send + Sync)> {
Ok(self)
}
},
Self::Domain => quote! {
- fn to_domain(&self) -> RouterResult<&dyn Domain<F,#req_type>> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F,#req_type,Ctx>> {
Ok(self)
}
},
Self::UpdateTracker => quote! {
- fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<F,PaymentData<F>,#req_type> + Send + Sync)> {
+ fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<F,PaymentData<F>,#req_type,Ctx> + Send + Sync)> {
Ok(self)
}
},
@@ -186,22 +186,22 @@ impl Conversion {
let req_type = Self::get_req_type(ident);
match self {
Self::ValidateRequest => quote! {
- fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F,#req_type> + Send + Sync)> {
+ fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F,#req_type,Ctx> + Send + Sync)> {
Ok(*self)
}
},
Self::GetTracker => quote! {
- fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<F,PaymentData<F>,#req_type> + Send + Sync)> {
+ fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<F,PaymentData<F>,#req_type,Ctx> + Send + Sync)> {
Ok(*self)
}
},
Self::Domain => quote! {
- fn to_domain(&self) -> RouterResult<&(dyn Domain<F,#req_type>)> {
+ fn to_domain(&self) -> RouterResult<&(dyn Domain<F,#req_type,Ctx>)> {
Ok(*self)
}
},
Self::UpdateTracker => quote! {
- fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<F,PaymentData<F>,#req_type> + Send + Sync)> {
+ fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<F,PaymentData<F>,#req_type,Ctx> + Send + Sync)> {
Ok(*self)
}
},
|
refactor
|
add support for passing context generic to api calls (#2433)
|
055f62858e6d0bcc6d27f563b30804365106d4a6
|
2025-02-12 12:58:05
|
Pa1NarK
|
refactor(cypress): make amount configurable (#7219)
| false
|
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index d5bdd190e95..b317366dbf2 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -19,7 +19,7 @@ const successfulThreeDSTestCardDetails = {
const failedNo3DSCardDetails = {
card_number: "4242424242424242",
card_exp_month: "01",
- card_exp_year: "25",
+ card_exp_year: "35",
card_holder_name: "joseph Doe",
card_cvc: "123",
};
@@ -75,7 +75,7 @@ export const connectorDetails = {
},
PaymentIntentOffSession: {
Request: {
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
currency: "USD",
customer_acceptance: null,
@@ -98,7 +98,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -116,9 +116,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
@@ -212,32 +212,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: 0,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: 0,
},
},
@@ -259,7 +256,7 @@ export const connectorDetails = {
}),
Refund: {
Request: {
- currency: "USD",
+ amount: 6000,
},
Response: {
status: 200,
@@ -270,7 +267,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- currency: "USD",
+ amount: 2000,
},
Response: {
status: 200,
@@ -281,12 +278,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 400,
@@ -302,12 +294,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 400,
@@ -322,9 +309,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- currency: "USD",
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
index 0c8a8803254..ef953956c5d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
@@ -68,7 +68,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Request: {
currency: "USD",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
@@ -89,7 +89,7 @@ export const connectorDetails = {
status: 200,
body: {
status: "requires_payment_method",
- amount: 6500,
+ amount: 6000,
shipping_cost: 50,
},
},
@@ -108,9 +108,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
@@ -172,32 +172,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -212,12 +209,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -229,12 +221,7 @@ export const connectorDetails = {
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -245,12 +232,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -261,12 +243,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -276,14 +253,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js b/cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js
index f27b7ef76c1..b80701468ac 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js
@@ -32,14 +32,14 @@ export const connectorDetails = {
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
- amount: 6500,
+ amount: 6000,
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
- amount: 6500,
+ amount: 6000,
shipping_cost: 50,
},
},
@@ -58,9 +58,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
@@ -140,32 +140,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -180,12 +177,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -196,12 +188,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -212,12 +199,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -228,12 +210,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -243,14 +220,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
index 9679b70866b..742b9daf50d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
@@ -48,7 +48,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -66,7 +66,7 @@ export const connectorDetails = {
body: {
status: "processing",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -136,31 +136,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -175,11 +173,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -190,11 +184,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -205,11 +195,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -220,11 +206,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -234,13 +216,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index f021a0a98fb..0f551c97c63 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -567,7 +567,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
}),
@@ -649,16 +649,13 @@ export const connectorDetails = {
}),
Capture: getCustomExchange({
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
}),
PartialCapture: getCustomExchange({
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
}),
Void: getCustomExchange({
Request: {},
@@ -704,32 +701,12 @@ export const connectorDetails = {
}),
Refund: getCustomExchange({
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
- ResponseCustom: {
- status: 400,
- body: {
- error: {
- type: "invalid_request",
- message: "The refund amount exceeds the amount captured",
- code: "IR_13",
- },
- },
+ amount: 6000,
},
}),
manualPaymentRefund: getCustomExchange({
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -740,12 +717,7 @@ export const connectorDetails = {
}),
manualPaymentPartialRefund: getCustomExchange({
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -756,24 +728,10 @@ export const connectorDetails = {
}),
PartialRefund: getCustomExchange({
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
- }),
- SyncRefund: getCustomExchange({
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
}),
+ SyncRefund: getCustomExchange({}),
MandateSingleUse3DSAutoCapture: getCustomExchange({
Request: {
payment_method: "card",
@@ -1336,14 +1294,7 @@ export const connectorDetails = {
},
CaptureGreaterAmount: {
Request: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
+ amount_to_capture: 6000000,
},
Response: {
status: 400,
@@ -1359,12 +1310,7 @@ export const connectorDetails = {
CaptureCapturedAmount: getCustomExchange({
Request: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
},
Response: {
@@ -1400,6 +1346,21 @@ export const connectorDetails = {
},
},
}),
+ RefundGreaterAmount: {
+ Request: {
+ amount: 6000000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "The refund amount exceeds the amount captured",
+ code: "IR_13",
+ },
+ },
+ },
+ },
MITAutoCapture: getCustomExchange({
Request: {},
Response: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js
index 804f9aca0dc..ae06e28332c 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js
@@ -136,7 +136,7 @@ export const connectorDetails = {
},
Request: {
currency: "USD",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
@@ -176,7 +176,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -194,9 +194,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
@@ -306,19 +306,14 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: null,
},
},
@@ -329,13 +324,15 @@ export const connectorDetails = {
value: "connector_1",
},
},
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: null,
},
},
@@ -361,12 +358,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -382,12 +374,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 400,
@@ -408,12 +395,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 400,
@@ -434,12 +416,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -454,14 +431,6 @@ export const connectorDetails = {
value: "connector_1",
},
},
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
@@ -471,14 +440,14 @@ export const connectorDetails = {
},
IncrementalAuth: {
Request: {
- amount: 7000,
+ amount: 6000,
},
Response: {
status: 200,
body: {
status: "requires_capture",
- amount: 7000,
- amount_capturable: 7000,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: null,
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Datatrans.js b/cypress-tests/cypress/e2e/configs/Payment/Datatrans.js
index 13bbf7e7d34..57e28b86224 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Datatrans.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Datatrans.js
@@ -57,32 +57,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -97,12 +94,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -113,12 +105,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -128,14 +115,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js b/cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js
index 591e6c8869e..7e669ffb502 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js
@@ -99,31 +99,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successful3DSCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -132,11 +130,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successful3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -150,11 +144,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successful3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -168,11 +158,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successful3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -186,11 +172,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successful3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Elavon.js b/cypress-tests/cypress/e2e/configs/Payment/Elavon.js
index 6755dd16e70..d15d2174563 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Elavon.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Elavon.js
@@ -120,12 +120,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -136,12 +131,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -424,43 +414,35 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -484,12 +466,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -499,14 +476,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js b/cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js
index 1460b474220..9ee05d419c1 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js
@@ -57,32 +57,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "EUR",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -97,12 +94,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "EUR",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -113,12 +105,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "EUR",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -128,14 +115,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "EUR",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
index a707643248e..74ffd403699 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
@@ -132,32 +132,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -172,12 +169,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -188,12 +180,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -203,14 +190,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
@@ -384,7 +363,7 @@ export const connectorDetails = {
},
PaymentIntentOffSession: {
Request: {
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
currency: "USD",
customer_acceptance: null,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js b/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js
index 47772896955..bbd099edf84 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js
@@ -160,7 +160,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- amount: 6500,
+ amount: 6000,
},
Response: {
status: 200,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js b/cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js
index 36e53ffd995..9290367b8b8 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js
@@ -100,31 +100,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -133,11 +131,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 501,
@@ -153,11 +147,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 501,
@@ -173,11 +163,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 501,
@@ -193,11 +179,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 501,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nexixpay.js b/cypress-tests/cypress/e2e/configs/Payment/Nexixpay.js
index 3b77a0ad6e7..b4b0bdb2136 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Nexixpay.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Nexixpay.js
@@ -75,7 +75,7 @@ export const connectorDetails = {
PaymentIntent: {
Request: {
currency: "EUR",
- amount: 6500,
+ amount: 6000,
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
@@ -90,7 +90,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Request: {
currency: "EUR",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
@@ -180,18 +180,14 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: null,
},
},
@@ -200,14 +196,16 @@ export const connectorDetails = {
Configs: {
TRIGGER_SKIP: true,
},
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
- amount_received: 100,
+ amount: 6000,
+ amount_capturable: 6000,
+ amount_received: 2000,
},
},
},
@@ -225,11 +223,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -243,11 +237,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -257,13 +247,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
@@ -410,12 +393,7 @@ export const connectorDetails = {
TRIGGER_SKIP: true,
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- currency: "EUR",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -453,7 +431,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
- amount: 6500,
+ amount: 6000,
mandate_data: null,
customer_acceptance: customerAcceptance,
},
@@ -474,7 +452,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
- amount: 6500,
+ amount: 6000,
mandate_data: null,
customer_acceptance: customerAcceptance,
},
@@ -495,7 +473,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
- amount: 6500,
+ amount: 6000,
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
@@ -517,7 +495,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
- amount: 6500,
+ amount: 6000,
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
index e8cdd97e7a7..d39b45172af 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
@@ -48,7 +48,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -66,7 +66,7 @@ export const connectorDetails = {
body: {
status: "processing",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -136,29 +136,27 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
},
},
},
@@ -187,11 +185,7 @@ export const connectorDetails = {
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -202,11 +196,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -217,11 +207,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -232,11 +218,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -246,13 +228,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Noon.js b/cypress-tests/cypress/e2e/configs/Payment/Noon.js
index 63f6b631732..61733a1aa3d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Noon.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Noon.js
@@ -101,7 +101,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Request: {
currency: "AED",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
@@ -125,7 +125,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -143,7 +143,7 @@ export const connectorDetails = {
body: {
status: "requires_customer_action",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -227,29 +227,27 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
},
},
@@ -265,12 +263,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "AED",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -281,12 +274,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "AED",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -298,11 +286,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -314,11 +298,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -328,13 +308,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js b/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js
index 1025b474114..bafb45d0343 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js
@@ -151,31 +151,29 @@ export const connectorDetails = {
// },
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -190,11 +188,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -205,11 +199,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -219,13 +209,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulThreeDSTestCardDetails,
- },
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
@@ -248,7 +231,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Request: {
currency: "EUR",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Paybox.js b/cypress-tests/cypress/e2e/configs/Payment/Paybox.js
index 2b85b7e5cd9..f70217059e1 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Paybox.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Paybox.js
@@ -27,7 +27,7 @@ const singleUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
single_use: {
- amount: 7000,
+ amount: 6000,
currency: "EUR",
},
},
@@ -37,7 +37,7 @@ const multiUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
multi_use: {
- amount: 6500,
+ amount: 6000,
currency: "EUR",
},
},
@@ -69,7 +69,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Request: {
currency: "EUR",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
@@ -155,31 +155,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -199,11 +197,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -214,11 +208,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -228,13 +218,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
@@ -373,7 +356,7 @@ export const connectorDetails = {
MITAutoCapture: {
Request: {
currency: "EUR",
- amount: 6500,
+ amount: 6000,
},
Response: {
status: 200,
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Paypal.js b/cypress-tests/cypress/e2e/configs/Payment/Paypal.js
index 787ad2afabd..982f082631d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Paypal.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Paypal.js
@@ -70,7 +70,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -169,32 +169,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -209,12 +206,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -225,12 +217,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -241,12 +228,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -257,12 +239,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -272,14 +249,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
@@ -348,7 +317,7 @@ export const connectorDetails = {
PaymentIntentOffSession: {
Request: {
currency: "USD",
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
customer_acceptance: null,
setup_future_usage: "off_session",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index b73bbf18dcc..9e557065f4c 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -151,7 +151,7 @@ export const connectorDetails = {
Request: {
currency: "USD",
customer_acceptance: null,
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
setup_future_usage: "off_session",
},
@@ -190,7 +190,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -208,9 +208,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
@@ -316,32 +316,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -356,12 +353,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -372,11 +364,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -387,12 +375,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -403,12 +386,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -418,14 +396,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
index cfd3332eaba..8ef1d4a4a5f 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
@@ -64,7 +64,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -82,9 +82,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
@@ -142,12 +142,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 400,
@@ -173,16 +168,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- paymentSuccessfulStatus: "succeeded",
- paymentSyncStatus: "succeeded",
- refundStatus: "succeeded",
- refundSyncStatus: "succeeded",
- customer_acceptance: null,
+ amount_to_capture: 2000,
},
Response: {
status: 400,
@@ -213,12 +199,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -235,12 +216,7 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -257,14 +233,6 @@ export const connectorDetails = {
TIMEOUT: 15000,
},
},
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/WellsFargo.js b/cypress-tests/cypress/e2e/configs/Payment/WellsFargo.js
index 38a5b637040..9c90568c3cb 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/WellsFargo.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/WellsFargo.js
@@ -144,32 +144,29 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
PartialCapture: {
- Request: {},
+ Request: {
+ amount_to_capture: 2000,
+ },
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000,
},
},
},
@@ -184,12 +181,7 @@ export const connectorDetails = {
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 6000,
},
Response: {
status: 200,
@@ -200,12 +192,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount: 2000,
},
Response: {
status: 200,
@@ -215,14 +202,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "USD",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js
index 3e13aeba754..06c5c799156 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js
@@ -161,25 +161,20 @@ export const connectorDetails = {
},
Capture: {
Request: {
- payment_method: "card",
- payment_method_type: "debit",
- payment_method_data: {
- card: successfulNoThreeDsCardDetailsRequest,
- },
- currency: "USD",
- customer_acceptance: null,
+ amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
},
},
},
PartialCapture: {
Request: {
+ amount_to_capture: 2000,
payment_method: "card",
payment_method_type: "debit",
payment_method_data: {
@@ -192,7 +187,7 @@ export const connectorDetails = {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
},
},
@@ -397,7 +392,9 @@ export const connectorDetails = {
},
},
Refund: {
- Request: {},
+ Request: {
+ amount: 6000,
+ },
Response: {
body: {
status: "succeeded",
@@ -405,7 +402,9 @@ export const connectorDetails = {
},
},
PartialRefund: {
- Request: {},
+ Request: {
+ amount: 2000,
+ },
Response: {
body: {
status: "succeeded",
@@ -414,11 +413,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNoThreeDsCardDetailsRequest,
- },
- currency: "USD",
+ amount: 6000,
},
Response: {
body: {
@@ -428,11 +423,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNoThreeDsCardDetailsRequest,
- },
- currency: "USD",
+ amount: 2000,
},
Response: {
body: {
@@ -441,7 +432,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {},
Response: {
body: {
status: "succeeded",
@@ -514,7 +504,7 @@ export const connectorDetails = {
},
PaymentIntentOffSession: {
Request: {
- amount: 6500,
+ amount: 6000,
authentication_type: "no_three_ds",
currency: "USD",
customer_acceptance: null,
@@ -555,7 +545,7 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 50,
- amount: 6500,
+ amount: 6000,
},
},
},
@@ -573,9 +563,9 @@ export const connectorDetails = {
body: {
status: "succeeded",
shipping_cost: 50,
- amount_received: 6550,
- amount: 6500,
- net_amount: 6550,
+ amount_received: 6050,
+ amount: 6000,
+ net_amount: 6050,
},
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Xendit.js b/cypress-tests/cypress/e2e/configs/Payment/Xendit.js
index fcc303877b4..985a69154ce 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Xendit.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Xendit.js
@@ -71,7 +71,7 @@ export const connectorDetails = {
currency: "IDR",
customer_acceptance: null,
setup_future_usage: "on_session",
- amount: 6500000,
+ amount: 6000000,
billing: billingDetails,
},
Response: {
@@ -91,13 +91,13 @@ export const connectorDetails = {
body: {
status: "requires_payment_method",
shipping_cost: 100,
- amount: 6500000,
+ amount: 6000000,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
- amount: 6500000,
+ amount: 6000000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
@@ -110,7 +110,7 @@ export const connectorDetails = {
body: {
status: "processing",
shipping_cost: 100,
- amount: 6500000,
+ amount: 6000000,
},
},
},
@@ -123,7 +123,7 @@ export const connectorDetails = {
},
Request: {
payment_method: "card",
- amount: 6500000,
+ amount: 6000000,
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingDetails,
@@ -148,7 +148,7 @@ export const connectorDetails = {
},
Request: {
payment_method: "card",
- amount: 6500000,
+ amount: 6000000,
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingDetails,
@@ -166,12 +166,7 @@ export const connectorDetails = {
},
manualPaymentPartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "IDR",
- customer_acceptance: null,
+ amount: 2000000,
},
Response: {
status: 200,
@@ -182,12 +177,7 @@ export const connectorDetails = {
},
manualPaymentRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "IDR",
- customer_acceptance: null,
+ amount: 6000000,
},
Response: {
status: 200,
@@ -406,7 +396,7 @@ export const connectorDetails = {
},
Request: {
payment_method: "card",
- amount: 6500000,
+ amount: 6000000,
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingDetails,
@@ -423,7 +413,7 @@ export const connectorDetails = {
},
"3DSManualCapture": {
Request: {
- amount: 6500000,
+ amount: 6000000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
@@ -450,7 +440,7 @@ export const connectorDetails = {
},
Request: {
payment_method: "card",
- amount: 6500000,
+ amount: 6000000,
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingDetails,
@@ -473,21 +463,15 @@ export const connectorDetails = {
},
},
Request: {
- payment_method: "card",
- amount: 6500000,
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "IDR",
- customer_acceptance: null,
+ amount_to_capture: 6000000,
},
Response: {
status: 200,
body: {
status: "succeeded",
- amount: 6500000,
+ amount: 6000000,
amount_capturable: 0,
- amount_received: 6500000,
+ amount_received: 6000000,
},
},
},
@@ -499,26 +483,21 @@ export const connectorDetails = {
},
},
Request: {
- amount: 6500000,
+ amount_to_capture: 2000000,
},
Response: {
status: 200,
body: {
status: "partially_captured",
- amount: 6500000,
+ amount: 2000000,
amount_capturable: 0,
- amount_received: 100,
+ amount_received: 2000000,
},
},
},
Refund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "IDR",
- customer_acceptance: null,
+ amount: 6000000,
},
Response: {
status: 200,
@@ -542,12 +521,7 @@ export const connectorDetails = {
},
PartialRefund: {
Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "IDR",
- customer_acceptance: null,
+ amount: 2000000,
},
Response: {
status: 200,
@@ -557,14 +531,6 @@ export const connectorDetails = {
},
},
SyncRefund: {
- Request: {
- payment_method: "card",
- payment_method_data: {
- card: successfulNo3DSCardDetails,
- },
- currency: "IDR",
- customer_acceptance: null,
- },
Response: {
status: 200,
body: {
diff --git a/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js
index e782b32368b..034598d72d9 100644
--- a/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js
@@ -133,7 +133,7 @@ export const createPaymentBodyWithCurrencyCountry = (
shippingCountry
) => ({
currency: currency,
- amount: 6500,
+ amount: 6000,
authentication_type: "three_ds",
description: "Joseph First Crypto",
email: "[email protected]",
@@ -184,7 +184,7 @@ export const createPaymentBodyWithCurrencyCountry = (
export const createPaymentBodyWithCurrency = (currency) => ({
currency: currency,
- amount: 6500,
+ amount: 6000,
authentication_type: "three_ds",
description: "Joseph First Crypto",
email: "[email protected]",
diff --git a/cypress-tests/cypress/e2e/configs/Routing/Adyen.js b/cypress-tests/cypress/e2e/configs/Routing/Adyen.js
index 976de0e2161..3668bf2a3aa 100644
--- a/cypress-tests/cypress/e2e/configs/Routing/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Routing/Adyen.js
@@ -148,8 +148,8 @@ export const connectorDetails = {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: 0,
},
},
@@ -160,8 +160,8 @@ export const connectorDetails = {
status: 200,
body: {
status: "processing",
- amount: 6500,
- amount_capturable: 6500,
+ amount: 6000,
+ amount_capturable: 6000,
amount_received: 0,
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Routing/Stripe.js b/cypress-tests/cypress/e2e/configs/Routing/Stripe.js
index e00e3d6ccbb..d55fee41a25 100644
--- a/cypress-tests/cypress/e2e/configs/Routing/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Routing/Stripe.js
@@ -148,9 +148,9 @@ export const connectorDetails = {
status: 200,
body: {
status: "succeeded",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
- amount_received: 6500,
+ amount_received: 6000,
},
},
},
@@ -160,7 +160,7 @@ export const connectorDetails = {
status: 200,
body: {
status: "partially_captured",
- amount: 6500,
+ amount: 6000,
amount_capturable: 0,
amount_received: 100,
},
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
index f82284b569f..1a0f28981c8 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
@@ -70,7 +70,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -124,7 +124,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -197,7 +197,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -251,7 +251,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
index 1d7ac32f0ba..cf3268e8a5d 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
@@ -67,7 +67,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["Refund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -135,7 +135,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 1200, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -145,7 +145,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 1200, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -202,7 +202,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["Refund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -262,7 +262,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 3000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -273,7 +273,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 3000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -344,7 +344,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -362,7 +362,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["manualPaymentRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -430,7 +430,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -448,7 +448,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 3000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -457,7 +457,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 3000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -528,7 +528,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -544,9 +544,9 @@ describe("Card - Refund flow - No 3DS", () => {
it("refund-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["manualPaymentRefund"];
+ ]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 100, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -614,7 +614,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -632,7 +632,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 100, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -667,7 +667,7 @@ describe("Card - Refund flow - No 3DS", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -686,7 +686,7 @@ describe("Card - Refund flow - No 3DS", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -701,7 +701,7 @@ describe("Card - Refund flow - No 3DS", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -713,7 +713,7 @@ describe("Card - Refund flow - No 3DS", () => {
"card_pm"
]["Refund"];
- cy.refundCallTest(fixtures.refundBody, data, 7000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -801,7 +801,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["Refund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -874,7 +874,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 1200, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -884,7 +884,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 1200, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -943,7 +943,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["Refund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1005,7 +1005,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 3000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -1016,7 +1016,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 3000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -1092,7 +1092,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1110,7 +1110,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["manualPaymentRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1183,7 +1183,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1201,7 +1201,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 5000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1210,7 +1210,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 1500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1283,7 +1283,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1299,9 +1299,9 @@ describe("Card - Refund flow - 3DS", () => {
it("refund-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["manualPaymentRefund"];
+ ]["manualPaymentPartialRefund"];
- cy.refundCallTest(fixtures.refundBody, data, 100, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1374,7 +1374,7 @@ describe("Card - Refund flow - 3DS", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -1390,9 +1390,14 @@ describe("Card - Refund flow - 3DS", () => {
it("refund-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["manualPaymentRefund"];
+ ]["manualPaymentPartialRefund"];
+
+ const newData = {
+ ...data,
+ Request: { amount: data.Request.amount / 2 },
+ };
- cy.refundCallTest(fixtures.refundBody, data, 50, globalState);
+ cy.refundCallTest(fixtures.refundBody, newData, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
index db63105d830..1d1581de5c9 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
@@ -66,7 +66,7 @@ describe("Card - Sync Refund flow test", () => {
"Refund"
];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js
index 6fa01f91991..d6b174ba63d 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js
@@ -34,7 +34,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -53,7 +53,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -81,7 +81,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -97,7 +97,7 @@ describe("Card - SingleUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -111,7 +111,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -123,7 +123,7 @@ describe("Card - SingleUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -154,7 +154,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -170,7 +170,7 @@ describe("Card - SingleUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -184,7 +184,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js
index 2af0b801d2d..b82207117ce 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js
@@ -34,7 +34,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -53,7 +53,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -67,7 +67,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -95,7 +95,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -111,7 +111,7 @@ describe("Card - MultiUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -125,7 +125,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -137,7 +137,7 @@ describe("Card - MultiUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -151,7 +151,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -163,7 +163,7 @@ describe("Card - MultiUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -190,7 +190,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -206,7 +206,7 @@ describe("Card - MultiUse Mandates flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -220,7 +220,7 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 6500,
+ 6000,
true,
"automatic",
globalState
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js
index f3704b84f97..dba24208b58 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js
@@ -34,7 +34,7 @@ describe("Card - List and revoke Mandates flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -53,7 +53,7 @@ describe("Card - List and revoke Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -112,7 +112,7 @@ describe("Card - List and revoke Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
index 26c250a3237..29ef0b64a50 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
@@ -178,7 +178,7 @@ describe("Card - SaveCard payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -271,7 +271,7 @@ describe("Card - SaveCard payment flow test", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -399,7 +399,7 @@ describe("Card - SaveCard payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -450,7 +450,7 @@ describe("Card - SaveCard payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js
index ba522b3cd71..bb71e1023f5 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js
@@ -53,7 +53,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -99,7 +99,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -113,7 +113,7 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
index 89d82f7fb93..41d33f5c258 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
@@ -75,7 +75,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -135,7 +135,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -213,7 +213,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -273,7 +273,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
"card_pm"
]["PartialCapture"];
- cy.captureCallTest(fixtures.captureBody, data, 100, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js
index ec8ddc6c700..ceefef888fc 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js
@@ -51,7 +51,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -70,7 +70,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -115,7 +115,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -131,7 +131,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -145,7 +145,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -173,7 +173,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -192,7 +192,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -206,7 +206,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -234,7 +234,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -250,7 +250,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -264,7 +264,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -276,7 +276,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -290,7 +290,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -302,7 +302,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -329,7 +329,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
"new_mandate",
@@ -353,7 +353,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -367,7 +367,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -395,7 +395,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -416,7 +416,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -430,7 +430,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.mitUsingPMId(
fixtures.pmIdConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js
index 67697cac6c1..6377323bbf6 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js
@@ -48,7 +48,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -68,7 +68,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"manual",
globalState
@@ -88,7 +88,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -102,7 +102,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -124,7 +124,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -136,7 +136,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -150,7 +150,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
globalState
@@ -162,7 +162,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -181,7 +181,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -195,7 +195,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
@@ -215,7 +215,7 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
data,
- 7000,
+ 6000,
true,
"automatic",
globalState
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js
index d6b1c99407f..b021f28becd 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js
@@ -78,7 +78,7 @@ describe("UPI Payments - Hyperswitch", () => {
"upi_pm"
]["Refund"];
- cy.refundCallTest(fixtures.refundBody, data, 6500, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js
index 5a1f765cf62..f3a99df1ba2 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js
@@ -27,9 +27,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid card number", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidCardNumber"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidCardNumber"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -41,9 +41,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid expiry month", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidExpiryMonth"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidExpiryMonth"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -55,9 +55,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid expiry year", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidExpiryYear"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidExpiryYear"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -69,9 +69,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid card CVV", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidCardCvv"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidCardCvv"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -83,9 +83,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid currency", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidCurrency"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidCurrency"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -97,9 +97,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid capture method", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidCaptureMethod"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidCaptureMethod"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -111,9 +111,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid payment method", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidPaymentMethod"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidPaymentMethod"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -125,9 +125,9 @@ describe("Corner cases", () => {
});
it("[Payment] Invalid `amount_to_capture`", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "InvalidAmountToCapture"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["InvalidAmountToCapture"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -139,9 +139,9 @@ describe("Corner cases", () => {
});
it("[Payment] Missing required params", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "MissingRequiredParam"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["MissingRequiredParam"];
cy.createConfirmPaymentTest(
paymentIntentBody,
@@ -165,9 +165,9 @@ describe("Corner cases", () => {
});
it("Create payment intent", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "PaymentIntent"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
cy.createPaymentIntentTest(
paymentIntentBody,
@@ -179,9 +179,9 @@ describe("Corner cases", () => {
});
it("Confirm payment intent", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "PaymentIntentErrored"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntentErrored"];
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
});
@@ -231,11 +231,11 @@ describe("Corner cases", () => {
});
it("Capture call", () => {
- const data = getConnectorDetails(globalState.get("commons"))["card_pm"][
- "CaptureGreaterAmount"
- ];
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["CaptureGreaterAmount"];
- cy.captureCallTest(fixtures.captureBody, data, 65000, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -289,7 +289,7 @@ describe("Corner cases", () => {
"card_pm"
]["CaptureCapturedAmount"];
- cy.captureCallTest(fixtures.captureBody, data, 65000, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -476,7 +476,7 @@ describe("Corner cases", () => {
"CaptureGreaterAmount"
];
- cy.captureCallTest(fixtures.captureBody, data, 65000, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -528,21 +528,9 @@ describe("Corner cases", () => {
it("Refund call", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["Refund"];
- const commonData = getConnectorDetails(globalState.get("commons"))[
- "card_pm"
- ]["Refund"];
+ ]["RefundGreaterAmount"];
- const newData = {
- ...data,
- Response: utils.getConnectorFlowDetails(
- data,
- commonData,
- "ResponseCustom"
- ),
- };
-
- cy.refundCallTest(fixtures.refundBody, newData, 65000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
});
@@ -593,21 +581,9 @@ describe("Corner cases", () => {
it("Refund call", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
- ]["Refund"];
- const commonData = getConnectorDetails(globalState.get("commons"))[
- "card_pm"
- ]["Refund"];
-
- const newData = {
- ...data,
- Response: utils.getConnectorFlowDetails(
- data,
- commonData,
- "ResponseCustom"
- ),
- };
+ ]["RefundGreaterAmount"];
- cy.refundCallTest(fixtures.refundBody, newData, 65000, globalState);
+ cy.refundCallTest(fixtures.refundBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -640,7 +616,7 @@ describe("Corner cases", () => {
cy.citForMandatesCallTest(
fixtures.citConfirmBody,
data,
- 6500,
+ 6000,
true,
"manual",
"new_mandate",
@@ -654,7 +630,7 @@ describe("Corner cases", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -674,13 +650,14 @@ describe("Corner cases", () => {
cy.mitForMandatesCallTest(
fixtures.mitConfirmBody,
data,
- 65000,
+ 60000,
true,
"manual",
globalState
);
});
});
+
context("Card-NoThreeDS fail payment flow test", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
@@ -724,9 +701,5 @@ describe("Corner cases", () => {
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
-
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00026-DeletedCustomerPsyncFlow.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00026-DeletedCustomerPsyncFlow.cy.js
index 365137ee34b..07f285cadfd 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00026-DeletedCustomerPsyncFlow.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00026-DeletedCustomerPsyncFlow.cy.js
@@ -211,7 +211,7 @@ describe("Card - Customer Deletion and Psync", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
@@ -307,7 +307,7 @@ describe("Card - Customer Deletion and Psync", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue)
shouldContinue = utils.should_continue_further(data);
diff --git a/cypress-tests/cypress/e2e/spec/Payment/00029-IncrementalAuth.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00029-IncrementalAuth.cy.js
index 76116acc2be..9daa587ecf9 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/00029-IncrementalAuth.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/00029-IncrementalAuth.cy.js
@@ -71,7 +71,7 @@ describe.skip("[Payment] Incremental Auth", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 7000, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
@@ -131,7 +131,7 @@ describe.skip("[Payment] Incremental Auth", () => {
"card_pm"
]["Capture"];
- cy.captureCallTest(fixtures.captureBody, data, 7000, globalState);
+ cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
diff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.json
index df533116e56..e0ea67816d1 100644
--- a/cypress-tests/cypress/fixtures/create-confirm-body.json
+++ b/cypress-tests/cypress/fixtures/create-confirm-body.json
@@ -1,5 +1,5 @@
{
- "amount": 6500,
+ "amount": 6000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
diff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.json
index d23c1f80543..d011b59d785 100644
--- a/cypress-tests/cypress/fixtures/create-mandate-cit.json
+++ b/cypress-tests/cypress/fixtures/create-mandate-cit.json
@@ -1,5 +1,5 @@
{
- "amount": 7000,
+ "amount": 6000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
diff --git a/cypress-tests/cypress/fixtures/create-payment-body.json b/cypress-tests/cypress/fixtures/create-payment-body.json
index ea1d22d364e..3b0efb9e8ae 100644
--- a/cypress-tests/cypress/fixtures/create-payment-body.json
+++ b/cypress-tests/cypress/fixtures/create-payment-body.json
@@ -1,6 +1,6 @@
{
"currency": "USD",
- "amount": 6500,
+ "amount": 6000,
"authentication_type": "three_ds",
"description": "Joseph First Crypto",
"email": "[email protected]",
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index f04d7762fa0..77f94cf30fa 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -119,12 +119,18 @@ Cypress.Commands.add("merchantRetrieveCall", (globalState) => {
logRequestId(response.headers["x-request-id"]);
cy.wrap(response).then(() => {
- expect(response.headers["content-type"]).to.include("application/json");
- expect(response.body.merchant_id).to.equal(merchant_id);
- expect(response.body.payment_response_hash_key).to.not.be.empty;
- expect(response.body.publishable_key).to.not.be.empty;
- expect(response.body.default_profile).to.not.be.empty;
- expect(response.body.organization_id).to.not.be.empty;
+ expect(response.headers["content-type"], "content_headers").to.include(
+ "application/json"
+ );
+ expect(response.body.merchant_id, "merchant_id").to.equal(merchant_id);
+ expect(
+ response.body.payment_response_hash_key,
+ "payment_response_hash_key"
+ ).to.not.be.null;
+ expect(response.body.publishable_key, "publishable_key").to.not.be.null;
+ cy.log("HI");
+ expect(response.body.default_profile, "default_profile").to.not.be.null;
+ expect(response.body.organization_id, "organization_id").to.not.be.null;
globalState.set("organizationId", response.body.organization_id);
if (globalState.get("publishableKey") === undefined) {
@@ -2161,44 +2167,48 @@ Cypress.Commands.add(
}
);
-Cypress.Commands.add(
- "captureCallTest",
- (requestBody, data, amount_to_capture, globalState) => {
- const { Configs: configs = {}, Response: resData } = data || {};
+Cypress.Commands.add("captureCallTest", (requestBody, data, globalState) => {
+ const {
+ Configs: configs = {},
+ Request: reqData,
+ Response: resData,
+ } = data || {};
- const configInfo = execConfig(validateConfig(configs));
- const payment_id = globalState.get("paymentID");
- const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);
+ const configInfo = execConfig(validateConfig(configs));
+ const paymentId = globalState.get("paymentID");
+ const profileId = globalState.get(`${configInfo.profilePrefix}Id`);
- requestBody.amount_to_capture = amount_to_capture;
- requestBody.profile_id = profile_id;
+ requestBody.profile_id = profileId;
- cy.request({
- method: "POST",
- url: `${globalState.get("baseUrl")}/payments/${payment_id}/capture`,
- headers: {
- "Content-Type": "application/json",
- "api-key": globalState.get("apiKey"),
- },
- failOnStatusCode: false,
- body: requestBody,
- }).then((response) => {
- logRequestId(response.headers["x-request-id"]);
+ for (const key in reqData) {
+ requestBody[key] = reqData[key];
+ }
- cy.wrap(response).then(() => {
- expect(response.headers["content-type"]).to.include("application/json");
- if (response.body.capture_method !== undefined) {
- expect(response.body.payment_id).to.equal(payment_id);
- for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
- }
- } else {
- defaultErrorHandler(response, resData);
+ cy.request({
+ method: "POST",
+ url: `${globalState.get("baseUrl")}/payments/${paymentId}/capture`,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": globalState.get("apiKey"),
+ },
+ failOnStatusCode: false,
+ body: requestBody,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.headers["content-type"]).to.include("application/json");
+ if (response.body.capture_method !== undefined) {
+ expect(response.body.payment_id).to.equal(paymentId);
+ for (const key in resData.body) {
+ expect(resData.body[key]).to.equal(response.body[key]);
}
- });
+ } else {
+ defaultErrorHandler(response, resData);
+ }
});
- }
-);
+ });
+});
Cypress.Commands.add("voidCallTest", (requestBody, data, globalState) => {
const {
@@ -2329,46 +2339,47 @@ Cypress.Commands.add(
}
);
-Cypress.Commands.add(
- "refundCallTest",
- (requestBody, data, refund_amount, globalState) => {
- const { Configs: configs = {}, Response: resData } = data || {};
+Cypress.Commands.add("refundCallTest", (requestBody, data, globalState) => {
+ const {
+ Configs: configs = {},
+ Request: reqData,
+ Response: resData,
+ } = data || {};
- const payment_id = globalState.get("paymentID");
+ const payment_id = globalState.get("paymentID");
- // we only need this to set the delay. We don't need the return value
- execConfig(validateConfig(configs));
+ // we only need this to set the delay. We don't need the return value
+ execConfig(validateConfig(configs));
- requestBody.amount = refund_amount;
- requestBody.payment_id = payment_id;
+ requestBody.amount = reqData.amount;
+ requestBody.payment_id = payment_id;
- cy.request({
- method: "POST",
- url: `${globalState.get("baseUrl")}/refunds`,
- headers: {
- "Content-Type": "application/json",
- "api-key": globalState.get("apiKey"),
- },
- failOnStatusCode: false,
- body: requestBody,
- }).then((response) => {
- logRequestId(response.headers["x-request-id"]);
+ cy.request({
+ method: "POST",
+ url: `${globalState.get("baseUrl")}/refunds`,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": globalState.get("apiKey"),
+ },
+ failOnStatusCode: false,
+ body: requestBody,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
- cy.wrap(response).then(() => {
- expect(response.headers["content-type"]).to.include("application/json");
- if (response.status === 200) {
- globalState.set("refundId", response.body.refund_id);
- for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
- }
- expect(response.body.payment_id).to.equal(payment_id);
- } else {
- defaultErrorHandler(response, resData);
+ cy.wrap(response).then(() => {
+ expect(response.headers["content-type"]).to.include("application/json");
+ if (response.status === 200) {
+ globalState.set("refundId", response.body.refund_id);
+ for (const key in resData.body) {
+ expect(resData.body[key]).to.equal(response.body[key]);
}
- });
+ expect(response.body.payment_id).to.equal(payment_id);
+ } else {
+ defaultErrorHandler(response, resData);
+ }
});
- }
-);
+ });
+});
Cypress.Commands.add("syncRefundCallTest", (data, globalState) => {
const { Response: resData } = data || {};
|
refactor
|
make amount configurable (#7219)
|
73ed7ae7e305c391f413e3ac88775148db304779
|
2023-08-02 14:25:23
|
Sampras Lopes
|
refactor(config): Add new type for kms encrypted values (#1823)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 8adfa95d7d5..66825779f07 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1811,6 +1811,7 @@ dependencies = [
"diesel_models",
"error-stack",
"external_services",
+ "masking",
"once_cell",
"redis_interface",
"router_env",
diff --git a/config/config.example.toml b/config/config.example.toml
index 843b78efe98..0415330c89b 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -20,24 +20,22 @@ request_body_limit = 16_384
# Main SQL data store credentials
[master_database]
username = "db_user" # DB Username
-password = "db_pass" # DB Password. Only applicable when KMS is disabled.
+password = "db_pass" # DB Password. Use base-64 encoded kms encrypted value here when kms is enabled
host = "localhost" # DB Host
port = 5432 # DB Port
dbname = "hyperswitch_db" # Name of Database
pool_size = 5 # Number of connections to keep open
connection_timeout = 10 # Timeout for database connection in seconds
-kms_encrypted_password = "" # Base64-encoded (KMS encrypted) ciphertext of the database password. Only applicable when KMS is enabled.
# Replica SQL data store credentials
[replica_database]
username = "replica_user" # DB Username
-password = "replica_pass" # DB Password. Only applicable when KMS is disabled.
+password = "db_pass" # DB Password. Use base-64 encoded kms encrypted value here when kms is enabled
host = "localhost" # DB Host
port = 5432 # DB Port
dbname = "hyperswitch_db" # Name of Database
pool_size = 5 # Number of connections to keep open
connection_timeout = 10 # Timeout for database connection in seconds
-kms_encrypted_password = "" # Base64-encoded (KMS encrypted) ciphertext of the database password. Only applicable when KMS is enabled.
# Redis credentials
[redis]
@@ -101,6 +99,8 @@ admin_api_key = "test_admin" # admin API key for admin authentication. Only
kms_encrypted_admin_api_key = "" # Base64-encoded (KMS encrypted) ciphertext of the admin_api_key. Only applicable when KMS is enabled.
jwt_secret = "secret" # JWT secret used for user authentication. Only applicable when KMS is disabled.
kms_encrypted_jwt_secret = "" # Base64-encoded (KMS encrypted) ciphertext of the jwt_secret. Only applicable when KMS is enabled.
+recon_admin_api_key = "recon_test_admin" # recon_admin API key for recon authentication. Only applicable when KMS is disabled.
+kms_encrypted_recon_admin_api_key = "" # Base64-encoded (KMS encrypted) ciphertext of the recon_admin_api_key. Only applicable when KMS is enabled
# Locker settings contain details for accessing a card locker, a
# PCI Compliant storage entity which stores payment method information
diff --git a/config/development.toml b/config/development.toml
index 3ac236e81a4..c5b85d4a1fb 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -33,6 +33,8 @@ connection_timeout = 10
[secrets]
admin_api_key = "test_admin"
master_enc_key = "73ad7bbbbc640c845a150f67d058b279849370cd2c1f3c67c4dd6c869213e13a"
+jwt_secret = "secret"
+recon_admin_api_key = "recon_test_admin"
[locker]
host = ""
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 1bf53f2c4ac..a8a8ecde604 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -40,6 +40,7 @@ pool_size = 5
admin_api_key = "test_admin"
jwt_secret = "secret"
master_enc_key = "73ad7bbbbc640c845a150f67d058b279849370cd2c1f3c67c4dd6c869213e13a"
+recon_admin_api_key = "recon_test_admin"
[locker]
host = ""
diff --git a/crates/common_utils/src/ext_traits.rs b/crates/common_utils/src/ext_traits.rs
index fec0446b161..eac24ac0753 100644
--- a/crates/common_utils/src/ext_traits.rs
+++ b/crates/common_utils/src/ext_traits.rs
@@ -4,7 +4,7 @@
//!
use error_stack::{IntoReport, ResultExt};
-use masking::{ExposeInterface, Secret, Strategy};
+use masking::{ExposeInterface, PeekInterface, Secret, Strategy};
use quick_xml::de;
use serde::{Deserialize, Serialize};
@@ -428,6 +428,30 @@ impl ConfigExt for String {
}
}
+impl<T, U> ConfigExt for Secret<T, U>
+where
+ T: ConfigExt + Default + PartialEq<T>,
+ U: Strategy<T>,
+{
+ fn is_default(&self) -> bool
+ where
+ T: Default + PartialEq<T>,
+ {
+ *self.peek() == T::default()
+ }
+
+ fn is_empty_after_trim(&self) -> bool {
+ self.peek().is_empty_after_trim()
+ }
+
+ fn is_default_or_empty(&self) -> bool
+ where
+ T: Default + PartialEq<T>,
+ {
+ self.peek().is_default() || self.peek().is_empty_after_trim()
+ }
+}
+
/// Extension trait for deserializing XML strings using `quick-xml` crate
pub trait XmlExt {
///
diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.toml
index aba84059d1c..45186b84ca9 100644
--- a/crates/drainer/Cargo.toml
+++ b/crates/drainer/Cargo.toml
@@ -28,6 +28,7 @@ tokio = { version = "1.28.2", features = ["macros", "rt-multi-thread"] }
# First Party Crates
common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals"] }
external_services = { version = "0.1.0", path = "../external_services" }
+masking = { version = "0.1.0", path = "../masking" }
redis_interface = { version = "0.1.0", path = "../redis_interface" }
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] }
diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] }
diff --git a/crates/drainer/src/connection.rs b/crates/drainer/src/connection.rs
index d4902c8f428..429a80c0daa 100644
--- a/crates/drainer/src/connection.rs
+++ b/crates/drainer/src/connection.rs
@@ -1,7 +1,9 @@
use bb8::PooledConnection;
use diesel::PgConnection;
#[cfg(feature = "kms")]
-use external_services::kms;
+use external_services::kms::{self, decrypt::KmsDecrypt};
+#[cfg(not(feature = "kms"))]
+use masking::PeekInterface;
use crate::settings::Database;
@@ -20,17 +22,17 @@ pub async fn redis_connection(
pub async fn diesel_make_pg_pool(
database: &Database,
_test_transaction: bool,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &'static kms::KmsClient,
) -> PgPool {
#[cfg(feature = "kms")]
- let password = kms::get_kms_client(kms_config)
+ let password = database
+ .password
+ .decrypt_inner(kms_client)
.await
- .decrypt(&database.kms_encrypted_password)
- .await
- .expect("Failed to KMS decrypt database password");
+ .expect("Failed to decrypt password");
#[cfg(not(feature = "kms"))]
- let password = &database.password;
+ let password = &database.password.peek();
let database_url = format!(
"postgres://{}:{}@{}:{}/{}",
diff --git a/crates/drainer/src/services.rs b/crates/drainer/src/services.rs
index fd1f6c0efff..6edec31f26d 100644
--- a/crates/drainer/src/services.rs
+++ b/crates/drainer/src/services.rs
@@ -22,7 +22,7 @@ impl Store {
&config.master_database,
test_transaction,
#[cfg(feature = "kms")]
- &config.kms,
+ external_services::kms::get_kms_client(&config.kms).await,
)
.await,
redis_conn: Arc::new(crate::connection::redis_connection(config).await),
diff --git a/crates/drainer/src/settings.rs b/crates/drainer/src/settings.rs
index bf57f413895..1aa8e7a95a3 100644
--- a/crates/drainer/src/settings.rs
+++ b/crates/drainer/src/settings.rs
@@ -11,6 +11,11 @@ use serde::Deserialize;
use crate::errors;
+#[cfg(feature = "kms")]
+pub type Password = kms::KmsValue;
+#[cfg(not(feature = "kms"))]
+pub type Password = masking::Secret<String>;
+
#[derive(clap::Parser, Default)]
#[cfg_attr(feature = "vergen", command(version = router_env::version!()))]
pub struct CmdLineConf {
@@ -35,15 +40,12 @@ pub struct Settings {
#[serde(default)]
pub struct Database {
pub username: String,
- #[cfg(not(feature = "kms"))]
- pub password: String,
+ pub password: Password,
pub host: String,
pub port: u16,
pub dbname: String,
pub pool_size: u32,
pub connection_timeout: u64,
- #[cfg(feature = "kms")]
- pub kms_encrypted_password: String,
}
#[derive(Debug, Clone, Deserialize)]
@@ -60,15 +62,12 @@ impl Default for Database {
fn default() -> Self {
Self {
username: String::new(),
- #[cfg(not(feature = "kms"))]
- password: String::new(),
+ password: Password::default(),
host: "localhost".into(),
port: 5432,
dbname: String::new(),
pool_size: 5,
connection_timeout: 10,
- #[cfg(feature = "kms")]
- kms_encrypted_password: String::new(),
}
}
}
@@ -107,23 +106,11 @@ impl Database {
))
})?;
- #[cfg(not(feature = "kms"))]
- {
- when(self.password.is_default_or_empty(), || {
- Err(errors::DrainerError::ConfigParsingError(
- "database user password must not be empty".into(),
- ))
- })
- }
-
- #[cfg(feature = "kms")]
- {
- when(self.kms_encrypted_password.is_default_or_empty(), || {
- Err(errors::DrainerError::ConfigParsingError(
- "database KMS encrypted password must not be empty".into(),
- ))
- })
- }
+ when(self.password.is_default_or_empty(), || {
+ Err(errors::DrainerError::ConfigParsingError(
+ "database user password must not be empty".into(),
+ ))
+ })
}
}
diff --git a/crates/external_services/src/kms.rs b/crates/external_services/src/kms.rs
index fa36c674e8c..31c82253fe8 100644
--- a/crates/external_services/src/kms.rs
+++ b/crates/external_services/src/kms.rs
@@ -7,7 +7,10 @@ use aws_sdk_kms::{config::Region, primitives::Blob, Client};
use base64::Engine;
use common_utils::errors::CustomResult;
use error_stack::{IntoReport, ResultExt};
+use masking::{PeekInterface, Secret};
use router_env::logger;
+/// decrypting data using the AWS KMS SDK.
+pub mod decrypt;
use crate::{consts, metrics};
@@ -15,7 +18,7 @@ static KMS_CLIENT: tokio::sync::OnceCell<KmsClient> = tokio::sync::OnceCell::con
/// Returns a shared KMS client, or initializes a new one if not previously initialized.
#[inline]
-pub async fn get_kms_client(config: &KmsConfig) -> &KmsClient {
+pub async fn get_kms_client(config: &KmsConfig) -> &'static KmsClient {
KMS_CLIENT.get_or_init(|| KmsClient::new(config)).await
}
@@ -113,6 +116,10 @@ pub enum KmsError {
/// An error occurred UTF-8 decoding KMS decrypted output.
#[error("Failed to UTF-8 decode decryption output")]
Utf8DecodingFailed,
+
+ /// The KMS client has not been initialized.
+ #[error("The KMS client has not been initialized")]
+ KmsClientNotInitialized,
}
impl KmsConfig {
@@ -129,3 +136,14 @@ impl KmsConfig {
})
}
}
+
+/// A wrapper around a KMS value that can be decrypted.
+#[derive(Clone, Debug, Default, serde::Deserialize, Eq, PartialEq)]
+#[serde(transparent)]
+pub struct KmsValue(Secret<String>);
+
+impl common_utils::ext_traits::ConfigExt for KmsValue {
+ fn is_empty_after_trim(&self) -> bool {
+ self.0.peek().is_empty_after_trim()
+ }
+}
diff --git a/crates/external_services/src/kms/decrypt.rs b/crates/external_services/src/kms/decrypt.rs
new file mode 100644
index 00000000000..0749745affc
--- /dev/null
+++ b/crates/external_services/src/kms/decrypt.rs
@@ -0,0 +1,34 @@
+use common_utils::errors::CustomResult;
+
+use super::*;
+
+#[async_trait::async_trait]
+/// This trait performs in place decryption of the structure on which this is implemented
+pub trait KmsDecrypt {
+ /// The output type of the decryption
+ type Output;
+ /// Decrypts the structure given a KMS client
+ async fn decrypt_inner(self, kms_client: &KmsClient) -> CustomResult<Self::Output, KmsError>
+ where
+ Self: Sized;
+
+ /// Tries to use the Singleton client to decrypt the structure
+ async fn try_decrypt_inner(self) -> CustomResult<Self::Output, KmsError>
+ where
+ Self: Sized,
+ {
+ let client = KMS_CLIENT.get().ok_or(KmsError::KmsClientNotInitialized)?;
+ self.decrypt_inner(client).await
+ }
+}
+
+#[async_trait::async_trait]
+impl KmsDecrypt for &KmsValue {
+ type Output = String;
+ async fn decrypt_inner(self, kms_client: &KmsClient) -> CustomResult<Self::Output, KmsError> {
+ kms_client
+ .decrypt(self.0.peek())
+ .await
+ .attach_printable("Failed to decrypt KMS value")
+ }
+}
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 4ab61aa4fa2..8495186a4ab 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -1,8 +1,10 @@
use std::collections::{HashMap, HashSet};
use api_models::{enums, payment_methods::RequiredFieldInfo};
+#[cfg(feature = "kms")]
+use external_services::kms::KmsValue;
-use super::settings::{ConnectorFields, PaymentMethodType, RequiredFieldFinal};
+use super::settings::{ConnectorFields, Password, PaymentMethodType, RequiredFieldFinal};
impl Default for super::settings::Server {
fn default() -> Self {
@@ -21,35 +23,12 @@ impl Default for super::settings::Database {
fn default() -> Self {
Self {
username: String::new(),
- #[cfg(not(feature = "kms"))]
- password: String::new(),
+ password: Password::default(),
host: "localhost".into(),
port: 5432,
dbname: String::new(),
pool_size: 5,
connection_timeout: 10,
- #[cfg(feature = "kms")]
- kms_encrypted_password: String::new(),
- }
- }
-}
-
-impl Default for super::settings::Secrets {
- fn default() -> Self {
- Self {
- #[cfg(not(feature = "kms"))]
- jwt_secret: "secret".into(),
- #[cfg(not(feature = "kms"))]
- admin_api_key: "test_admin".into(),
- #[cfg(not(feature = "kms"))]
- recon_admin_api_key: "recon_test_admin".into(),
- master_enc_key: "".into(),
- #[cfg(feature = "kms")]
- kms_encrypted_jwt_secret: "".into(),
- #[cfg(feature = "kms")]
- kms_encrypted_admin_api_key: "".into(),
- #[cfg(feature = "kms")]
- kms_encrypted_recon_admin_api_key: "".into(),
}
}
}
@@ -809,7 +788,7 @@ impl Default for super::settings::ApiKeys {
fn default() -> Self {
Self {
#[cfg(feature = "kms")]
- kms_encrypted_hash_key: String::new(),
+ kms_encrypted_hash_key: KmsValue::default(),
/// Hex-encoded 32-byte long (64 characters long when hex-encoded) key used for calculating
/// hashes of API keys
diff --git a/crates/router/src/configs/kms.rs b/crates/router/src/configs/kms.rs
index 5f1c4726d7f..668cf15b4da 100644
--- a/crates/router/src/configs/kms.rs
+++ b/crates/router/src/configs/kms.rs
@@ -1,60 +1,46 @@
use common_utils::errors::CustomResult;
-use external_services::kms;
+use external_services::kms::{decrypt::KmsDecrypt, KmsClient, KmsError};
use masking::ExposeInterface;
use crate::configs::settings;
-#[async_trait::async_trait]
-// This trait performs inplace decryption of the structure on which this is implemented
-pub trait KmsDecrypt {
- async fn decrypt_inner(self, kms_config: &kms::KmsConfig) -> CustomResult<Self, kms::KmsError>
- where
- Self: Sized;
-}
-
#[async_trait::async_trait]
impl KmsDecrypt for settings::Jwekey {
- async fn decrypt_inner(self, kms_config: &kms::KmsConfig) -> CustomResult<Self, kms::KmsError> {
- let client = kms::get_kms_client(kms_config).await;
+ type Output = Self;
- // If this pattern required repetition, a macro approach needs to be deviced
- let (
- locker_encryption_key1,
- locker_encryption_key2,
- locker_decryption_key1,
- locker_decryption_key2,
- vault_encryption_key,
- vault_private_key,
- tunnel_private_key,
+ async fn decrypt_inner(
+ mut self,
+ kms_client: &KmsClient,
+ ) -> CustomResult<Self::Output, KmsError> {
+ (
+ self.locker_encryption_key2,
+ self.locker_decryption_key1,
+ self.locker_encryption_key1,
+ self.locker_decryption_key2,
+ self.vault_encryption_key,
+ self.vault_private_key,
+ self.tunnel_private_key,
) = tokio::try_join!(
- client.decrypt(self.locker_encryption_key1),
- client.decrypt(self.locker_encryption_key2),
- client.decrypt(self.locker_decryption_key1),
- client.decrypt(self.locker_decryption_key2),
- client.decrypt(self.vault_encryption_key),
- client.decrypt(self.vault_private_key),
- client.decrypt(self.tunnel_private_key),
+ kms_client.decrypt(self.locker_encryption_key1),
+ kms_client.decrypt(self.locker_encryption_key2),
+ kms_client.decrypt(self.locker_decryption_key1),
+ kms_client.decrypt(self.locker_decryption_key2),
+ kms_client.decrypt(self.vault_encryption_key),
+ kms_client.decrypt(self.vault_private_key),
+ kms_client.decrypt(self.tunnel_private_key),
)?;
-
- Ok(Self {
- locker_key_identifier1: self.locker_key_identifier1,
- locker_key_identifier2: self.locker_key_identifier2,
- locker_encryption_key1,
- locker_encryption_key2,
- locker_decryption_key1,
- locker_decryption_key2,
- vault_encryption_key,
- vault_private_key,
- tunnel_private_key,
- })
+ Ok(self)
}
}
#[async_trait::async_trait]
impl KmsDecrypt for settings::ActiveKmsSecrets {
- async fn decrypt_inner(self, kms_config: &kms::KmsConfig) -> CustomResult<Self, kms::KmsError> {
- Ok(Self {
- jwekey: self.jwekey.expose().decrypt_inner(kms_config).await?.into(),
- })
+ type Output = Self;
+ async fn decrypt_inner(
+ mut self,
+ kms_client: &KmsClient,
+ ) -> CustomResult<Self::Output, KmsError> {
+ self.jwekey = self.jwekey.expose().decrypt_inner(kms_client).await?.into();
+ Ok(self)
}
}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 564650b871f..32d126b514f 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -19,6 +19,10 @@ use crate::{
core::errors::{ApplicationError, ApplicationResult},
env::{self, logger, Env},
};
+#[cfg(feature = "kms")]
+pub type Password = kms::KmsValue;
+#[cfg(not(feature = "kms"))]
+pub type Password = masking::Secret<String>;
#[derive(clap::Parser, Default)]
#[cfg_attr(feature = "vergen", command(version = router_env::version!()))]
@@ -338,7 +342,7 @@ where
.collect())
}
-#[derive(Debug, Deserialize, Clone)]
+#[derive(Debug, Default, Deserialize, Clone)]
#[serde(default)]
pub struct Secrets {
#[cfg(not(feature = "kms"))]
@@ -347,13 +351,13 @@ pub struct Secrets {
pub admin_api_key: String,
#[cfg(not(feature = "kms"))]
pub recon_admin_api_key: String,
- pub master_enc_key: String,
+ pub master_enc_key: Password,
#[cfg(feature = "kms")]
- pub kms_encrypted_jwt_secret: String,
+ pub kms_encrypted_jwt_secret: kms::KmsValue,
#[cfg(feature = "kms")]
- pub kms_encrypted_admin_api_key: String,
+ pub kms_encrypted_admin_api_key: kms::KmsValue,
#[cfg(feature = "kms")]
- pub kms_encrypted_recon_admin_api_key: String,
+ pub kms_encrypted_recon_admin_api_key: kms::KmsValue,
}
#[derive(Debug, Deserialize, Clone)]
@@ -414,15 +418,12 @@ pub struct Server {
#[serde(default)]
pub struct Database {
pub username: String,
- #[cfg(not(feature = "kms"))]
- pub password: String,
+ pub password: Password,
pub host: String,
pub port: u16,
pub dbname: String,
pub pool_size: u32,
pub connection_timeout: u64,
- #[cfg(feature = "kms")]
- pub kms_encrypted_password: String,
}
#[derive(Debug, Deserialize, Clone)]
@@ -566,7 +567,7 @@ pub struct ApiKeys {
/// Base64-encoded (KMS encrypted) ciphertext of the key used for calculating hashes of API
/// keys
#[cfg(feature = "kms")]
- pub kms_encrypted_hash_key: String,
+ pub kms_encrypted_hash_key: kms::KmsValue,
/// Hex-encoded 32-byte long (64 characters long when hex-encoded) key used for calculating
/// hashes of API keys
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index 2ee79f35c90..626591d1a3d 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -99,23 +99,11 @@ impl super::settings::Database {
))
})?;
- #[cfg(not(feature = "kms"))]
- {
- when(self.password.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "database user password must not be empty".into(),
- ))
- })
- }
-
- #[cfg(feature = "kms")]
- {
- when(self.kms_encrypted_password.is_default_or_empty(), || {
- Err(ApplicationError::InvalidConfigurationValueError(
- "database KMS encrypted password must not be empty".into(),
- ))
- })
- }
+ when(self.password.is_default_or_empty(), || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "database user password must not be empty".into(),
+ ))
+ })
}
}
diff --git a/crates/router/src/connection.rs b/crates/router/src/connection.rs
index a5d436d0d8e..647b1b107d0 100644
--- a/crates/router/src/connection.rs
+++ b/crates/router/src/connection.rs
@@ -4,6 +4,10 @@ use diesel::PgConnection;
use error_stack::{IntoReport, ResultExt};
#[cfg(feature = "kms")]
use external_services::kms;
+#[cfg(feature = "kms")]
+use external_services::kms::decrypt::KmsDecrypt;
+#[cfg(not(feature = "kms"))]
+use masking::PeekInterface;
use crate::{configs::settings::Database, errors};
@@ -41,17 +45,18 @@ pub async fn redis_connection(
pub async fn diesel_make_pg_pool(
database: &Database,
test_transaction: bool,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &kms::KmsClient,
) -> PgPool {
#[cfg(feature = "kms")]
- let password = kms::get_kms_client(kms_config)
- .await
- .decrypt(&database.kms_encrypted_password)
+ let password = database
+ .password
+ .clone()
+ .decrypt_inner(kms_client)
.await
.expect("Failed to KMS decrypt database password");
#[cfg(not(feature = "kms"))]
- let password = &database.password;
+ let password = &database.password.peek();
let database_url = format!(
"postgres://{}:{}@{}:{}/{}",
diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index 129b1f96e20..bd34dee38bd 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -27,19 +27,22 @@ const API_KEY_EXPIRY_NAME: &str = "API_KEY_EXPIRY";
#[cfg(feature = "email")]
const API_KEY_EXPIRY_RUNNER: &str = "API_KEY_EXPIRY_WORKFLOW";
+#[cfg(feature = "kms")]
+use external_services::kms::decrypt::KmsDecrypt;
+
static HASH_KEY: tokio::sync::OnceCell<StrongSecret<[u8; PlaintextApiKey::HASH_KEY_LEN]>> =
tokio::sync::OnceCell::const_new();
pub async fn get_hash_key(
api_key_config: &settings::ApiKeys,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &kms::KmsClient,
) -> errors::RouterResult<&'static StrongSecret<[u8; PlaintextApiKey::HASH_KEY_LEN]>> {
HASH_KEY
.get_or_try_init(|| async {
#[cfg(feature = "kms")]
- let hash_key = kms::get_kms_client(kms_config)
- .await
- .decrypt(&api_key_config.kms_encrypted_hash_key)
+ let hash_key = api_key_config
+ .kms_encrypted_hash_key
+ .decrypt_inner(kms_client)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to KMS decrypt API key hashing key")?;
@@ -130,7 +133,7 @@ impl PlaintextApiKey {
pub async fn create_api_key(
state: &AppState,
api_key_config: &settings::ApiKeys,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &kms::KmsClient,
api_key: api::CreateApiKeyRequest,
merchant_id: String,
) -> RouterResponse<api::CreateApiKeyResponse> {
@@ -150,7 +153,7 @@ pub async fn create_api_key(
let hash_key = get_hash_key(
api_key_config,
#[cfg(feature = "kms")]
- kms_config,
+ kms_client,
)
.await?;
let plaintext_api_key = PlaintextApiKey::new(consts::API_KEY_LENGTH);
@@ -555,7 +558,7 @@ mod tests {
let hash_key = get_hash_key(
&settings.api_keys,
#[cfg(feature = "kms")]
- &settings.kms,
+ external_services::kms::get_kms_client(&settings.kms).await,
)
.await
.unwrap();
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 27fb6a55b6a..9d5ca08e634 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -46,7 +46,7 @@ pub async fn api_key_create(
state,
&state.conf.api_keys,
#[cfg(feature = "kms")]
- &state.conf.kms,
+ external_services::kms::get_kms_client(&state.conf.kms).await,
payload,
merchant_id.clone(),
)
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index acb1950e309..34f43647f40 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1,6 +1,8 @@
use actix_web::{web, Scope};
#[cfg(feature = "email")]
use external_services::email::{AwsSes, EmailClient};
+#[cfg(feature = "kms")]
+use external_services::kms::{self, decrypt::KmsDecrypt};
use tokio::sync::oneshot;
#[cfg(feature = "dummy_connector")]
@@ -14,8 +16,6 @@ use super::{cache::*, health::*};
use super::{configs::*, customers::*, mandates::*, payments::*, refunds::*};
#[cfg(feature = "oltp")]
use super::{ephemeral_key::*, payment_methods::*, webhooks::*};
-#[cfg(feature = "kms")]
-use crate::configs::kms;
use crate::{
configs::settings,
db::{MockDb, StorageImpl, StorageInterface},
@@ -64,6 +64,8 @@ impl AppState {
storage_impl: StorageImpl,
shut_down_signal: oneshot::Sender<()>,
) -> Self {
+ #[cfg(feature = "kms")]
+ let kms_client = kms::get_kms_client(&conf.kms).await;
let testable = storage_impl == StorageImpl::PostgresqlTest;
let store: Box<dyn StorageInterface> = match storage_impl {
StorageImpl::Postgresql | StorageImpl::PostgresqlTest => {
@@ -74,12 +76,10 @@ impl AppState {
#[cfg(feature = "kms")]
#[allow(clippy::expect_used)]
- let kms_secrets = kms::KmsDecrypt::decrypt_inner(
- settings::ActiveKmsSecrets {
- jwekey: conf.jwekey.clone().into(),
- },
- &conf.kms,
- )
+ let kms_secrets = settings::ActiveKmsSecrets {
+ jwekey: conf.jwekey.clone().into(),
+ }
+ .decrypt_inner(kms_client)
.await
.expect("Failed while performing KMS decryption");
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index e82b2c7c42f..327d56dfc2f 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -7,7 +7,9 @@ use std::sync::{atomic, Arc};
use error_stack::{IntoReport, ResultExt};
#[cfg(feature = "kms")]
-use external_services::kms;
+use external_services::kms::{self, decrypt::KmsDecrypt};
+#[cfg(not(feature = "kms"))]
+use masking::PeekInterface;
use redis_interface::{errors as redis_errors, PubsubInterface, RedisValue};
use tokio::sync::oneshot;
@@ -166,11 +168,13 @@ impl Store {
async_spawn!({
redis_clone.on_error(shut_down_signal).await;
});
+ #[cfg(feature = "kms")]
+ let kms_client = kms::get_kms_client(&config.kms).await;
let master_enc_key = get_master_enc_key(
config,
#[cfg(feature = "kms")]
- &config.kms,
+ kms_client,
)
.await;
@@ -179,7 +183,7 @@ impl Store {
&config.master_database,
test_transaction,
#[cfg(feature = "kms")]
- &config.kms,
+ kms_client,
)
.await,
#[cfg(feature = "olap")]
@@ -187,7 +191,7 @@ impl Store {
&config.replica_database,
test_transaction,
#[cfg(feature = "kms")]
- &config.kms,
+ kms_client,
)
.await,
redis_conn,
@@ -248,13 +252,14 @@ impl Store {
#[allow(clippy::expect_used)]
async fn get_master_enc_key(
conf: &crate::configs::settings::Settings,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &kms::KmsClient,
) -> Vec<u8> {
#[cfg(feature = "kms")]
let master_enc_key = hex::decode(
- kms::get_kms_client(kms_config)
- .await
- .decrypt(&conf.secrets.master_enc_key)
+ conf.secrets
+ .master_enc_key
+ .clone()
+ .decrypt_inner(kms_client)
.await
.expect("Failed to decrypt master enc key"),
)
@@ -262,7 +267,7 @@ async fn get_master_enc_key(
#[cfg(not(feature = "kms"))]
let master_enc_key =
- hex::decode(&conf.secrets.master_enc_key).expect("Failed to decode from hex");
+ hex::decode(conf.secrets.master_enc_key.peek()).expect("Failed to decode from hex");
master_enc_key
}
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 352bb16cc33..49bfecb69fc 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -4,7 +4,7 @@ use async_trait::async_trait;
use common_utils::date_time;
use error_stack::{report, IntoReport, ResultExt};
#[cfg(feature = "kms")]
-use external_services::kms;
+use external_services::kms::{self, decrypt::KmsDecrypt};
use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation};
use masking::{PeekInterface, StrongSecret};
@@ -99,7 +99,7 @@ where
api_keys::get_hash_key(
&config.api_keys,
#[cfg(feature = "kms")]
- &config.kms,
+ kms::get_kms_client(&config.kms).await,
)
.await?
};
@@ -151,14 +151,14 @@ static ADMIN_API_KEY: tokio::sync::OnceCell<StrongSecret<String>> =
pub async fn get_admin_api_key(
secrets: &settings::Secrets,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &kms::KmsClient,
) -> RouterResult<&'static StrongSecret<String>> {
ADMIN_API_KEY
.get_or_try_init(|| async {
#[cfg(feature = "kms")]
- let admin_api_key = kms::get_kms_client(kms_config)
- .await
- .decrypt(&secrets.kms_encrypted_admin_api_key)
+ let admin_api_key = secrets
+ .kms_encrypted_admin_api_key
+ .decrypt_inner(kms_client)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to KMS decrypt admin API key")?;
@@ -191,7 +191,7 @@ where
let admin_api_key = get_admin_api_key(
&conf.secrets,
#[cfg(feature = "kms")]
- &conf.kms,
+ kms::get_kms_client(&conf.kms).await,
)
.await?;
@@ -456,14 +456,14 @@ static JWT_SECRET: tokio::sync::OnceCell<StrongSecret<String>> = tokio::sync::On
pub async fn get_jwt_secret(
secrets: &settings::Secrets,
- #[cfg(feature = "kms")] kms_config: &kms::KmsConfig,
+ #[cfg(feature = "kms")] kms_client: &kms::KmsClient,
) -> RouterResult<&'static StrongSecret<String>> {
JWT_SECRET
.get_or_try_init(|| async {
#[cfg(feature = "kms")]
- let jwt_secret = kms::get_kms_client(kms_config)
- .await
- .decrypt(&secrets.kms_encrypted_jwt_secret)
+ let jwt_secret = secrets
+ .kms_encrypted_jwt_secret
+ .decrypt_inner(kms_client)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to KMS decrypt JWT secret")?;
@@ -484,7 +484,7 @@ where
let secret = get_jwt_secret(
&conf.secrets,
#[cfg(feature = "kms")]
- &conf.kms,
+ kms::get_kms_client(&conf.kms).await,
)
.await?
.peek()
|
refactor
|
Add new type for kms encrypted values (#1823)
|
96393ff3d6b11d4726a6cb2224236414507d9848
|
2024-11-29 15:58:59
|
Anurag Thakur
|
fix(openapi): Standardise API naming scheme for V2 (#6510)
| false
|
diff --git a/api-reference-v2/api-reference/api-key/api-key--create.mdx b/api-reference-v2/api-reference/api-key/api-key--create.mdx
index a92a8ea77fd..abc1dcda10f 100644
--- a/api-reference-v2/api-reference/api-key/api-key--create.mdx
+++ b/api-reference-v2/api-reference/api-key/api-key--create.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/api_keys
+openapi: post /v2/api-keys
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/api-key/api-key--list.mdx b/api-reference-v2/api-reference/api-key/api-key--list.mdx
index 5975e9bd6ca..fb84b35fbc7 100644
--- a/api-reference-v2/api-reference/api-key/api-key--list.mdx
+++ b/api-reference-v2/api-reference/api-key/api-key--list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/api_keys/list
+openapi: get /v2/api-keys/list
---
diff --git a/api-reference-v2/api-reference/api-key/api-key--retrieve.mdx b/api-reference-v2/api-reference/api-key/api-key--retrieve.mdx
index ee7970122d4..72864363357 100644
--- a/api-reference-v2/api-reference/api-key/api-key--retrieve.mdx
+++ b/api-reference-v2/api-reference/api-key/api-key--retrieve.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/api_keys/{id}
+openapi: get /v2/api-keys/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/api-key/api-key--revoke.mdx b/api-reference-v2/api-reference/api-key/api-key--revoke.mdx
index 9362743088b..b7ffd42e449 100644
--- a/api-reference-v2/api-reference/api-key/api-key--revoke.mdx
+++ b/api-reference-v2/api-reference/api-key/api-key--revoke.mdx
@@ -1,3 +1,3 @@
---
-openapi: delete /v2/api_keys/{id}
+openapi: delete /v2/api-keys/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/api-key/api-key--update.mdx b/api-reference-v2/api-reference/api-key/api-key--update.mdx
index c682cf1ee9e..2434e4981fc 100644
--- a/api-reference-v2/api-reference/api-key/api-key--update.mdx
+++ b/api-reference-v2/api-reference/api-key/api-key--update.mdx
@@ -1,3 +1,3 @@
---
-openapi: put /v2/api_keys/{id}
+openapi: put /v2/api-keys/{id}
---
diff --git a/api-reference-v2/api-reference/business-profile/merchant-connector--list.mdx b/api-reference-v2/api-reference/business-profile/merchant-connector--list.mdx
index 6560f45e5fa..93c5a980c27 100644
--- a/api-reference-v2/api-reference/business-profile/merchant-connector--list.mdx
+++ b/api-reference-v2/api-reference/business-profile/merchant-connector--list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/profiles/{profile_id}/connector_accounts
+openapi: get /v2/profiles/{profile_id}/connector-accounts
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/connector-account/connector-account--create.mdx b/api-reference-v2/api-reference/connector-account/connector-account--create.mdx
index d8cac2bab39..d672d6fa34d 100644
--- a/api-reference-v2/api-reference/connector-account/connector-account--create.mdx
+++ b/api-reference-v2/api-reference/connector-account/connector-account--create.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/connector_accounts
+openapi: post /v2/connector-accounts
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/connector-account/connector-account--delete.mdx b/api-reference-v2/api-reference/connector-account/connector-account--delete.mdx
index 5c959648fff..15fdd664412 100644
--- a/api-reference-v2/api-reference/connector-account/connector-account--delete.mdx
+++ b/api-reference-v2/api-reference/connector-account/connector-account--delete.mdx
@@ -1,3 +1,3 @@
---
-openapi: delete /v2/connector_accounts/{id}
+openapi: delete /v2/connector-accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/connector-account/connector-account--retrieve.mdx b/api-reference-v2/api-reference/connector-account/connector-account--retrieve.mdx
index 918de031276..dbd26b9b10b 100644
--- a/api-reference-v2/api-reference/connector-account/connector-account--retrieve.mdx
+++ b/api-reference-v2/api-reference/connector-account/connector-account--retrieve.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/connector_accounts/{id}
+openapi: get /v2/connector-accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/connector-account/connector-account--update.mdx b/api-reference-v2/api-reference/connector-account/connector-account--update.mdx
index 6ccd052fb9b..fe864d538f8 100644
--- a/api-reference-v2/api-reference/connector-account/connector-account--update.mdx
+++ b/api-reference-v2/api-reference/connector-account/connector-account--update.mdx
@@ -1,3 +1,3 @@
---
-openapi: put /v2/connector_accounts/{id}
+openapi: put /v2/connector-accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/merchant-account/business-profile--list.mdx b/api-reference-v2/api-reference/merchant-account/business-profile--list.mdx
index 97deb0832cc..069bd602ddf 100644
--- a/api-reference-v2/api-reference/merchant-account/business-profile--list.mdx
+++ b/api-reference-v2/api-reference/merchant-account/business-profile--list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/merchant_accounts/{id}/profiles
+openapi: get /v2/merchant-accounts/{id}/profiles
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/merchant-account/merchant-account--create.mdx b/api-reference-v2/api-reference/merchant-account/merchant-account--create.mdx
index d870b811aae..38aed603f62 100644
--- a/api-reference-v2/api-reference/merchant-account/merchant-account--create.mdx
+++ b/api-reference-v2/api-reference/merchant-account/merchant-account--create.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/merchant_accounts
+openapi: post /v2/merchant-accounts
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/merchant-account/merchant-account--retrieve.mdx b/api-reference-v2/api-reference/merchant-account/merchant-account--retrieve.mdx
index d082565234e..3b744fb1406 100644
--- a/api-reference-v2/api-reference/merchant-account/merchant-account--retrieve.mdx
+++ b/api-reference-v2/api-reference/merchant-account/merchant-account--retrieve.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/merchant_accounts/{id}
+openapi: get /v2/merchant-accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx b/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx
index 51f80ceea30..eb2e92d0652 100644
--- a/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx
+++ b/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx
@@ -1,3 +1,3 @@
---
-openapi: put /v2/merchant_accounts/{id}
+openapi: put /v2/merchant-accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/merchant-account/profile--list.mdx b/api-reference-v2/api-reference/merchant-account/profile--list.mdx
deleted file mode 100644
index e14bc0d6ef3..00000000000
--- a/api-reference-v2/api-reference/merchant-account/profile--list.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: get /v2/merchant_accounts/{account_id}/profiles
----
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/organization/organization--merchant-account--list.mdx b/api-reference-v2/api-reference/organization/organization--merchant-account--list.mdx
index 58d467dc572..9a03e8713d1 100644
--- a/api-reference-v2/api-reference/organization/organization--merchant-account--list.mdx
+++ b/api-reference-v2/api-reference/organization/organization--merchant-account--list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/organization/{id}/merchant_accounts
+openapi: get /v2/organization/{id}/merchant-accounts
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/list-customer-saved-payment-methods-for-a-payment.mdx b/api-reference-v2/api-reference/payment-methods/list-customer-saved-payment-methods-for-a-payment.mdx
new file mode 100644
index 00000000000..7809830b820
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/list-customer-saved-payment-methods-for-a-payment.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /v2/payments/{id}/saved-payment-methods
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/list-payment-methods-for-a-customer.mdx b/api-reference-v2/api-reference/payment-methods/list-payment-methods-for-a-customer.mdx
new file mode 100644
index 00000000000..ef5a27f9604
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/list-payment-methods-for-a-customer.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /v2/customers/{id}/saved-payment-methods
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--confirm-intent.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--confirm-intent.mdx
new file mode 100644
index 00000000000..134374a7b6c
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/payment-method--confirm-intent.mdx
@@ -0,0 +1,3 @@
+---
+openapi: post /v2/payment-methods/{id}/confirm-intent
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--create-intent.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--create-intent.mdx
new file mode 100644
index 00000000000..42cf716f2ab
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/payment-method--create-intent.mdx
@@ -0,0 +1,3 @@
+---
+openapi: post /v2/payment-methods/create-intent
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--create.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--create.mdx
new file mode 100644
index 00000000000..1dce5179a94
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/payment-method--create.mdx
@@ -0,0 +1,3 @@
+---
+openapi: post /v2/payment-methods
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--delete.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--delete.mdx
new file mode 100644
index 00000000000..210bf843f97
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/payment-method--delete.mdx
@@ -0,0 +1,3 @@
+---
+openapi: delete /v2/payment-methods/{id}
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--retrieve.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--retrieve.mdx
new file mode 100644
index 00000000000..957d9760b3f
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/payment-method--retrieve.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /v2/payment-methods/{id}
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--update.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--update.mdx
new file mode 100644
index 00000000000..0adee195a6f
--- /dev/null
+++ b/api-reference-v2/api-reference/payment-methods/payment-method--update.mdx
@@ -0,0 +1,3 @@
+---
+openapi: patch /v2/payment-methods/{id}/update-saved-payment-method
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/profile/merchant-connector--list.mdx b/api-reference-v2/api-reference/profile/merchant-connector--list.mdx
index 81f640436f4..55218be7c0b 100644
--- a/api-reference-v2/api-reference/profile/merchant-connector--list.mdx
+++ b/api-reference-v2/api-reference/profile/merchant-connector--list.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/profiles/{id}/connector_accounts
+openapi: get /v2/profiles/{id}/connector-accounts
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/profile/profile--activate-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--activate-routing-algorithm.mdx
index 7225f422e5a..ea9ee7596a0 100644
--- a/api-reference-v2/api-reference/profile/profile--activate-routing-algorithm.mdx
+++ b/api-reference-v2/api-reference/profile/profile--activate-routing-algorithm.mdx
@@ -1,3 +1,3 @@
---
-openapi: patch /v2/profiles/{id}/activate_routing_algorithm
+openapi: patch /v2/profiles/{id}/activate-routing-algorithm
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/profile/profile--deactivate-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--deactivate-routing-algorithm.mdx
index 87aac8b9379..4d6b2d620c6 100644
--- a/api-reference-v2/api-reference/profile/profile--deactivate-routing-algorithm.mdx
+++ b/api-reference-v2/api-reference/profile/profile--deactivate-routing-algorithm.mdx
@@ -1,3 +1,3 @@
---
-openapi: patch /v2/profiles/{id}/deactivate_routing_algorithm
+openapi: patch /v2/profiles/{id}/deactivate-routing-algorithm
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/profile/profile--retrieve-active-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--retrieve-active-routing-algorithm.mdx
index 86d2d35d57c..143837676c2 100644
--- a/api-reference-v2/api-reference/profile/profile--retrieve-active-routing-algorithm.mdx
+++ b/api-reference-v2/api-reference/profile/profile--retrieve-active-routing-algorithm.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/profiles/{id}/routing_algorithm
+openapi: get /v2/profiles/{id}/routing-algorithm
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/profile/profile--retrieve-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--retrieve-default-fallback-routing-algorithm.mdx
index 1bc383c278f..ebaad7c53ae 100644
--- a/api-reference-v2/api-reference/profile/profile--retrieve-default-fallback-routing-algorithm.mdx
+++ b/api-reference-v2/api-reference/profile/profile--retrieve-default-fallback-routing-algorithm.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/profiles/{id}/fallback_routing
+openapi: get /v2/profiles/{id}/fallback-routing
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx
index 76f4d4fa77f..b5df6a57ef8 100644
--- a/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx
+++ b/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx
@@ -1,3 +1,3 @@
---
-openapi: patch /v2/profiles/{id}/fallback_routing
+openapi: patch /v2/profiles/{id}/fallback-routing
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/routing/routing--create.mdx b/api-reference-v2/api-reference/routing/routing--create.mdx
index 65ef15008f2..438abd8e231 100644
--- a/api-reference-v2/api-reference/routing/routing--create.mdx
+++ b/api-reference-v2/api-reference/routing/routing--create.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/routing_algorithm
+openapi: post /v2/routing-algorithm
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/routing/routing--retrieve.mdx b/api-reference-v2/api-reference/routing/routing--retrieve.mdx
index 776ff69e004..10db0200e18 100644
--- a/api-reference-v2/api-reference/routing/routing--retrieve.mdx
+++ b/api-reference-v2/api-reference/routing/routing--retrieve.mdx
@@ -1,3 +1,3 @@
---
-openapi: get /v2/routing_algorithm/{id}
+openapi: get /v2/routing-algorithm/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json
index c0723a63f3a..aed89492443 100644
--- a/api-reference-v2/mint.json
+++ b/api-reference-v2/mint.json
@@ -23,7 +23,9 @@
"navigation": [
{
"group": "Get Started",
- "pages": ["introduction"]
+ "pages": [
+ "introduction"
+ ]
},
{
"group": "Essentials",
@@ -43,6 +45,19 @@
"api-reference/payments/payments--get"
]
},
+ {
+ "group": "Payment Methods",
+ "pages": [
+ "api-reference/payment-methods/payment-method--create",
+ "api-reference/payment-methods/payment-method--retrieve",
+ "api-reference/payment-methods/payment-method--update",
+ "api-reference/payment-methods/payment-method--delete",
+ "api-reference/payment-methods/payment-method--create-intent",
+ "api-reference/payment-methods/payment-method--confirm-intent",
+ "api-reference/payment-methods/list-customer-saved-payment-methods-for-a-payment",
+ "api-reference/payment-methods/list-payment-methods-for-a-customer"
+ ]
+ },
{
"group": "Organization",
"pages": [
@@ -119,8 +134,10 @@
"github": "https://github.com/juspay/hyperswitch",
"linkedin": "https://www.linkedin.com/company/hyperswitch"
},
- "openapi": ["openapi_spec.json"],
+ "openapi": [
+ "openapi_spec.json"
+ ],
"api": {
"maintainOrder": true
}
-}
+}
\ No newline at end of file
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 15103188df5..2b66d1755ff 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -164,7 +164,7 @@
]
}
},
- "/v2/organization/{id}/merchant_accounts": {
+ "/v2/organization/{id}/merchant-accounts": {
"get": {
"tags": [
"Organization"
@@ -208,7 +208,7 @@
]
}
},
- "/v2/connector_accounts": {
+ "/v2/connector-accounts": {
"post": {
"tags": [
"Merchant Connector Account"
@@ -285,7 +285,7 @@
]
}
},
- "/v2/connector_accounts/{id}": {
+ "/v2/connector-accounts/{id}": {
"get": {
"tags": [
"Merchant Connector Account"
@@ -445,7 +445,7 @@
]
}
},
- "/v2/merchant_accounts": {
+ "/v2/merchant-accounts": {
"post": {
"tags": [
"Merchant Account"
@@ -524,7 +524,7 @@
]
}
},
- "/v2/merchant_accounts/{id}": {
+ "/v2/merchant-accounts/{id}": {
"get": {
"tags": [
"Merchant Account"
@@ -630,7 +630,7 @@
]
}
},
- "/v2/merchant_accounts/{id}/profiles": {
+ "/v2/merchant-accounts/{id}/profiles": {
"get": {
"tags": [
"Merchant Account"
@@ -907,7 +907,7 @@
]
}
},
- "/v2/profiles/{id}/connector_accounts": {
+ "/v2/profiles/{id}/connector-accounts": {
"get": {
"tags": [
"Business Profile"
@@ -966,7 +966,7 @@
]
}
},
- "/v2/profiles/{id}/activate_routing_algorithm": {
+ "/v2/profiles/{id}/activate-routing-algorithm": {
"patch": {
"tags": [
"Profile"
@@ -1033,7 +1033,7 @@
]
}
},
- "/v2/profiles/{id}/deactivate_routing_algorithm": {
+ "/v2/profiles/{id}/deactivate-routing-algorithm": {
"patch": {
"tags": [
"Profile"
@@ -1086,7 +1086,7 @@
]
}
},
- "/v2/profiles/{id}/fallback_routing": {
+ "/v2/profiles/{id}/fallback-routing": {
"patch": {
"tags": [
"Profile"
@@ -1197,13 +1197,13 @@
]
}
},
- "/v2/profiles/{id}/routing_algorithm": {
+ "/v2/profiles/{id}/routing-algorithm": {
"get": {
"tags": [
"Profile"
],
"summary": "Profile - Retrieve Active Routing Algorithm",
- "description": "Retrieve active routing algorithm under the profile",
+ "description": "_\nRetrieve active routing algorithm under the profile",
"operationId": "Retrieve the active routing algorithm under the profile",
"parameters": [
{
@@ -1271,7 +1271,7 @@
]
}
},
- "/v2/routing_algorithm": {
+ "/v2/routing-algorithm": {
"post": {
"tags": [
"Routing"
@@ -1326,7 +1326,7 @@
]
}
},
- "/v2/routing_algorithm/{id}": {
+ "/v2/routing-algorithm/{id}": {
"get": {
"tags": [
"Routing"
@@ -1376,7 +1376,7 @@
]
}
},
- "/v2/api_keys": {
+ "/v2/api-keys": {
"post": {
"tags": [
"API Key"
@@ -1416,7 +1416,7 @@
]
}
},
- "/v2/api_keys/{id}": {
+ "/v2/api-keys/{id}": {
"get": {
"tags": [
"API Key"
@@ -1545,7 +1545,7 @@
]
}
},
- "/v2/api_keys/list": {
+ "/v2/api-keys/list": {
"get": {
"tags": [
"API Key"
@@ -2017,6 +2017,332 @@
]
}
},
+ "/v2/payments/{id}/saved-payment-methods": {
+ "get": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "List customer saved payment methods for a payment",
+ "description": "To filter and list the applicable payment methods for a particular Customer ID, is to be associated with a payment",
+ "operationId": "List all Payment Methods for a Customer",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodListRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Payment Methods retrieved for customer tied to its respective client-secret passed in the param",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid Data"
+ },
+ "404": {
+ "description": "Payment Methods does not exist in records"
+ }
+ },
+ "security": [
+ {
+ "publishable_key": []
+ }
+ ]
+ }
+ },
+ "/v2/customers/{id}/saved-payment-methods": {
+ "get": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "List saved payment methods for a Customer",
+ "description": "To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context",
+ "operationId": "List all Payment Methods for a Customer",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodListRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Payment Methods retrieved",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid Data"
+ },
+ "404": {
+ "description": "Payment Methods does not exist in records"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
+ "/v2/payment-methods": {
+ "post": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - Create",
+ "description": "Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.",
+ "operationId": "Create Payment Method",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodCreate"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Payment Method Created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid Data"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
+ "/v2/payment-methods/create-intent": {
+ "post": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - Create Intent",
+ "description": "Creates a payment method for customer with billing information and other metadata.",
+ "operationId": "Create Payment Method Intent",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodIntentCreate"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Payment Method Intent Created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid Data"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
+ "/v2/payment-methods/{id}/confirm-intent": {
+ "post": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - Confirm Intent",
+ "description": "Update a payment method with customer's payment method related information.",
+ "operationId": "Confirm Payment Method Intent",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodIntentConfirm"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Payment Method Intent Confirmed",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid Data"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
+ "/v2/payment-methods/{id}/update-saved-payment-method": {
+ "patch": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - Update",
+ "description": "Update an existing payment method of a customer.",
+ "operationId": "Update Payment Method",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodUpdate"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Payment Method Update",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid Data"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
+ "/v2/payment-methods/{id}": {
+ "get": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - Retrieve",
+ "description": "Retrieves a payment method of a customer.",
+ "operationId": "Retrieve Payment Method",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The unique identifier for the Payment Method",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Payment Method Retrieved",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Payment Method Not Found"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "Payment Methods"
+ ],
+ "summary": "Payment Method - Delete",
+ "description": "Deletes a payment method of a customer.",
+ "operationId": "Delete Payment Method",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The unique identifier for the Payment Method",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Payment Method Retrieved",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentMethodDeleteResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Payment Method Not Found"
+ }
+ },
+ "security": [
+ {
+ "api_key": []
+ }
+ ]
+ }
+ },
"/v2/refunds": {
"post": {
"tags": [
@@ -11255,14 +11581,17 @@
],
"properties": {
"organization_name": {
- "type": "string"
+ "type": "string",
+ "description": "Name of the organization"
},
"organization_details": {
"type": "object",
+ "description": "Details about the organization",
"nullable": true
},
"metadata": {
"type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
}
},
@@ -11271,27 +11600,31 @@
"OrganizationResponse": {
"type": "object",
"required": [
- "organization_id",
+ "id",
"modified_at",
"created_at"
],
"properties": {
- "organization_id": {
+ "id": {
"type": "string",
+ "description": "The unique identifier for the Organization",
"example": "org_q98uSGAYbjEwqs0mJwnz",
"maxLength": 64,
"minLength": 1
},
"organization_name": {
"type": "string",
+ "description": "Name of the Organization",
"nullable": true
},
"organization_details": {
"type": "object",
+ "description": "Details about the organization",
"nullable": true
},
"metadata": {
"type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
},
"modified_at": {
@@ -11309,14 +11642,17 @@
"properties": {
"organization_name": {
"type": "string",
+ "description": "Name of the organization",
"nullable": true
},
"organization_details": {
"type": "object",
+ "description": "Details about the organization",
"nullable": true
},
"metadata": {
"type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
}
},
@@ -12918,6 +13254,68 @@
}
}
},
+ "PaymentMethodIntentConfirm": {
+ "type": "object",
+ "required": [
+ "client_secret",
+ "payment_method_data",
+ "payment_method_type",
+ "payment_method_subtype"
+ ],
+ "properties": {
+ "client_secret": {
+ "type": "string",
+ "description": "For SDK based calls, client_secret would be required"
+ },
+ "customer_id": {
+ "type": "string",
+ "description": "The unique identifier of the customer.",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "nullable": true,
+ "maxLength": 64,
+ "minLength": 1
+ },
+ "payment_method_data": {
+ "$ref": "#/components/schemas/PaymentMethodCreateData"
+ },
+ "payment_method_type": {
+ "$ref": "#/components/schemas/PaymentMethod"
+ },
+ "payment_method_subtype": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ }
+ },
+ "additionalProperties": false
+ },
+ "PaymentMethodIntentCreate": {
+ "type": "object",
+ "required": [
+ "customer_id"
+ ],
+ "properties": {
+ "metadata": {
+ "type": "object",
+ "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.",
+ "nullable": true
+ },
+ "billing": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Address"
+ }
+ ],
+ "nullable": true
+ },
+ "customer_id": {
+ "type": "string",
+ "description": "The unique identifier of the customer.",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "maxLength": 64,
+ "minLength": 1
+ }
+ },
+ "additionalProperties": false
+ },
"PaymentMethodIssuerCode": {
"type": "string",
"enum": [
@@ -12959,6 +13357,78 @@
}
]
},
+ "PaymentMethodListRequest": {
+ "type": "object",
+ "properties": {
+ "client_secret": {
+ "type": "string",
+ "description": "This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK",
+ "example": "secret_k2uj3he2893eiu2d",
+ "nullable": true,
+ "maxLength": 30,
+ "minLength": 30
+ },
+ "accepted_countries": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ },
+ "description": "The two-letter ISO currency code",
+ "example": [
+ "US",
+ "UK",
+ "IN"
+ ],
+ "nullable": true
+ },
+ "amount": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MinorUnit"
+ }
+ ],
+ "nullable": true
+ },
+ "accepted_currencies": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Currency"
+ },
+ "description": "The three-letter ISO currency code",
+ "example": [
+ "USD",
+ "EUR"
+ ],
+ "nullable": true
+ },
+ "recurring_enabled": {
+ "type": "boolean",
+ "description": "Indicates whether the payment method is eligible for recurring payments",
+ "example": true,
+ "nullable": true
+ },
+ "card_networks": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CardNetwork"
+ },
+ "description": "Indicates whether the payment method is eligible for card netwotks",
+ "example": [
+ "visa",
+ "mastercard"
+ ],
+ "nullable": true
+ },
+ "limit": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Indicates the limit of last used payment methods",
+ "example": 1,
+ "nullable": true
+ }
+ },
+ "additionalProperties": false
+ },
"PaymentMethodListResponse": {
"type": "object",
"required": [
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index ecce327d7ff..d2133a3e68e 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -14432,14 +14432,17 @@
],
"properties": {
"organization_name": {
- "type": "string"
+ "type": "string",
+ "description": "Name of the organization"
},
"organization_details": {
"type": "object",
+ "description": "Details about the organization",
"nullable": true
},
"metadata": {
"type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
}
},
@@ -14455,20 +14458,24 @@
"properties": {
"organization_id": {
"type": "string",
+ "description": "The unique identifier for the Organization",
"example": "org_q98uSGAYbjEwqs0mJwnz",
"maxLength": 64,
"minLength": 1
},
"organization_name": {
"type": "string",
+ "description": "Name of the Organization",
"nullable": true
},
"organization_details": {
"type": "object",
+ "description": "Details about the organization",
"nullable": true
},
"metadata": {
"type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
},
"modified_at": {
@@ -14486,14 +14493,17 @@
"properties": {
"organization_name": {
"type": "string",
+ "description": "Name of the organization",
"nullable": true
},
"organization_details": {
"type": "object",
+ "description": "Details about the organization",
"nullable": true
},
"metadata": {
"type": "object",
+ "description": "Metadata is useful for storing additional, unstructured information on an object.",
"nullable": true
}
},
diff --git a/crates/api_models/src/organization.rs b/crates/api_models/src/organization.rs
index f95a1595116..c6bc3924d11 100644
--- a/crates/api_models/src/organization.rs
+++ b/crates/api_models/src/organization.rs
@@ -22,9 +22,14 @@ pub struct OrganizationId {
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct OrganizationCreateRequest {
+ /// Name of the organization
pub organization_name: String,
+
+ /// Details about the organization
#[schema(value_type = Option<Object>)]
pub organization_details: Option<pii::SecretSerdeValue>,
+
+ /// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>)]
pub metadata: Option<pii::SecretSerdeValue>,
}
@@ -32,20 +37,53 @@ pub struct OrganizationCreateRequest {
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct OrganizationUpdateRequest {
+ /// Name of the organization
pub organization_name: Option<String>,
+
+ /// Details about the organization
#[schema(value_type = Option<Object>)]
pub organization_details: Option<pii::SecretSerdeValue>,
+
+ /// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>)]
pub metadata: Option<pii::SecretSerdeValue>,
}
-
+#[cfg(feature = "v1")]
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
pub struct OrganizationResponse {
+ /// The unique identifier for the Organization
#[schema(value_type = String, max_length = 64, min_length = 1, example = "org_q98uSGAYbjEwqs0mJwnz")]
pub organization_id: id_type::OrganizationId,
+
+ /// Name of the Organization
pub organization_name: Option<String>,
+
+ /// Details about the organization
#[schema(value_type = Option<Object>)]
pub organization_details: Option<pii::SecretSerdeValue>,
+
+ /// Metadata is useful for storing additional, unstructured information on an object.
+ #[schema(value_type = Option<Object>)]
+ pub metadata: Option<pii::SecretSerdeValue>,
+ pub modified_at: time::PrimitiveDateTime,
+ pub created_at: time::PrimitiveDateTime,
+}
+
+#[cfg(feature = "v2")]
+#[derive(Debug, serde::Serialize, Clone, ToSchema)]
+pub struct OrganizationResponse {
+ /// The unique identifier for the Organization
+ #[schema(value_type = String, max_length = 64, min_length = 1, example = "org_q98uSGAYbjEwqs0mJwnz")]
+ pub id: id_type::OrganizationId,
+
+ /// Name of the Organization
+ pub organization_name: Option<String>,
+
+ /// Details about the organization
+ #[schema(value_type = Option<Object>)]
+ pub organization_details: Option<pii::SecretSerdeValue>,
+
+ /// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>)]
pub metadata: Option<pii::SecretSerdeValue>,
pub modified_at: time::PrimitiveDateTime,
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 0bb5e65213f..2c2aa4861c5 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -778,7 +778,7 @@ pub struct PaymentMethodResponse {
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema, Clone)]
pub struct PaymentMethodResponse {
/// Unique identifier for a merchant
- #[schema(example = "merchant_1671528864", value_type = String)]
+ #[schema(value_type = String, example = "merchant_1671528864")]
pub merchant_id: id_type::MerchantId,
/// The unique identifier of the customer.
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index b7a6c12500d..006d78e2f7a 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -125,7 +125,7 @@ impl PaymentIntent {
publishable_key: String,
) -> CustomResult<url::Url, errors::api_error_response::ApiErrorResponse> {
let start_redirection_url = &format!(
- "{}/v2/payments/{}/start_redirection?publishable_key={}&profile_id={}",
+ "{}/v2/payments/{}/start-redirection?publishable_key={}&profile_id={}",
base_url,
self.get_id().get_string_repr(),
publishable_key,
@@ -144,7 +144,7 @@ impl PaymentIntent {
publishable_key: &str,
) -> CustomResult<url::Url, errors::api_error_response::ApiErrorResponse> {
let finish_redirection_url = format!(
- "{base_url}/v2/payments/{}/finish_redirection/{publishable_key}/{}",
+ "{base_url}/v2/payments/{}/finish-redirection/{publishable_key}/{}",
self.id.get_string_repr(),
self.profile_id.get_string_repr()
);
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 4198e90882e..a756d9fb1b1 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -127,6 +127,17 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payments::payments_confirm_intent,
routes::payments::payment_status,
+ //Routes for payment methods
+ routes::payment_method::list_customer_payment_method_for_payment,
+ routes::payment_method::list_customer_payment_method_api,
+ routes::payment_method::create_payment_method_api,
+ routes::payment_method::create_payment_method_intent_api,
+ routes::payment_method::confirm_payment_method_intent_api,
+ routes::payment_method::payment_method_update_api,
+ routes::payment_method::payment_method_retrieve_api,
+ routes::payment_method::payment_method_delete_api,
+
+
//Routes for refunds
routes::refunds::refunds_create,
),
@@ -170,9 +181,12 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::customers::CustomerRequest,
api_models::customers::CustomerDeleteResponse,
api_models::payment_methods::PaymentMethodCreate,
+ api_models::payment_methods::PaymentMethodIntentCreate,
+ api_models::payment_methods::PaymentMethodIntentConfirm,
api_models::payment_methods::PaymentMethodResponse,
api_models::payment_methods::PaymentMethodResponseData,
api_models::payment_methods::CustomerPaymentMethod,
+ api_models::payment_methods::PaymentMethodListRequest,
api_models::payment_methods::PaymentMethodListResponse,
api_models::payment_methods::ResponsePaymentMethodsEnabled,
api_models::payment_methods::ResponsePaymentMethodTypes,
@@ -189,6 +203,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payment_methods::PaymentMethodCreateData,
api_models::payment_methods::CardDetail,
api_models::payment_methods::CardDetailUpdate,
+ api_models::payment_methods::CardType,
api_models::payment_methods::RequestPaymentMethodTypes,
api_models::payment_methods::CardType,
api_models::payment_methods::PaymentMethodListData,
diff --git a/crates/openapi/src/routes/api_keys.rs b/crates/openapi/src/routes/api_keys.rs
index cfc4c09ce46..964fa60fcf5 100644
--- a/crates/openapi/src/routes/api_keys.rs
+++ b/crates/openapi/src/routes/api_keys.rs
@@ -25,7 +25,7 @@ pub async fn api_key_create() {}
/// displayed only once on creation, so ensure you store it securely.
#[utoipa::path(
post,
- path = "/v2/api_keys",
+ path = "/v2/api-keys",
request_body= CreateApiKeyRequest,
responses(
(status = 200, description = "API Key created", body = CreateApiKeyResponse),
@@ -64,7 +64,7 @@ pub async fn api_key_retrieve() {}
/// Retrieve information about the specified API Key.
#[utoipa::path(
get,
- path = "/v2/api_keys/{id}",
+ path = "/v2/api-keys/{id}",
params (
("id" = String, Path, description = "The unique identifier for the API Key")
),
@@ -106,7 +106,7 @@ pub async fn api_key_update() {}
/// Update information for the specified API Key.
#[utoipa::path(
put,
- path = "/v2/api_keys/{id}",
+ path = "/v2/api-keys/{id}",
request_body = UpdateApiKeyRequest,
params (
("id" = String, Path, description = "The unique identifier for the API Key")
@@ -150,7 +150,7 @@ pub async fn api_key_revoke() {}
/// authenticating with our APIs.
#[utoipa::path(
delete,
- path = "/v2/api_keys/{id}",
+ path = "/v2/api-keys/{id}",
params (
("id" = String, Path, description = "The unique identifier for the API Key")
),
@@ -191,7 +191,7 @@ pub async fn api_key_list() {}
/// List all the API Keys associated to a merchant account.
#[utoipa::path(
get,
- path = "/v2/api_keys/list",
+ path = "/v2/api-keys/list",
params(
("limit" = Option<i64>, Query, description = "The maximum number of API Keys to include in the response"),
("skip" = Option<i64>, Query, description = "The number of API Keys to skip when retrieving the list of API keys."),
diff --git a/crates/openapi/src/routes/merchant_account.rs b/crates/openapi/src/routes/merchant_account.rs
index 022a5e6c006..a3bf96ab897 100644
--- a/crates/openapi/src/routes/merchant_account.rs
+++ b/crates/openapi/src/routes/merchant_account.rs
@@ -50,7 +50,7 @@ pub async fn merchant_account_create() {}
/// Before creating the merchant account, it is mandatory to create an organization.
#[utoipa::path(
post,
- path = "/v2/merchant_accounts",
+ path = "/v2/merchant-accounts",
params(
(
"X-Organization-Id" = String, Header,
@@ -128,7 +128,7 @@ pub async fn retrieve_merchant_account() {}
/// Retrieve a *merchant* account details.
#[utoipa::path(
get,
- path = "/v2/merchant_accounts/{id}",
+ path = "/v2/merchant-accounts/{id}",
params (("id" = String, Path, description = "The unique identifier for the merchant account")),
responses(
(status = 200, description = "Merchant Account Retrieved", body = MerchantAccountResponse),
@@ -190,7 +190,7 @@ pub async fn update_merchant_account() {}
/// Updates details of an existing merchant account. Helpful in updating merchant details such as email, contact details, or other configuration details like webhook, routing algorithm etc
#[utoipa::path(
put,
- path = "/v2/merchant_accounts/{id}",
+ path = "/v2/merchant-accounts/{id}",
request_body (
content = MerchantAccountUpdate,
examples(
@@ -300,7 +300,7 @@ pub async fn payment_connector_list_profile() {}
/// List profiles for an Merchant
#[utoipa::path(
get,
- path = "/v2/merchant_accounts/{id}/profiles",
+ path = "/v2/merchant-accounts/{id}/profiles",
params (("id" = String, Path, description = "The unique identifier for the Merchant")),
responses(
(status = 200, description = "profile list retrieved successfully", body = Vec<ProfileResponse>),
diff --git a/crates/openapi/src/routes/merchant_connector_account.rs b/crates/openapi/src/routes/merchant_connector_account.rs
index 29092b5bba0..372f8688a26 100644
--- a/crates/openapi/src/routes/merchant_connector_account.rs
+++ b/crates/openapi/src/routes/merchant_connector_account.rs
@@ -67,7 +67,7 @@ pub async fn connector_create() {}
#[cfg(feature = "v2")]
#[utoipa::path(
post,
- path = "/v2/connector_accounts",
+ path = "/v2/connector-accounts",
request_body(
content = MerchantConnectorCreate,
examples(
@@ -152,7 +152,7 @@ pub async fn connector_retrieve() {}
#[cfg(feature = "v2")]
#[utoipa::path(
get,
- path = "/v2/connector_accounts/{id}",
+ path = "/v2/connector-accounts/{id}",
params(
("id" = i32, Path, description = "The unique identifier for the Merchant Connector")
),
@@ -241,7 +241,7 @@ pub async fn connector_update() {}
#[cfg(feature = "v2")]
#[utoipa::path(
put,
- path = "/v2/connector_accounts/{id}",
+ path = "/v2/connector-accounts/{id}",
request_body(
content = MerchantConnectorUpdate,
examples(
@@ -310,7 +310,7 @@ pub async fn connector_delete() {}
#[cfg(feature = "v2")]
#[utoipa::path(
delete,
- path = "/v2/connector_accounts/{id}",
+ path = "/v2/connector-accounts/{id}",
params(
("id" = i32, Path, description = "The unique identifier for the Merchant Connector")
),
diff --git a/crates/openapi/src/routes/organization.rs b/crates/openapi/src/routes/organization.rs
index ce3199343cf..d677131d5db 100644
--- a/crates/openapi/src/routes/organization.rs
+++ b/crates/openapi/src/routes/organization.rs
@@ -150,7 +150,7 @@ pub async fn organization_update() {}
/// List merchant accounts for an Organization
#[utoipa::path(
get,
- path = "/v2/organization/{id}/merchant_accounts",
+ path = "/v2/organization/{id}/merchant-accounts",
params (("id" = String, Path, description = "The unique identifier for the Organization")),
responses(
(status = 200, description = "Merchant Account list retrieved successfully", body = Vec<MerchantAccountResponse>),
diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs
index 3bc593aa5b2..b38a2342678 100644
--- a/crates/openapi/src/routes/payment_method.rs
+++ b/crates/openapi/src/routes/payment_method.rs
@@ -31,6 +31,7 @@
operation_id = "Create a Payment Method",
security(("api_key" = []))
)]
+#[cfg(feature = "v1")]
pub async fn create_payment_method_api() {}
/// List payment methods for a Merchant
@@ -84,6 +85,7 @@ pub async fn list_payment_method_api() {}
operation_id = "List all Payment Methods for a Customer",
security(("api_key" = []))
)]
+#[cfg(feature = "v1")]
pub async fn list_customer_payment_method_api() {}
/// List customer saved payment methods for a Payment
@@ -130,6 +132,7 @@ pub async fn list_customer_payment_method_api_client() {}
operation_id = "Retrieve a Payment method",
security(("api_key" = []))
)]
+#[cfg(feature = "v1")]
pub async fn payment_method_retrieve_api() {}
/// Payment Method - Update
@@ -151,6 +154,7 @@ pub async fn payment_method_retrieve_api() {}
operation_id = "Update a Payment method",
security(("api_key" = []), ("publishable_key" = []))
)]
+#[cfg(feature = "v1")]
pub async fn payment_method_update_api() {}
/// Payment Method - Delete
@@ -170,6 +174,7 @@ pub async fn payment_method_update_api() {}
operation_id = "Delete a Payment method",
security(("api_key" = []))
)]
+#[cfg(feature = "v1")]
pub async fn payment_method_delete_api() {}
/// Payment Method - Set Default Payment Method for Customer
@@ -192,3 +197,171 @@ pub async fn payment_method_delete_api() {}
security(("ephemeral_key" = []))
)]
pub async fn default_payment_method_set_api() {}
+
+/// Payment Method - Create Intent
+///
+/// Creates a payment method for customer with billing information and other metadata.
+#[utoipa::path(
+ post,
+ path = "/v2/payment-methods/create-intent",
+ request_body(
+ content = PaymentMethodIntentCreate,
+ // TODO: Add examples
+ ),
+ responses(
+ (status = 200, description = "Payment Method Intent Created", body = PaymentMethodResponse),
+ (status = 400, description = "Invalid Data"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "Create Payment Method Intent",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn create_payment_method_intent_api() {}
+
+/// Payment Method - Confirm Intent
+///
+/// Update a payment method with customer's payment method related information.
+#[utoipa::path(
+ post,
+ path = "/v2/payment-methods/{id}/confirm-intent",
+ request_body(
+ content = PaymentMethodIntentConfirm,
+ // TODO: Add examples
+ ),
+ responses(
+ (status = 200, description = "Payment Method Intent Confirmed", body = PaymentMethodResponse),
+ (status = 400, description = "Invalid Data"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "Confirm Payment Method Intent",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn confirm_payment_method_intent_api() {}
+
+/// Payment Method - Create
+///
+/// Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.
+#[utoipa::path(
+ post,
+ path = "/v2/payment-methods",
+ request_body(
+ content = PaymentMethodCreate,
+ // TODO: Add examples
+ ),
+ responses(
+ (status = 200, description = "Payment Method Created", body = PaymentMethodResponse),
+ (status = 400, description = "Invalid Data"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "Create Payment Method",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn create_payment_method_api() {}
+
+/// Payment Method - Retrieve
+///
+/// Retrieves a payment method of a customer.
+#[utoipa::path(
+ get,
+ path = "/v2/payment-methods/{id}",
+ params (
+ ("id" = String, Path, description = "The unique identifier for the Payment Method"),
+ ),
+ responses(
+ (status = 200, description = "Payment Method Retrieved", body = PaymentMethodResponse),
+ (status = 404, description = "Payment Method Not Found"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "Retrieve Payment Method",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn payment_method_retrieve_api() {}
+
+/// Payment Method - Update
+///
+/// Update an existing payment method of a customer.
+#[utoipa::path(
+ patch,
+ path = "/v2/payment-methods/{id}/update-saved-payment-method",
+ request_body(
+ content = PaymentMethodUpdate,
+ // TODO: Add examples
+ ),
+ responses(
+ (status = 200, description = "Payment Method Update", body = PaymentMethodResponse),
+ (status = 400, description = "Invalid Data"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "Update Payment Method",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn payment_method_update_api() {}
+
+/// Payment Method - Delete
+///
+/// Deletes a payment method of a customer.
+#[utoipa::path(
+ delete,
+ path = "/v2/payment-methods/{id}",
+ params (
+ ("id" = String, Path, description = "The unique identifier for the Payment Method"),
+ ),
+ responses(
+ (status = 200, description = "Payment Method Retrieved", body = PaymentMethodDeleteResponse),
+ (status = 404, description = "Payment Method Not Found"),
+ ),
+ tag = "Payment Methods",
+ operation_id = "Delete Payment Method",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn payment_method_delete_api() {}
+
+/// List customer saved payment methods for a payment
+///
+/// To filter and list the applicable payment methods for a particular Customer ID, is to be associated with a payment
+#[utoipa::path(
+ get,
+ path = "/v2/payments/{id}/saved-payment-methods",
+ request_body(
+ content = PaymentMethodListRequest,
+ // TODO: Add examples and add param for customer_id
+ ),
+ responses(
+ (status = 200, description = "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", body = CustomerPaymentMethodsListResponse),
+ (status = 400, description = "Invalid Data"),
+ (status = 404, description = "Payment Methods does not exist in records")
+ ),
+ tag = "Payment Methods",
+ operation_id = "List all Payment Methods for a Customer",
+ security(("publishable_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn list_customer_payment_method_for_payment() {}
+
+/// List saved payment methods for a Customer
+///
+/// To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context
+#[utoipa::path(
+ get,
+ path = "/v2/customers/{id}/saved-payment-methods",
+ request_body(
+ content = PaymentMethodListRequest,
+ // TODO: Add examples and add param for customer_id
+ ),
+ responses(
+ (status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse),
+ (status = 400, description = "Invalid Data"),
+ (status = 404, description = "Payment Methods does not exist in records")
+ ),
+ tag = "Payment Methods",
+ operation_id = "List all Payment Methods for a Customer",
+ security(("api_key" = []))
+)]
+#[cfg(feature = "v2")]
+pub async fn list_customer_payment_method_api() {}
diff --git a/crates/openapi/src/routes/profile.rs b/crates/openapi/src/routes/profile.rs
index d88568653a4..cc484aa3f95 100644
--- a/crates/openapi/src/routes/profile.rs
+++ b/crates/openapi/src/routes/profile.rs
@@ -210,7 +210,7 @@ pub async fn profile_update() {}
/// Activates a routing algorithm under a profile
#[utoipa::path(
patch,
- path = "/v2/profiles/{id}/activate_routing_algorithm",
+ path = "/v2/profiles/{id}/activate-routing-algorithm",
request_body ( content = RoutingAlgorithmId,
examples( (
"Activate a routing algorithm" = (
@@ -240,7 +240,7 @@ pub async fn routing_link_config() {}
/// Deactivates a routing algorithm under a profile
#[utoipa::path(
patch,
- path = "/v2/profiles/{id}/deactivate_routing_algorithm",
+ path = "/v2/profiles/{id}/deactivate-routing-algorithm",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
),
@@ -263,7 +263,7 @@ pub async fn routing_unlink_config() {}
/// Update the default fallback routing algorithm for the profile
#[utoipa::path(
patch,
- path = "/v2/profiles/{id}/fallback_routing",
+ path = "/v2/profiles/{id}/fallback-routing",
request_body = Vec<RoutableConnectorChoice>,
params(
("id" = String, Path, description = "The unique identifier for the profile"),
@@ -307,11 +307,11 @@ pub async fn profile_retrieve() {}
#[cfg(feature = "v2")]
/// Profile - Retrieve Active Routing Algorithm
-///
+///_
/// Retrieve active routing algorithm under the profile
#[utoipa::path(
get,
- path = "/v2/profiles/{id}/routing_algorithm",
+ path = "/v2/profiles/{id}/routing-algorithm",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
("limit" = Option<u16>, Query, description = "The number of records of the algorithms to be returned"),
@@ -334,7 +334,7 @@ pub async fn routing_retrieve_linked_config() {}
/// Retrieve the default fallback routing algorithm for the profile
#[utoipa::path(
get,
- path = "/v2/profiles/{id}/fallback_routing",
+ path = "/v2/profiles/{id}/fallback-routing",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
),
@@ -353,7 +353,7 @@ pub async fn routing_retrieve_default_config() {}
/// List Connector Accounts for the profile
#[utoipa::path(
get,
- path = "/v2/profiles/{id}/connector_accounts",
+ path = "/v2/profiles/{id}/connector-accounts",
params(
("id" = String, Path, description = "The unique identifier for the business profile"),
(
diff --git a/crates/openapi/src/routes/routing.rs b/crates/openapi/src/routes/routing.rs
index 67a22c2ca64..b144fd046ad 100644
--- a/crates/openapi/src/routes/routing.rs
+++ b/crates/openapi/src/routes/routing.rs
@@ -26,7 +26,7 @@ pub async fn routing_create_config() {}
/// Create a routing algorithm
#[utoipa::path(
post,
- path = "/v2/routing_algorithm",
+ path = "/v2/routing-algorithm",
request_body = RoutingConfigRequest,
responses(
(status = 200, description = "Routing Algorithm created", body = RoutingDictionaryRecord),
@@ -94,7 +94,7 @@ pub async fn routing_retrieve_config() {}
#[utoipa::path(
get,
- path = "/v2/routing_algorithm/{id}",
+ path = "/v2/routing-algorithm/{id}",
params(
("id" = String, Path, description = "The unique identifier for a routing algorithm"),
),
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0f13e08d53e..bb0c547d7f1 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -556,11 +556,15 @@ impl Payments {
)
.service(web::resource("").route(web::get().to(payments::payment_status)))
.service(
- web::resource("/start_redirection")
+ web::resource("/start-redirection")
.route(web::get().to(payments::payments_start_redirection)),
)
.service(
- web::resource("/finish_redirection/{publishable_key}/{profile_id}")
+ web::resource("/saved-payment-methods")
+ .route(web::get().to(list_customer_payment_method_for_payment)),
+ )
+ .service(
+ web::resource("/finish-redirection/{publishable_key}/{profile_id}")
.route(web::get().to(payments::payments_finish_redirection)),
),
);
@@ -715,7 +719,7 @@ pub struct Routing;
#[cfg(all(feature = "olap", feature = "v2"))]
impl Routing {
pub fn server(state: AppState) -> Scope {
- web::scope("/v2/routing_algorithm")
+ web::scope("/v2/routing-algorithm")
.app_data(web::Data::new(state.clone()))
.service(
web::resource("").route(web::post().to(|state, req, payload| {
@@ -968,7 +972,7 @@ impl Customers {
#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))]
{
route = route.service(
- web::resource("/{customer_id}/saved_payment_methods")
+ web::resource("/{customer_id}/saved-payment-methods")
.route(web::get().to(list_customer_payment_method_api)),
);
}
@@ -1113,7 +1117,7 @@ impl Payouts {
#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2",))]
impl PaymentMethods {
pub fn server(state: AppState) -> Scope {
- let mut route = web::scope("/v2/payment_methods").app_data(web::Data::new(state));
+ let mut route = web::scope("/v2/payment-methods").app_data(web::Data::new(state));
route = route
.service(web::resource("").route(web::post().to(create_payment_method_api)))
.service(
@@ -1125,7 +1129,7 @@ impl PaymentMethods {
.route(web::post().to(confirm_payment_method_intent_api)),
)
.service(
- web::resource("/{id}/update_saved_payment_method")
+ web::resource("/{id}/update-saved-payment-method")
.route(web::patch().to(payment_method_update_api)),
)
.service(web::resource("/{id}").route(web::get().to(payment_method_retrieve_api)))
@@ -1267,7 +1271,7 @@ impl Organization {
.route(web::put().to(admin::organization_update)),
)
.service(
- web::resource("/merchant_accounts")
+ web::resource("/merchant-accounts")
.route(web::get().to(admin::merchant_account_list)),
),
)
@@ -1279,7 +1283,7 @@ pub struct MerchantAccount;
#[cfg(all(feature = "v2", feature = "olap"))]
impl MerchantAccount {
pub fn server(state: AppState) -> Scope {
- web::scope("/v2/merchant_accounts")
+ web::scope("/v2/merchant-accounts")
.app_data(web::Data::new(state))
.service(web::resource("").route(web::post().to(admin::merchant_account_create)))
.service(
@@ -1329,7 +1333,7 @@ pub struct MerchantConnectorAccount;
#[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v2"))]
impl MerchantConnectorAccount {
pub fn server(state: AppState) -> Scope {
- let mut route = web::scope("/v2/connector_accounts").app_data(web::Data::new(state));
+ let mut route = web::scope("/v2/connector-accounts").app_data(web::Data::new(state));
#[cfg(feature = "olap")]
{
@@ -1526,7 +1530,7 @@ pub struct ApiKeys;
#[cfg(all(feature = "olap", feature = "v2"))]
impl ApiKeys {
pub fn server(state: AppState) -> Scope {
- web::scope("/v2/api_keys")
+ web::scope("/v2/api-keys")
.app_data(web::Data::new(state))
.service(web::resource("").route(web::post().to(api_keys::api_key_create)))
.service(web::resource("/list").route(web::get().to(api_keys::api_key_list)))
@@ -1691,16 +1695,16 @@ impl Profile {
.route(web::put().to(profiles::profile_update)),
)
.service(
- web::resource("/connector_accounts")
+ web::resource("/connector-accounts")
.route(web::get().to(admin::connector_list)),
)
.service(
- web::resource("/fallback_routing")
+ web::resource("/fallback-routing")
.route(web::get().to(routing::routing_retrieve_default_config))
.route(web::patch().to(routing::routing_update_default_config)),
)
.service(
- web::resource("/activate_routing_algorithm").route(web::patch().to(
+ web::resource("/activate-routing-algorithm").route(web::patch().to(
|state, req, path, payload| {
routing::routing_link_config(
state,
@@ -1713,7 +1717,7 @@ impl Profile {
)),
)
.service(
- web::resource("/deactivate_routing_algorithm").route(web::patch().to(
+ web::resource("/deactivate-routing-algorithm").route(web::patch().to(
|state, req, path| {
routing::routing_unlink_config(
state,
@@ -1724,7 +1728,7 @@ impl Profile {
},
)),
)
- .service(web::resource("/routing_algorithm").route(web::get().to(
+ .service(web::resource("/routing-algorithm").route(web::get().to(
|state, req, query_params, path| {
routing::routing_retrieve_linked_config(
state,
@@ -1999,7 +2003,7 @@ impl User {
)
.service(web::resource("/verify_email").route(web::post().to(user::verify_email)))
.service(
- web::resource("/v2/verify_email").route(web::post().to(user::verify_email)),
+ web::resource("/v2/verify-email").route(web::post().to(user::verify_email)),
)
.service(
web::resource("/verify_email_request")
@@ -2053,7 +2057,7 @@ impl User {
.route(web::post().to(user_role::accept_invitations_v2)),
)
.service(
- web::resource("/pre_auth").route(
+ web::resource("/pre-auth").route(
web::post().to(user_role::accept_invitations_pre_auth),
),
),
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 7296a510248..8ee31ecf943 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -508,30 +508,6 @@ pub async fn list_customer_payment_method_api(
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-/// List payment methods for a Customer v2
-///
-/// To filter and list the applicable payment methods for a particular Customer ID, is to be associated with a payment
-#[utoipa::path(
- get,
- path = "v2/payments/{payment_id}/saved_payment_methods",
- params (
- ("client-secret" = String, Path, description = "A secret known only to your application and the authorization server"),
- ("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
- ("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
- ("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
- ("maximum_amount" = i64, Query, description = "The maximum amount amount accepted for processing by the particular payment method."),
- ("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
- ("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
- ),
- responses(
- (status = 200, description = "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", body = CustomerPaymentMethodsListResponse),
- (status = 400, description = "Invalid Data"),
- (status = 404, description = "Payment Methods does not exist in records")
- ),
- tag = "Payment Methods",
- operation_id = "List all Payment Methods for a Customer",
- security(("publishable_key" = []))
-)]
#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))]
pub async fn list_customer_payment_method_for_payment(
state: web::Data<AppState>,
@@ -575,29 +551,6 @@ pub async fn list_customer_payment_method_for_payment(
feature = "payment_methods_v2",
feature = "customer_v2"
))]
-/// List payment methods for a Customer v2
-///
-/// To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context
-#[utoipa::path(
- get,
- path = "v2/customers/{customer_id}/saved_payment_methods",
- params (
- ("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
- ("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
- ("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
- ("maximum_amount" = i64, Query, description = "The maximum amount amount accepted for processing by the particular payment method."),
- ("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
- ("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
- ),
- responses(
- (status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse),
- (status = 400, description = "Invalid Data"),
- (status = 404, description = "Payment Methods does not exist in records")
- ),
- tag = "Payment Methods",
- operation_id = "List all Payment Methods for a Customer",
- security(("api_key" = []))
-)]
#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))]
pub async fn list_customer_payment_method_api(
state: web::Data<AppState>,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index c81fc7ceb48..85275a768df 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -34,6 +34,10 @@ use crate::{
impl ForeignFrom<diesel_models::organization::Organization> for OrganizationResponse {
fn foreign_from(org: diesel_models::organization::Organization) -> Self {
Self {
+ #[cfg(feature = "v2")]
+ id: org.get_organization_id(),
+
+ #[cfg(feature = "v1")]
organization_id: org.get_organization_id(),
organization_name: org.get_organization_name(),
organization_details: org.organization_details,
diff --git a/cypress-tests-v2/cypress/support/commands.js b/cypress-tests-v2/cypress/support/commands.js
index eb4ca3423eb..b6955c542a7 100644
--- a/cypress-tests-v2/cypress/support/commands.js
+++ b/cypress-tests-v2/cypress/support/commands.js
@@ -64,10 +64,10 @@ Cypress.Commands.add(
if (response.status === 200) {
expect(response.body)
- .to.have.property("organization_id")
+ .to.have.property("id")
.and.to.include("org_")
.and.to.be.a("string").and.not.be.empty;
- globalState.set("organizationId", response.body.organization_id);
+ globalState.set("organizationId", response.body.id);
cy.task("setGlobalState", globalState.data);
expect(response.body).to.have.property("metadata").and.to.equal(null);
} else {
@@ -99,7 +99,7 @@ Cypress.Commands.add("organizationRetrieveCall", (globalState) => {
if (response.status === 200) {
expect(response.body)
- .to.have.property("organization_id")
+ .to.have.property("id")
.and.to.include("org_")
.and.to.be.a("string").and.not.be.empty;
expect(response.body.organization_name)
@@ -107,7 +107,7 @@ Cypress.Commands.add("organizationRetrieveCall", (globalState) => {
.and.to.be.a("string").and.not.be.empty;
if (organization_id === undefined || organization_id === null) {
- globalState.set("organizationId", response.body.organization_id);
+ globalState.set("organizationId", response.body.id);
cy.task("setGlobalState", globalState.data);
}
} else {
@@ -144,14 +144,14 @@ Cypress.Commands.add(
if (response.status === 200) {
expect(response.body)
- .to.have.property("organization_id")
+ .to.have.property("id")
.and.to.include("org_")
.and.to.be.a("string").and.not.be.empty;
expect(response.body).to.have.property("metadata").and.to.be.a("object")
.and.not.be.empty;
if (organization_id === undefined || organization_id === null) {
- globalState.set("organizationId", response.body.organization_id);
+ globalState.set("organizationId", response.body.id);
cy.task("setGlobalState", globalState.data);
}
} else {
@@ -174,7 +174,7 @@ Cypress.Commands.add(
const key_id_type = "publishable_key";
const key_id = validateEnv(base_url, key_id_type);
const organization_id = globalState.get("organizationId");
- const url = `${base_url}/v2/merchant_accounts`;
+ const url = `${base_url}/v2/merchant-accounts`;
const merchant_name = merchantAccountCreateBody.merchant_name
.replaceAll(" ", "")
@@ -223,7 +223,7 @@ Cypress.Commands.add("merchantAccountRetrieveCall", (globalState) => {
const key_id_type = "publishable_key";
const key_id = validateEnv(base_url, key_id_type);
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/merchant_accounts/${merchant_id}`;
+ const url = `${base_url}/v2/merchant-accounts/${merchant_id}`;
cy.request({
method: "GET",
@@ -265,7 +265,7 @@ Cypress.Commands.add(
const key_id_type = "publishable_key";
const key_id = validateEnv(base_url, key_id_type);
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/merchant_accounts/${merchant_id}`;
+ const url = `${base_url}/v2/merchant-accounts/${merchant_id}`;
const merchant_name = merchantAccountUpdateBody.merchant_name;
@@ -456,7 +456,7 @@ Cypress.Commands.add(
const base_url = globalState.get("baseUrl");
const merchant_id = globalState.get("merchantId");
const profile_id = globalState.get("profileId");
- const url = `${base_url}/v2/connector_accounts`;
+ const url = `${base_url}/v2/connector-accounts`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -536,7 +536,7 @@ Cypress.Commands.add("mcaRetrieveCall", (globalState) => {
const connector_name = globalState.get("connectorId");
const merchant_connector_id = globalState.get("merchantConnectorId");
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/connector_accounts/${merchant_connector_id}`;
+ const url = `${base_url}/v2/connector-accounts/${merchant_connector_id}`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -590,7 +590,7 @@ Cypress.Commands.add(
const merchant_connector_id = globalState.get("merchantConnectorId");
const merchant_id = globalState.get("merchantId");
const profile_id = globalState.get("profileId");
- const url = `${base_url}/v2/connector_accounts/${merchant_connector_id}`;
+ const url = `${base_url}/v2/connector-accounts/${merchant_connector_id}`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -653,7 +653,7 @@ Cypress.Commands.add("apiKeyCreateCall", (apiKeyCreateBody, globalState) => {
const key_id_type = "key_id";
const key_id = validateEnv(base_url, key_id_type);
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/api_keys`;
+ const url = `${base_url}/v2/api-keys`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -703,7 +703,7 @@ Cypress.Commands.add("apiKeyRetrieveCall", (globalState) => {
const key_id = validateEnv(base_url, key_id_type);
const merchant_id = globalState.get("merchantId");
const api_key_id = globalState.get("apiKeyId");
- const url = `${base_url}/v2/api_keys/${api_key_id}`;
+ const url = `${base_url}/v2/api-keys/${api_key_id}`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -750,7 +750,7 @@ Cypress.Commands.add("apiKeyUpdateCall", (apiKeyUpdateBody, globalState) => {
const key_id_type = "key_id";
const key_id = validateEnv(base_url, key_id_type);
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/api_keys/${api_key_id}`;
+ const url = `${base_url}/v2/api-keys/${api_key_id}`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -801,7 +801,7 @@ Cypress.Commands.add(
const api_key = globalState.get("userInfoToken");
const base_url = globalState.get("baseUrl");
const profile_id = globalState.get("profileId");
- const url = `${base_url}/v2/routing_algorithm`;
+ const url = `${base_url}/v2/routing-algorithm`;
// Update request body
routingSetupBody.algorithm.data = payload.data;
@@ -847,7 +847,7 @@ Cypress.Commands.add(
const base_url = globalState.get("baseUrl");
const profile_id = globalState.get("profileId");
const routing_algorithm_id = globalState.get("routingAlgorithmId");
- const url = `${base_url}/v2/profiles/${profile_id}/activate_routing_algorithm`;
+ const url = `${base_url}/v2/profiles/${profile_id}/activate-routing-algorithm`;
// Update request body
routingActivationBody.routing_algorithm_id = routing_algorithm_id;
@@ -885,7 +885,7 @@ Cypress.Commands.add("routingActivationRetrieveCall", (globalState) => {
const profile_id = globalState.get("profileId");
const query_params = "limit=10";
const routing_algorithm_id = globalState.get("routingAlgorithmId");
- const url = `${base_url}/v2/profiles/${profile_id}/routing_algorithm?${query_params}`;
+ const url = `${base_url}/v2/profiles/${profile_id}/routing-algorithm?${query_params}`;
cy.request({
method: "GET",
@@ -922,7 +922,7 @@ Cypress.Commands.add("routingDeactivateCall", (globalState) => {
const base_url = globalState.get("baseUrl");
const profile_id = globalState.get("profileId");
const routing_algorithm_id = globalState.get("routingAlgorithmId");
- const url = `${base_url}/v2/profiles/${profile_id}/deactivate_routing_algorithm`;
+ const url = `${base_url}/v2/profiles/${profile_id}/deactivate-routing-algorithm`;
cy.request({
method: "PATCH",
@@ -957,7 +957,7 @@ Cypress.Commands.add("routingRetrieveCall", (globalState) => {
const base_url = globalState.get("baseUrl");
const profile_id = globalState.get("profileId");
const routing_algorithm_id = globalState.get("routingAlgorithmId");
- const url = `${base_url}/v2/routing_algorithm/${routing_algorithm_id}`;
+ const url = `${base_url}/v2/routing-algorithm/${routing_algorithm_id}`;
cy.request({
method: "GET",
@@ -996,7 +996,7 @@ Cypress.Commands.add(
const base_url = globalState.get("baseUrl");
const profile_id = globalState.get("profileId");
const routing_algorithm_id = globalState.get("routingAlgorithmId");
- const url = `${base_url}/v2/profiles/${profile_id}/fallback_routing`;
+ const url = `${base_url}/v2/profiles/${profile_id}/fallback-routing`;
// Update request body
routingDefaultFallbackBody = payload;
@@ -1029,7 +1029,7 @@ Cypress.Commands.add("routingFallbackRetrieveCall", (globalState) => {
const api_key = globalState.get("userInfoToken");
const base_url = globalState.get("baseUrl");
const profile_id = globalState.get("profileId");
- const url = `${base_url}/v2/profiles/${profile_id}/fallback_routing`;
+ const url = `${base_url}/v2/profiles/${profile_id}/fallback-routing`;
cy.request({
method: "GET",
@@ -1166,7 +1166,7 @@ Cypress.Commands.add("merchantAccountsListCall", (globalState) => {
const key_id_type = "publishable_key";
const key_id = validateEnv(base_url, key_id_type);
const organization_id = globalState.get("organizationId");
- const url = `${base_url}/v2/organization/${organization_id}/merchant_accounts`;
+ const url = `${base_url}/v2/organization/${organization_id}/merchant-accounts`;
cy.request({
method: "GET",
@@ -1204,7 +1204,7 @@ Cypress.Commands.add("businessProfilesListCall", (globalState) => {
const api_key = globalState.get("adminApiKey");
const base_url = globalState.get("baseUrl");
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/merchant_accounts/${merchant_id}/profiles`;
+ const url = `${base_url}/v2/merchant-accounts/${merchant_id}/profiles`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -1246,7 +1246,7 @@ Cypress.Commands.add("mcaListCall", (globalState, service_type) => {
const base_url = globalState.get("baseUrl");
const merchant_id = globalState.get("merchantId");
const profile_id = globalState.get("profileId");
- const url = `${base_url}/v2/profiles/${profile_id}/connector_accounts`;
+ const url = `${base_url}/v2/profiles/${profile_id}/connector-accounts`;
const customHeaders = {
"x-merchant-id": merchant_id,
@@ -1308,7 +1308,7 @@ Cypress.Commands.add("apiKeysListCall", (globalState) => {
const key_id_type = "key_id";
const key_id = validateEnv(base_url, key_id_type);
const merchant_id = globalState.get("merchantId");
- const url = `${base_url}/v2/api_keys/list`;
+ const url = `${base_url}/v2/api-keys/list`;
const customHeaders = {
"x-merchant-id": merchant_id,
|
fix
|
Standardise API naming scheme for V2 (#6510)
|
6563587564a6de579888a751b8c21e832060d728
|
2023-06-14 15:12:56
|
Shankar Singh C
|
fix(core): return an empty array when the customer does not have any payment methods (#1431)
| false
|
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 499056aa4e5..a5a5c0917fa 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1562,6 +1562,10 @@ pub async fn list_customer_payment_method(
) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {
let db = &*state.store;
+ db.find_customer_by_customer_id_merchant_id(customer_id, &merchant_account.merchant_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
+
let resp = db
.find_payment_method_by_customer_id_merchant_id_list(
customer_id,
@@ -1570,11 +1574,6 @@ pub async fn list_customer_payment_method(
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?;
//let mca = query::find_mca_by_merchant_id(conn, &merchant_account.merchant_id)?;
- if resp.is_empty() {
- return Err(error_stack::report!(
- errors::ApiErrorResponse::PaymentMethodNotFound
- ));
- }
let mut customer_pms = Vec::new();
for pm in resp.into_iter() {
let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token");
|
fix
|
return an empty array when the customer does not have any payment methods (#1431)
|
860a57ad9a679056ac66423edfc16973f497e184
|
2024-11-08 17:23:28
|
Debarati Ghatak
|
fix(connector): [Novalnet] Send decoded wallet token to applepay (#6503)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 26364d73f4f..313e35eeb0e 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -32,8 +32,9 @@ use strum::Display;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
- self, BrowserInformationData, PaymentsAuthorizeRequestData, PaymentsCancelRequestData,
- PaymentsCaptureRequestData, PaymentsSyncRequestData, RefundsRequestData, RouterData as _,
+ self, ApplePay, BrowserInformationData, PaymentsAuthorizeRequestData,
+ PaymentsCancelRequestData, PaymentsCaptureRequestData, PaymentsSyncRequestData,
+ RefundsRequestData, RouterData as _,
},
};
@@ -298,7 +299,8 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
return_url: None,
error_return_url: None,
payment_data: Some(NovalNetPaymentData::ApplePay(NovalnetApplePay {
- wallet_data: Secret::new(payment_method_data.payment_data.clone()),
+ wallet_data: payment_method_data
+ .get_applepay_decoded_payment_data()?,
})),
enforce_3d: None,
create_token,
|
fix
|
[Novalnet] Send decoded wallet token to applepay (#6503)
|
1d26df28bc5e1db359272b40adae70bfba9b7360
|
2024-01-05 16:01:56
|
harsh-sharma-juspay
|
feat(analytics): adding outgoing webhooks kafka event (#3140)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index f9ae71d3b9e..21a3ba6de93 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -524,9 +524,10 @@ enabled = true # Switch to enable or disable PayPal onboarding
source = "logs" # The event sink to push events supports kafka or logs (stdout)
[events.kafka]
-brokers = [] # Kafka broker urls for bootstrapping the client
-intent_analytics_topic = "topic" # Kafka topic to be used for PaymentIntent events
-attempt_analytics_topic = "topic" # Kafka topic to be used for PaymentAttempt events
-refund_analytics_topic = "topic" # Kafka topic to be used for Refund events
-api_logs_topic = "topic" # Kafka topic to be used for incoming api events
-connector_logs_topic = "topic" # Kafka topic to be used for connector api events
\ No newline at end of file
+brokers = [] # Kafka broker urls for bootstrapping the client
+intent_analytics_topic = "topic" # Kafka topic to be used for PaymentIntent events
+attempt_analytics_topic = "topic" # Kafka topic to be used for PaymentAttempt events
+refund_analytics_topic = "topic" # Kafka topic to be used for Refund events
+api_logs_topic = "topic" # Kafka topic to be used for incoming api events
+connector_logs_topic = "topic" # Kafka topic to be used for connector api events
+outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webhook events
diff --git a/config/development.toml b/config/development.toml
index 6e7e040906a..80d594b248b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -519,6 +519,7 @@ attempt_analytics_topic = "hyperswitch-payment-attempt-events"
refund_analytics_topic = "hyperswitch-refund-events"
api_logs_topic = "hyperswitch-api-log-events"
connector_logs_topic = "hyperswitch-connector-api-events"
+outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
[analytics]
source = "sqlx"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 63be7339c7b..1d3c845aa54 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -366,6 +366,7 @@ attempt_analytics_topic = "hyperswitch-payment-attempt-events"
refund_analytics_topic = "hyperswitch-refund-events"
api_logs_topic = "hyperswitch-api-log-events"
connector_logs_topic = "hyperswitch-connector-api-events"
+outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events"
[analytics]
source = "sqlx"
diff --git a/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql b/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql
new file mode 100644
index 00000000000..3dc907629d0
--- /dev/null
+++ b/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql
@@ -0,0 +1,109 @@
+CREATE TABLE
+ outgoing_webhook_events_queue (
+ `merchant_id` String,
+ `event_id` Nullable(String),
+ `event_type` LowCardinality(String),
+ `outgoing_webhook_event_type` LowCardinality(String),
+ `payment_id` Nullable(String),
+ `refund_id` Nullable(String),
+ `attempt_id` Nullable(String),
+ `dispute_id` Nullable(String),
+ `payment_method_id` Nullable(String),
+ `mandate_id` Nullable(String),
+ `content` Nullable(String),
+ `is_error` Bool,
+ `error` Nullable(String),
+ `created_at_timestamp` DateTime64(3)
+ ) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
+ kafka_topic_list = 'hyperswitch-outgoing-webhook-events',
+ kafka_group_name = 'hyper-c1',
+ kafka_format = 'JSONEachRow',
+ kafka_handle_error_mode = 'stream';
+
+CREATE TABLE
+ outgoing_webhook_events_cluster (
+ `merchant_id` String,
+ `event_id` String,
+ `event_type` LowCardinality(String),
+ `outgoing_webhook_event_type` LowCardinality(String),
+ `payment_id` Nullable(String),
+ `refund_id` Nullable(String),
+ `attempt_id` Nullable(String),
+ `dispute_id` Nullable(String),
+ `payment_method_id` Nullable(String),
+ `mandate_id` Nullable(String),
+ `content` Nullable(String),
+ `is_error` Bool,
+ `error` Nullable(String),
+ `created_at_timestamp` DateTime64(3),
+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
+ INDEX eventIndex event_type TYPE bloom_filter GRANULARITY 1,
+ INDEX webhookeventIndex outgoing_webhook_event_type TYPE bloom_filter GRANULARITY 1
+ ) ENGINE = MergeTree PARTITION BY toStartOfDay(created_at_timestamp)
+ORDER BY (
+ created_at_timestamp,
+ merchant_id,
+ event_id,
+ event_type,
+ outgoing_webhook_event_type
+ ) TTL inserted_at + toIntervalMonth(6);
+
+CREATE MATERIALIZED VIEW outgoing_webhook_events_mv TO outgoing_webhook_events_cluster (
+ `merchant_id` String,
+ `event_id` Nullable(String),
+ `event_type` LowCardinality(String),
+ `outgoing_webhook_event_type` LowCardinality(String),
+ `payment_id` Nullable(String),
+ `refund_id` Nullable(String),
+ `attempt_id` Nullable(String),
+ `dispute_id` Nullable(String),
+ `payment_method_id` Nullable(String),
+ `mandate_id` Nullable(String),
+ `content` Nullable(String),
+ `is_error` Bool,
+ `error` Nullable(String),
+ `created_at_timestamp` DateTime64(3),
+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
+) AS
+SELECT
+ merchant_id,
+ event_id,
+ event_type,
+ outgoing_webhook_event_type,
+ payment_id,
+ refund_id,
+ attempt_id,
+ dispute_id,
+ payment_method_id,
+ mandate_id,
+ content,
+ is_error,
+ error,
+ created_at_timestamp,
+ now() AS inserted_at
+FROM
+ outgoing_webhook_events_queue
+where length(_error) = 0;
+
+CREATE MATERIALIZED VIEW outgoing_webhook_parse_errors (
+ `topic` String,
+ `partition` Int64,
+ `offset` Int64,
+ `raw` String,
+ `error` String
+) ENGINE = MergeTree
+ORDER BY (
+ topic, partition,
+ offset
+ ) SETTINGS index_granularity = 8192 AS
+SELECT
+ _topic AS topic,
+ _partition AS partition,
+ _offset AS
+offset
+,
+ _raw_message AS raw,
+ _error AS error
+FROM
+ outgoing_webhook_events_queue
+WHERE length(_error) > 0;
\ No newline at end of file
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index 054f4053504..cbc4290f63b 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -226,7 +226,7 @@ pub enum KmsError {
Utf8DecodingFailed,
}
-#[derive(Debug, thiserror::Error)]
+#[derive(Debug, thiserror::Error, serde::Serialize)]
pub enum WebhooksFlowError {
#[error("Merchant webhook config not found")]
MerchantConfigNotFound,
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index 762ee19b641..c7e7548f00b 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -25,7 +25,10 @@ use crate::{
payments, refunds,
},
db::StorageInterface,
- events::api_logs::ApiEvent,
+ events::{
+ api_logs::ApiEvent,
+ outgoing_webhook_logs::{OutgoingWebhookEvent, OutgoingWebhookEventMetric},
+ },
logger,
routes::{app::AppStateInfo, lock_utils, metrics::request::add_attributes, AppState},
services::{self, authentication as auth},
@@ -731,21 +734,47 @@ pub async fn create_event_and_trigger_outgoing_webhook<W: types::OutgoingWebhook
if state.conf.webhooks.outgoing_enabled {
let outgoing_webhook = api::OutgoingWebhook {
merchant_id: merchant_account.merchant_id.clone(),
- event_id: event.event_id,
+ event_id: event.event_id.clone(),
event_type: event.event_type,
- content,
+ content: content.clone(),
timestamp: event.created_at,
};
-
+ let state_clone = state.clone();
// Using a tokio spawn here and not arbiter because not all caller of this function
// may have an actix arbiter
tokio::spawn(async move {
+ let mut error = None;
let result =
trigger_webhook_to_merchant::<W>(business_profile, outgoing_webhook, state).await;
if let Err(e) = result {
+ error.replace(
+ serde_json::to_value(e.current_context())
+ .into_report()
+ .attach_printable("Failed to serialize json error response")
+ .change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
+ .ok()
+ .into(),
+ );
logger::error!(?e);
}
+ let outgoing_webhook_event_type = content.get_outgoing_webhook_event_type();
+ let webhook_event = OutgoingWebhookEvent::new(
+ merchant_account.merchant_id.clone(),
+ event.event_id.clone(),
+ event_type,
+ outgoing_webhook_event_type,
+ error.is_some(),
+ error,
+ );
+ match webhook_event.clone().try_into() {
+ Ok(event) => {
+ state_clone.event_handler().log_event(event);
+ }
+ Err(err) => {
+ logger::error!(error=?err, event=?webhook_event, "Error Logging Outgoing Webhook Event");
+ }
+ }
});
}
diff --git a/crates/router/src/events.rs b/crates/router/src/events.rs
index 2dc9258e19d..0091de588f1 100644
--- a/crates/router/src/events.rs
+++ b/crates/router/src/events.rs
@@ -9,6 +9,7 @@ pub mod api_logs;
pub mod connector_api_logs;
pub mod event_logger;
pub mod kafka_handler;
+pub mod outgoing_webhook_logs;
pub(super) trait EventHandler: Sync + Send + dyn_clone::DynClone {
fn log_event(&self, event: RawEvent);
@@ -31,6 +32,7 @@ pub enum EventType {
Refund,
ApiLogs,
ConnectorApiLogs,
+ OutgoingWebhookLogs,
}
#[derive(Debug, Default, Deserialize, Clone)]
diff --git a/crates/router/src/events/outgoing_webhook_logs.rs b/crates/router/src/events/outgoing_webhook_logs.rs
new file mode 100644
index 00000000000..ebf36caf706
--- /dev/null
+++ b/crates/router/src/events/outgoing_webhook_logs.rs
@@ -0,0 +1,110 @@
+use api_models::{enums::EventType as OutgoingWebhookEventType, webhooks::OutgoingWebhookContent};
+use serde::Serialize;
+use serde_json::Value;
+use time::OffsetDateTime;
+
+use super::{EventType, RawEvent};
+
+#[derive(Clone, Debug, PartialEq, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub struct OutgoingWebhookEvent {
+ merchant_id: String,
+ event_id: String,
+ event_type: OutgoingWebhookEventType,
+ #[serde(flatten)]
+ content: Option<OutgoingWebhookEventContent>,
+ is_error: bool,
+ error: Option<Value>,
+ created_at_timestamp: i128,
+}
+
+#[derive(Clone, Debug, PartialEq, Serialize)]
+#[serde(tag = "outgoing_webhook_event_type", rename_all = "snake_case")]
+pub enum OutgoingWebhookEventContent {
+ Payment {
+ payment_id: Option<String>,
+ content: Value,
+ },
+ Refund {
+ payment_id: String,
+ refund_id: String,
+ content: Value,
+ },
+ Dispute {
+ payment_id: String,
+ attempt_id: String,
+ dispute_id: String,
+ content: Value,
+ },
+ Mandate {
+ payment_method_id: String,
+ mandate_id: String,
+ content: Value,
+ },
+}
+pub trait OutgoingWebhookEventMetric {
+ fn get_outgoing_webhook_event_type(&self) -> Option<OutgoingWebhookEventContent>;
+}
+impl OutgoingWebhookEventMetric for OutgoingWebhookContent {
+ fn get_outgoing_webhook_event_type(&self) -> Option<OutgoingWebhookEventContent> {
+ match self {
+ Self::PaymentDetails(payment_payload) => Some(OutgoingWebhookEventContent::Payment {
+ payment_id: payment_payload.payment_id.clone(),
+ content: masking::masked_serialize(&payment_payload)
+ .unwrap_or(serde_json::json!({"error":"failed to serialize"})),
+ }),
+ Self::RefundDetails(refund_payload) => Some(OutgoingWebhookEventContent::Refund {
+ payment_id: refund_payload.payment_id.clone(),
+ refund_id: refund_payload.refund_id.clone(),
+ content: masking::masked_serialize(&refund_payload)
+ .unwrap_or(serde_json::json!({"error":"failed to serialize"})),
+ }),
+ Self::DisputeDetails(dispute_payload) => Some(OutgoingWebhookEventContent::Dispute {
+ payment_id: dispute_payload.payment_id.clone(),
+ attempt_id: dispute_payload.attempt_id.clone(),
+ dispute_id: dispute_payload.dispute_id.clone(),
+ content: masking::masked_serialize(&dispute_payload)
+ .unwrap_or(serde_json::json!({"error":"failed to serialize"})),
+ }),
+ Self::MandateDetails(mandate_payload) => Some(OutgoingWebhookEventContent::Mandate {
+ payment_method_id: mandate_payload.payment_method_id.clone(),
+ mandate_id: mandate_payload.mandate_id.clone(),
+ content: masking::masked_serialize(&mandate_payload)
+ .unwrap_or(serde_json::json!({"error":"failed to serialize"})),
+ }),
+ }
+ }
+}
+
+impl OutgoingWebhookEvent {
+ pub fn new(
+ merchant_id: String,
+ event_id: String,
+ event_type: OutgoingWebhookEventType,
+ content: Option<OutgoingWebhookEventContent>,
+ is_error: bool,
+ error: Option<Value>,
+ ) -> Self {
+ Self {
+ merchant_id,
+ event_id,
+ event_type,
+ content,
+ is_error,
+ error,
+ created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,
+ }
+ }
+}
+
+impl TryFrom<OutgoingWebhookEvent> for RawEvent {
+ type Error = serde_json::Error;
+
+ fn try_from(value: OutgoingWebhookEvent) -> Result<Self, Self::Error> {
+ Ok(Self {
+ event_type: EventType::OutgoingWebhookLogs,
+ key: value.merchant_id.clone(),
+ payload: serde_json::to_value(value)?,
+ })
+ }
+}
diff --git a/crates/router/src/services/kafka.rs b/crates/router/src/services/kafka.rs
index 4c65b467787..5a6d7043e6d 100644
--- a/crates/router/src/services/kafka.rs
+++ b/crates/router/src/services/kafka.rs
@@ -84,6 +84,7 @@ pub struct KafkaSettings {
refund_analytics_topic: String,
api_logs_topic: String,
connector_logs_topic: String,
+ outgoing_webhook_logs_topic: String,
}
impl KafkaSettings {
@@ -140,6 +141,7 @@ pub struct KafkaProducer {
refund_analytics_topic: String,
api_logs_topic: String,
connector_logs_topic: String,
+ outgoing_webhook_logs_topic: String,
}
struct RdKafkaProducer(ThreadedProducer<DefaultProducerContext>);
@@ -177,6 +179,7 @@ impl KafkaProducer {
refund_analytics_topic: conf.refund_analytics_topic.clone(),
api_logs_topic: conf.api_logs_topic.clone(),
connector_logs_topic: conf.connector_logs_topic.clone(),
+ outgoing_webhook_logs_topic: conf.outgoing_webhook_logs_topic.clone(),
})
}
@@ -309,6 +312,7 @@ impl KafkaProducer {
EventType::PaymentIntent => &self.intent_analytics_topic,
EventType::Refund => &self.refund_analytics_topic,
EventType::ConnectorApiLogs => &self.connector_logs_topic,
+ EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic,
}
}
}
|
feat
|
adding outgoing webhooks kafka event (#3140)
|
17393f5be3e9027fedf9466c6401754f3c4d6b99
|
2023-10-09 13:30:24
|
Himanshu Singh
|
feat(connector): [Nuvei] Use "connector_request_reference_id" for as "attempt_id" to improve consistency in transmitting payment information (#2493)
| false
|
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index cf7d480e0c1..2fd1a9c272f 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -384,7 +384,7 @@ impl TryFrom<&types::PaymentsAuthorizeSessionTokenRouterData> for NuveiSessionRe
let connector_meta: NuveiAuthType = NuveiAuthType::try_from(&item.connector_auth_type)?;
let merchant_id = connector_meta.merchant_id;
let merchant_site_id = connector_meta.merchant_site_id;
- let client_request_id = item.attempt_id.clone();
+ let client_request_id = item.connector_request_reference_id.clone();
let time_stamp = date_time::DateTime::<date_time::YYYYMMDDHHmmss>::from(date_time::now());
let merchant_secret = connector_meta.merchant_secret;
Ok(Self {
@@ -737,7 +737,7 @@ impl<F>
amount: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
currency: item.request.currency,
connector_auth_type: item.connector_auth_type.clone(),
- client_request_id: item.attempt_id.clone(),
+ client_request_id: item.connector_request_reference_id.clone(),
session_token: data.1,
capture_method: item.request.capture_method,
..Default::default()
@@ -914,7 +914,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, String)> for NuveiPay
amount: utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
currency: item.request.currency,
connector_auth_type: item.connector_auth_type.clone(),
- client_request_id: item.attempt_id.clone(),
+ client_request_id: item.connector_request_reference_id.clone(),
session_token: data.1,
capture_method: item.request.capture_method,
..Default::default()
@@ -1018,7 +1018,7 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for NuveiPaymentFlowRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
Self::try_from(NuveiPaymentRequestData {
- client_request_id: item.attempt_id.clone(),
+ client_request_id: item.connector_request_reference_id.clone(),
connector_auth_type: item.connector_auth_type.clone(),
amount: utils::to_currency_base_unit(
item.request.amount_to_capture,
@@ -1034,7 +1034,7 @@ impl TryFrom<&types::RefundExecuteRouterData> for NuveiPaymentFlowRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundExecuteRouterData) -> Result<Self, Self::Error> {
Self::try_from(NuveiPaymentRequestData {
- client_request_id: item.attempt_id.clone(),
+ client_request_id: item.connector_request_reference_id.clone(),
connector_auth_type: item.connector_auth_type.clone(),
amount: utils::to_currency_base_unit(
item.request.refund_amount,
@@ -1061,7 +1061,7 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NuveiPaymentFlowRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
Self::try_from(NuveiPaymentRequestData {
- client_request_id: item.attempt_id.clone(),
+ client_request_id: item.connector_request_reference_id.clone(),
connector_auth_type: item.connector_auth_type.clone(),
amount: utils::to_currency_base_unit(
item.request.get_amount()?,
|
feat
|
[Nuvei] Use "connector_request_reference_id" for as "attempt_id" to improve consistency in transmitting payment information (#2493)
|
0324e7d635af0794357e4088c5c16b4ddb2aee0b
|
2023-01-11 22:17:19
|
Abhishek
|
fix(checkout): fix payment status mapping (#343)
| false
|
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 4a3727dc38d..104d1148129 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -140,20 +140,15 @@ pub enum CheckoutPaymentStatus {
Captured,
}
-impl From<transformers::Foreign<(CheckoutPaymentStatus, Option<enums::CaptureMethod>)>>
+impl From<transformers::Foreign<(CheckoutPaymentStatus, Balances)>>
for transformers::Foreign<enums::AttemptStatus>
{
- fn from(
- item: transformers::Foreign<(CheckoutPaymentStatus, Option<enums::CaptureMethod>)>,
- ) -> Self {
- let item = item.0;
- let status = item.0;
- let capture_method = item.1;
+ fn from(item: transformers::Foreign<(CheckoutPaymentStatus, Balances)>) -> Self {
+ let (status, balances) = item.0;
+
match status {
CheckoutPaymentStatus::Authorized => {
- if capture_method == Some(enums::CaptureMethod::Automatic)
- || capture_method.is_none()
- {
+ if balances.available_to_capture == 0 {
enums::AttemptStatus::Charged
} else {
enums::AttemptStatus::Authorized
@@ -184,7 +179,14 @@ pub struct PaymentsResponse {
status: CheckoutPaymentStatus,
#[serde(rename = "_links")]
links: Links,
+ balances: Balances,
+}
+
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]
+pub struct Balances {
+ available_to_capture: i32,
}
+
impl TryFrom<types::PaymentsResponseRouterData<PaymentsResponse>>
for types::PaymentsAuthorizeRouterData
{
@@ -213,7 +215,7 @@ impl TryFrom<types::PaymentsResponseRouterData<PaymentsResponse>>
Ok(Self {
status: enums::AttemptStatus::foreign_from((
item.response.status,
- item.data.request.capture_method,
+ item.response.balances,
)),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
@@ -254,7 +256,10 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponse>>
});
Ok(Self {
- status: enums::AttemptStatus::foreign_from((item.response.status, None)),
+ status: enums::AttemptStatus::foreign_from((
+ item.response.status,
+ item.response.balances,
+ )),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
redirect: redirection_data.is_some(),
|
fix
|
fix payment status mapping (#343)
|
be9347b8d56c0a6cf0d04cf51c75dd6426d3a21a
|
2024-07-30 18:52:38
|
Sakil Mostak
|
fix(connector): [Pix] convert data type of pix fields (#5476)
| false
|
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 6fb3b1a63e7..7effe2dcc64 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -6632,15 +6632,13 @@
"nullable": true
},
"cpf": {
- "type": "integer",
- "format": "int64",
+ "type": "string",
"description": "CPF is a Brazilian tax identification number",
"example": "10599054689",
"nullable": true
},
"cnpj": {
- "type": "integer",
- "format": "int64",
+ "type": "string",
"description": "CNPJ is a Brazilian company tax identification number",
"example": "74469027417312",
"nullable": true
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 9271317f790..a158d2de9bd 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2473,11 +2473,11 @@ pub enum BankTransferData {
#[schema(value_type = Option<String>, example = "a1f4102e-a446-4a57-bcce-6fa48899c1d1")]
pix_key: Option<Secret<String>>,
/// CPF is a Brazilian tax identification number
- #[schema(value_type = Option<i64>, example = "10599054689")]
- cpf: Option<Secret<i64>>,
+ #[schema(value_type = Option<String>, example = "10599054689")]
+ cpf: Option<Secret<String>>,
/// CNPJ is a Brazilian company tax identification number
- #[schema(value_type = Option<i64>, example = "74469027417312")]
- cnpj: Option<Secret<i64>>,
+ #[schema(value_type = Option<String>, example = "74469027417312")]
+ cnpj: Option<Secret<String>>,
},
Pse {},
LocalBankTransfer {
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 0085d8af6d1..a440ba944f1 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -450,9 +450,9 @@ pub enum BankTransferData {
/// Unique key for pix transfer
pix_key: Option<Secret<String>>,
/// CPF is a Brazilian tax identification number
- cpf: Option<Secret<i64>>,
+ cpf: Option<Secret<String>>,
/// CNPJ is a Brazilian company tax identification number
- cnpj: Option<Secret<i64>>,
+ cnpj: Option<Secret<String>>,
},
Pse {},
LocalBankTransfer {
diff --git a/crates/router/src/connector/itaubank/transformers.rs b/crates/router/src/connector/itaubank/transformers.rs
index de96bdb2f2b..5c53cfbf160 100644
--- a/crates/router/src/connector/itaubank/transformers.rs
+++ b/crates/router/src/connector/itaubank/transformers.rs
@@ -42,9 +42,9 @@ pub struct PixPaymentValue {
#[derive(Default, Debug, Serialize)]
pub struct ItaubankDebtor {
#[serde(skip_serializing_if = "Option::is_none")]
- cpf: Option<Secret<i64>>, // CPF is a Brazilian tax identification number
+ cpf: Option<Secret<String>>, // CPF is a Brazilian tax identification number
#[serde(skip_serializing_if = "Option::is_none")]
- cnpj: Option<Secret<i64>>, // CNPJ is a Brazilian company tax identification number
+ cnpj: Option<Secret<String>>, // CNPJ is a Brazilian company tax identification number
#[serde(skip_serializing_if = "Option::is_none")]
nome: Option<Secret<String>>, // name of the debtor
}
@@ -60,17 +60,17 @@ impl TryFrom<&ItaubankRouterData<&types::PaymentsAuthorizeRouterData>> for Itaub
domain::BankTransferData::Pix { pix_key, cpf, cnpj } => {
let nome = item.router_data.get_optional_billing_full_name();
// cpf and cnpj are mutually exclusive
- let devedor = match (cpf, cnpj) {
- (Some(cpf), _) => ItaubankDebtor {
- cpf: Some(cpf),
- cnpj: None,
- nome,
- },
- (None, Some(cnpj)) => ItaubankDebtor {
+ let devedor = match (cnpj, cpf) {
+ (Some(cnpj), _) => ItaubankDebtor {
cpf: None,
cnpj: Some(cnpj),
nome,
},
+ (None, Some(cpf)) => ItaubankDebtor {
+ cpf: Some(cpf),
+ cnpj: None,
+ nome,
+ },
_ => Err(errors::ConnectorError::MissingRequiredField {
field_name: "cpf and cnpj both missing in payment_method_data",
})?,
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js b/cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js
index 70b6b09eda0..ac8461211f5 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js
@@ -33,8 +33,8 @@ export const connectorDetails = {
bank_transfer: {
pix: {
pix_key: "a1f4102e-a446-4a57-bcce-6fa48899c1d1",
- cnpj: 74469027417312,
- cpf: 10599054689,
+ cnpj: "74469027417312",
+ cpf: "10599054689",
},
},
},
|
fix
|
[Pix] convert data type of pix fields (#5476)
|
3cbd5f98168d2dbec835e56078e61669e6ce34ff
|
2023-01-30 19:09:51
|
Abhishek
|
fix(router): allow console logs for all first-party crates (#477)
| false
|
diff --git a/crates/router/src/env.rs b/crates/router/src/env.rs
index 2648151700f..eadb5fbd6ff 100644
--- a/crates/router/src/env.rs
+++ b/crates/router/src/env.rs
@@ -12,6 +12,20 @@ pub mod logger {
pub fn setup(
conf: &config::Log,
) -> Result<TelemetryGuard, router_env::opentelemetry::metrics::MetricsError> {
- router_env::setup(conf, "router", vec!["router", "actix_server"])
+ router_env::setup(
+ conf,
+ "router",
+ vec![
+ "router",
+ "actix_server",
+ "api_models",
+ "common_utils",
+ "masking",
+ "redis_interface",
+ "router_derive",
+ "router_env",
+ "storage_models",
+ ],
+ )
}
}
|
fix
|
allow console logs for all first-party crates (#477)
|
a2958c33b5c4ed627c97e97e791ca2cfbfcecd5e
|
2024-04-10 14:43:20
|
Kashif
|
feat(payouts): add kafka events (#4264)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index ebb58b43053..8f7ea8a9928 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -569,7 +569,7 @@ connector_logs_topic = "topic" # Kafka topic to be used for connector api
outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webhook events
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
-payout_analytics_topic = "topic" # Kafka topic to be used for Payout events
+payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
# File storage configuration
[file_storage]
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index e0caafa7d72..c725a8bd69d 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -80,7 +80,7 @@ connector_logs_topic = "topic" # Kafka topic to be used for connector api
outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webhook events
dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events
audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events
-payout_analytics_topic = "topic" # Kafka topic to be used for Payout events
+payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events
# File storage configuration
[file_storage]
diff --git a/crates/analytics/docs/clickhouse/scripts/payouts.sql b/crates/analytics/docs/clickhouse/scripts/payouts.sql
index 0358c0e9375..68d109f7b9b 100644
--- a/crates/analytics/docs/clickhouse/scripts/payouts.sql
+++ b/crates/analytics/docs/clickhouse/scripts/payouts.sql
@@ -1,10 +1,12 @@
CREATE TABLE payout_queue (
`payout_id` String,
+ `payout_attempt_id` String,
`merchant_id` String,
`customer_id` String,
`address_id` String,
- `payout_type` LowCardinality(String),
+ `profile_id` String,
`payout_method_id` Nullable(String),
+ `payout_type` LowCardinality(String),
`amount` UInt64,
`destination_currency` LowCardinality(String),
`source_currency` LowCardinality(String),
@@ -17,8 +19,15 @@ CREATE TABLE payout_queue (
`created_at` DateTime CODEC(T64, LZ4),
`last_modified_at` DateTime CODEC(T64, LZ4),
`attempt_count` UInt16,
- `profile_id` String,
`status` LowCardinality(String),
+ `connector` Nullable(String),
+ `connector_payout_id` String,
+ `is_eligible` Nullable(Bool),
+ `error_message` Nullable(String),
+ `error_code` Nullable(String),
+ `business_country` Nullable(LowCardinality(String)),
+ `business_label` Nullable(String),
+ `merchant_connector_id` Nullable(String),
`sign_flag` Int8
) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
kafka_topic_list = 'hyperswitch-payout-events',
@@ -28,11 +37,13 @@ kafka_handle_error_mode = 'stream';
CREATE TABLE payout (
`payout_id` String,
+ `payout_attempt_id` String,
`merchant_id` String,
`customer_id` String,
`address_id` String,
+ `profile_id` String,
+ `payout_method_id` String,
`payout_type` LowCardinality(String),
- `payout_method_id` Nullable(String),
`amount` UInt64,
`destination_currency` LowCardinality(String),
`source_currency` LowCardinality(String),
@@ -45,26 +56,36 @@ CREATE TABLE payout (
`created_at` DateTime DEFAULT now() CODEC(T64, LZ4),
`last_modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),
`attempt_count` UInt16,
- `profile_id` String,
`status` LowCardinality(String),
+ `connector` Nullable(String),
+ `connector_payout_id` String,
+ `is_eligible` Nullable(Bool),
+ `error_message` Nullable(String),
+ `error_code` Nullable(String),
+ `business_country` Nullable(LowCardinality(String)),
+ `business_label` Nullable(String),
+ `merchant_connector_id` Nullable(String),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
`sign_flag` Int8,
INDEX payoutTypeIndex payout_type TYPE bloom_filter GRANULARITY 1,
INDEX destinationCurrencyIndex destination_currency TYPE bloom_filter GRANULARITY 1,
INDEX sourceCurrencyIndex source_currency TYPE bloom_filter GRANULARITY 1,
INDEX entityTypeIndex entity_type TYPE bloom_filter GRANULARITY 1,
- INDEX statusIndex status TYPE bloom_filter GRANULARITY 1
+ INDEX statusIndex status TYPE bloom_filter GRANULARITY 1,
+ INDEX businessCountryIndex business_country TYPE bloom_filter GRANULARITY 1
) ENGINE = CollapsingMergeTree(sign_flag) PARTITION BY toStartOfDay(created_at)
ORDER BY
(created_at, merchant_id, payout_id) TTL created_at + toIntervalMonth(6);
CREATE MATERIALIZED VIEW kafka_parse_payout TO payout (
`payout_id` String,
+ `payout_attempt_id` String,
`merchant_id` String,
`customer_id` String,
`address_id` String,
+ `profile_id` String,
+ `payout_method_id` String,
`payout_type` LowCardinality(String),
- `payout_method_id` Nullable(String),
`amount` UInt64,
`destination_currency` LowCardinality(String),
`source_currency` LowCardinality(String),
@@ -77,18 +98,27 @@ CREATE MATERIALIZED VIEW kafka_parse_payout TO payout (
`created_at` DateTime64(3),
`last_modified_at` DateTime64(3),
`attempt_count` UInt16,
- `profile_id` String,
`status` LowCardinality(String),
+ `connector` Nullable(String),
+ `connector_payout_id` String,
+ `is_eligible` Nullable(Bool),
+ `error_message` Nullable(String),
+ `error_code` Nullable(String),
+ `business_country` Nullable(LowCardinality(String)),
+ `business_label` Nullable(String),
+ `merchant_connector_id` Nullable(String),
`inserted_at` DateTime64(3),
`sign_flag` Int8
) AS
SELECT
payout_id,
+ payout_attempt_id,
merchant_id,
customer_id,
address_id,
- payout_type,
+ profile_id,
payout_method_id,
+ payout_type,
amount,
destination_currency,
source_currency,
@@ -101,8 +131,15 @@ SELECT
created_at,
last_modified_at,
attempt_count,
- profile_id,
status,
+ connector,
+ connector_payout_id,
+ is_eligible,
+ error_message,
+ error_code,
+ business_country,
+ business_label,
+ merchant_connector_id,
now() as inserted_at,
sign_flag
FROM
diff --git a/crates/data_models/src/payouts/payout_attempt.rs b/crates/data_models/src/payouts/payout_attempt.rs
index 5c4c98970f8..afe45b0a6a2 100644
--- a/crates/data_models/src/payouts/payout_attempt.rs
+++ b/crates/data_models/src/payouts/payout_attempt.rs
@@ -11,7 +11,8 @@ use crate::errors;
pub trait PayoutAttemptInterface {
async fn insert_payout_attempt(
&self,
- _payout: PayoutAttemptNew,
+ _payout_attempt: PayoutAttemptNew,
+ _payouts: &Payouts,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError>;
@@ -19,6 +20,7 @@ pub trait PayoutAttemptInterface {
&self,
_this: &PayoutAttempt,
_payout_attempt_update: PayoutAttemptUpdate,
+ _payouts: &Payouts,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError>;
diff --git a/crates/data_models/src/payouts/payouts.rs b/crates/data_models/src/payouts/payouts.rs
index 4d70b6aaf5e..28a8e4d4278 100644
--- a/crates/data_models/src/payouts/payouts.rs
+++ b/crates/data_models/src/payouts/payouts.rs
@@ -4,8 +4,9 @@ use serde::{Deserialize, Serialize};
use storage_enums::MerchantStorageScheme;
use time::PrimitiveDateTime;
+use super::payout_attempt::PayoutAttempt;
#[cfg(feature = "olap")]
-use super::{payout_attempt::PayoutAttempt, PayoutFetchConstraints};
+use super::PayoutFetchConstraints;
use crate::errors;
#[async_trait::async_trait]
@@ -27,6 +28,7 @@ pub trait PayoutsInterface {
&self,
_this: &Payouts,
_payout: PayoutsUpdate,
+ _payout_attempt: &PayoutAttempt,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Payouts, errors::StorageError>;
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 0f435a2e266..be4376d4f03 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -347,12 +347,17 @@ pub async fn payouts_update_core(
entity_type: req.entity_type.unwrap_or(payouts.entity_type),
metadata: req.metadata.clone().or(payouts.metadata.clone()),
status: Some(status),
- profile_id: Some(payout_attempt.profile_id),
+ profile_id: Some(payout_attempt.profile_id.clone()),
};
let db = &*state.store;
payout_data.payouts = db
- .update_payout(&payouts, updated_payouts, merchant_account.storage_scheme)
+ .update_payout(
+ &payouts,
+ updated_payouts,
+ &payout_attempt,
+ merchant_account.storage_scheme,
+ )
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error updating payouts")?;
@@ -385,6 +390,7 @@ pub async fn payouts_update_core(
.update_payout_attempt(
&payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -517,6 +523,7 @@ pub async fn payouts_cancel_core(
.update_payout_attempt(
&payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -527,6 +534,7 @@ pub async fn payouts_cancel_core(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -867,6 +875,7 @@ pub async fn call_connector_payout(
db.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ payouts,
merchant_account.storage_scheme,
)
.await
@@ -1128,6 +1137,7 @@ pub async fn check_payout_eligibility(
.update_payout_attempt(
payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1137,6 +1147,7 @@ pub async fn check_payout_eligibility(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1163,6 +1174,7 @@ pub async fn check_payout_eligibility(
.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1172,6 +1184,7 @@ pub async fn check_payout_eligibility(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1246,6 +1259,7 @@ pub async fn create_payout(
.update_payout_attempt(
payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1255,6 +1269,7 @@ pub async fn create_payout(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1281,6 +1296,7 @@ pub async fn create_payout(
.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1290,6 +1306,7 @@ pub async fn create_payout(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1357,6 +1374,7 @@ pub async fn cancel_payout(
.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1366,6 +1384,7 @@ pub async fn cancel_payout(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1385,6 +1404,7 @@ pub async fn cancel_payout(
.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1394,6 +1414,7 @@ pub async fn cancel_payout(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1479,6 +1500,7 @@ pub async fn fulfill_payout(
.update_payout_attempt(
payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1488,6 +1510,7 @@ pub async fn fulfill_payout(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1514,6 +1537,7 @@ pub async fn fulfill_payout(
.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
merchant_account.storage_scheme,
)
.await
@@ -1523,6 +1547,7 @@ pub async fn fulfill_payout(
.update_payout(
&payout_data.payouts,
storage::PayoutsUpdate::StatusUpdate { status },
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -1730,7 +1755,11 @@ pub async fn payout_create_db_entries(
..Default::default()
};
let payout_attempt = db
- .insert_payout_attempt(payout_attempt_req, merchant_account.storage_scheme)
+ .insert_payout_attempt(
+ payout_attempt_req,
+ &payouts,
+ merchant_account.storage_scheme,
+ )
.await
.to_duplicate_response(errors::ApiErrorResponse::DuplicatePayout {
payout_id: payout_id.to_owned(),
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 9b54bb03d17..7de5a95bd87 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -171,6 +171,7 @@ pub async fn make_payout_method_data<'a>(
db.update_payout_attempt(
&payout_data.payout_attempt,
updated_payout_attempt,
+ &payout_data.payouts,
storage_scheme,
)
.await
@@ -549,6 +550,7 @@ pub async fn save_payout_data_to_locker(
db.update_payout(
&payout_data.payouts,
updated_payout,
+ payout_attempt,
merchant_account.storage_scheme,
)
.await
diff --git a/crates/router/src/core/payouts/retry.rs b/crates/router/src/core/payouts/retry.rs
index fbb7ca0ba72..7c0b8265603 100644
--- a/crates/router/src/core/payouts/retry.rs
+++ b/crates/router/src/core/payouts/retry.rs
@@ -285,6 +285,7 @@ pub async fn modify_trackers(
.update_payout(
&payout_data.payouts,
updated_payouts,
+ &payout_data.payout_attempt,
merchant_account.storage_scheme,
)
.await
@@ -308,7 +309,11 @@ pub async fn modify_trackers(
..Default::default()
};
payout_data.payout_attempt = db
- .insert_payout_attempt(payout_attempt_req, merchant_account.storage_scheme)
+ .insert_payout_attempt(
+ payout_attempt_req,
+ &payouts,
+ merchant_account.storage_scheme,
+ )
.await
.to_duplicate_response(errors::ApiErrorResponse::DuplicatePayout { payout_id })
.attach_printable("Error inserting payouts in db")?;
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index e24dde449d3..f0effcbcac0 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -32,6 +32,8 @@ use super::{
user::{sample_data::BatchSampleDataInterface, UserInterface},
user_role::UserRoleInterface,
};
+#[cfg(feature = "payouts")]
+use crate::services::kafka::payout::KafkaPayout;
use crate::{
core::errors::{self, ProcessTrackerError},
db::{
@@ -1491,21 +1493,49 @@ impl PayoutAttemptInterface for KafkaStore {
&self,
this: &storage::PayoutAttempt,
payout_attempt_update: storage::PayoutAttemptUpdate,
+ payouts: &storage::Payouts,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PayoutAttempt, errors::DataStorageError> {
- self.diesel_store
- .update_payout_attempt(this, payout_attempt_update, storage_scheme)
+ let updated_payout_attempt = self
+ .diesel_store
+ .update_payout_attempt(this, payout_attempt_update, payouts, storage_scheme)
+ .await?;
+ if let Err(err) = self
+ .kafka_producer
+ .log_payout(
+ &KafkaPayout::from_storage(payouts, &updated_payout_attempt),
+ Some(KafkaPayout::from_storage(payouts, this)),
+ )
.await
+ {
+ logger::error!(message="Failed to update analytics entry for Payouts {payouts:?}\n{updated_payout_attempt:?}", error_message=?err);
+ };
+
+ Ok(updated_payout_attempt)
}
async fn insert_payout_attempt(
&self,
payout_attempt: storage::PayoutAttemptNew,
+ payouts: &storage::Payouts,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PayoutAttempt, errors::DataStorageError> {
- self.diesel_store
- .insert_payout_attempt(payout_attempt, storage_scheme)
+ let payout_attempt_new = self
+ .diesel_store
+ .insert_payout_attempt(payout_attempt, payouts, storage_scheme)
+ .await?;
+ if let Err(err) = self
+ .kafka_producer
+ .log_payout(
+ &KafkaPayout::from_storage(payouts, &payout_attempt_new),
+ None,
+ )
.await
+ {
+ logger::error!(message="Failed to add analytics entry for Payouts {payouts:?}\n{payout_attempt_new:?}", error_message=?err);
+ };
+
+ Ok(payout_attempt_new)
}
async fn get_filters_for_payouts(
@@ -1544,21 +1574,23 @@ impl PayoutsInterface for KafkaStore {
&self,
this: &storage::Payouts,
payout_update: storage::PayoutsUpdate,
+ payout_attempt: &storage::PayoutAttempt,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::Payouts, errors::DataStorageError> {
let payout = self
.diesel_store
- .update_payout(this, payout_update, storage_scheme)
+ .update_payout(this, payout_update, payout_attempt, storage_scheme)
.await?;
-
- if let Err(er) = self
+ if let Err(err) = self
.kafka_producer
- .log_payout(&payout, Some(this.clone()))
+ .log_payout(
+ &KafkaPayout::from_storage(&payout, payout_attempt),
+ Some(KafkaPayout::from_storage(this, payout_attempt)),
+ )
.await
{
- logger::error!(message="Failed to add analytics entry for Payout {payout:?}", error_message=?er);
+ logger::error!(message="Failed to update analytics entry for Payouts {payout:?}\n{payout_attempt:?}", error_message=?err);
};
-
Ok(payout)
}
@@ -1567,16 +1599,9 @@ impl PayoutsInterface for KafkaStore {
payout: storage::PayoutsNew,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::Payouts, errors::DataStorageError> {
- let payout = self
- .diesel_store
+ self.diesel_store
.insert_payout(payout, storage_scheme)
- .await?;
-
- if let Err(er) = self.kafka_producer.log_payout(&payout, None).await {
- logger::error!(message="Failed to add analytics entry for Payout {payout:?}", error_message=?er);
- };
-
- Ok(payout)
+ .await
}
async fn find_optional_payout_by_merchant_id_payout_id(
diff --git a/crates/router/src/events.rs b/crates/router/src/events.rs
index 2a0944b2f26..d02b42d4176 100644
--- a/crates/router/src/events.rs
+++ b/crates/router/src/events.rs
@@ -26,6 +26,7 @@ pub enum EventType {
OutgoingWebhookLogs,
Dispute,
AuditEvent,
+ #[cfg(feature = "payouts")]
Payout,
}
diff --git a/crates/router/src/services/kafka.rs b/crates/router/src/services/kafka.rs
index e4708f86681..166df034cc9 100644
--- a/crates/router/src/services/kafka.rs
+++ b/crates/router/src/services/kafka.rs
@@ -6,12 +6,12 @@ use rdkafka::{
config::FromClientConfig,
producer::{BaseRecord, DefaultProducerContext, Producer, ThreadedProducer},
};
-
+#[cfg(feature = "payouts")]
+pub mod payout;
use crate::events::EventType;
mod dispute;
mod payment_attempt;
mod payment_intent;
-mod payout;
mod refund;
use data_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent};
use diesel_models::refund::Refund;
@@ -25,8 +25,6 @@ use self::{
payment_intent::KafkaPaymentIntent, refund::KafkaRefund,
};
use crate::types::storage::Dispute;
-#[cfg(feature = "payouts")]
-use crate::types::storage::Payouts;
// Using message queue result here to avoid confusion with Kafka result provided by library
pub type MQResult<T> = CustomResult<T, KafkaError>;
@@ -97,6 +95,7 @@ pub struct KafkaSettings {
outgoing_webhook_logs_topic: String,
dispute_analytics_topic: String,
audit_events_topic: String,
+ #[cfg(feature = "payouts")]
payout_analytics_topic: String,
}
@@ -163,6 +162,7 @@ impl KafkaSettings {
))
})?;
+ #[cfg(feature = "payouts")]
common_utils::fp_utils::when(self.payout_analytics_topic.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"Kafka Payout Analytics topic must not be empty".into(),
@@ -184,6 +184,7 @@ pub struct KafkaProducer {
outgoing_webhook_logs_topic: String,
dispute_analytics_topic: String,
audit_events_topic: String,
+ #[cfg(feature = "payouts")]
payout_analytics_topic: String,
}
@@ -224,6 +225,7 @@ impl KafkaProducer {
outgoing_webhook_logs_topic: conf.outgoing_webhook_logs_topic.clone(),
dispute_analytics_topic: conf.dispute_analytics_topic.clone(),
audit_events_topic: conf.audit_events_topic.clone(),
+ #[cfg(feature = "payouts")]
payout_analytics_topic: conf.payout_analytics_topic.clone(),
})
}
@@ -239,6 +241,7 @@ impl KafkaProducer {
EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic,
EventType::Dispute => &self.dispute_analytics_topic,
EventType::AuditEvent => &self.audit_events_topic,
+ #[cfg(feature = "payouts")]
EventType::Payout => &self.payout_analytics_topic,
};
self.producer
@@ -357,27 +360,27 @@ impl KafkaProducer {
}
#[cfg(feature = "payouts")]
- pub async fn log_payout(&self, payout: &Payouts, old_payout: Option<Payouts>) -> MQResult<()> {
+ pub async fn log_payout(
+ &self,
+ payout: &KafkaPayout<'_>,
+ old_payout: Option<KafkaPayout<'_>>,
+ ) -> MQResult<()> {
if let Some(negative_event) = old_payout {
- self.log_event(&KafkaEvent::old(&KafkaPayout::from_storage(
- &negative_event,
- )))
- .attach_printable_lazy(|| {
- format!("Failed to add negative payout event {negative_event:?}")
- })?;
+ self.log_event(&KafkaEvent::old(&negative_event))
+ .attach_printable_lazy(|| {
+ format!("Failed to add negative payout event {negative_event:?}")
+ })?;
};
- self.log_event(&KafkaEvent::new(&KafkaPayout::from_storage(payout)))
+ self.log_event(&KafkaEvent::new(payout))
.attach_printable_lazy(|| format!("Failed to add positive payout event {payout:?}"))
}
#[cfg(feature = "payouts")]
- pub async fn log_payout_delete(&self, delete_old_payout: &Payouts) -> MQResult<()> {
- self.log_event(&KafkaEvent::old(&KafkaPayout::from_storage(
- delete_old_payout,
- )))
- .attach_printable_lazy(|| {
- format!("Failed to add negative payout event {delete_old_payout:?}")
- })
+ pub async fn log_payout_delete(&self, delete_old_payout: &KafkaPayout<'_>) -> MQResult<()> {
+ self.log_event(&KafkaEvent::old(delete_old_payout))
+ .attach_printable_lazy(|| {
+ format!("Failed to add negative payout event {delete_old_payout:?}")
+ })
}
pub fn get_topic(&self, event: EventType) -> &str {
@@ -390,6 +393,7 @@ impl KafkaProducer {
EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic,
EventType::Dispute => &self.dispute_analytics_topic,
EventType::AuditEvent => &self.audit_events_topic,
+ #[cfg(feature = "payouts")]
EventType::Payout => &self.payout_analytics_topic,
}
}
diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rs
index 7e181e3d1f6..e2bd8ef83fd 100644
--- a/crates/router/src/services/kafka/payout.rs
+++ b/crates/router/src/services/kafka/payout.rs
@@ -1,67 +1,83 @@
use common_utils::pii;
+use data_models::payouts::{payout_attempt::PayoutAttempt, payouts::Payouts};
use diesel_models::enums as storage_enums;
use time::OffsetDateTime;
-#[cfg(feature = "payouts")]
-use crate::types::storage::Payouts;
-
#[derive(serde::Serialize, Debug)]
pub struct KafkaPayout<'a> {
pub payout_id: &'a String,
+ pub payout_attempt_id: &'a String,
pub merchant_id: &'a String,
pub customer_id: &'a String,
pub address_id: &'a String,
- pub payout_type: &'a storage_enums::PayoutType,
+ pub profile_id: &'a String,
pub payout_method_id: Option<&'a String>,
+ pub payout_type: storage_enums::PayoutType,
pub amount: i64,
- pub destination_currency: &'a storage_enums::Currency,
- pub source_currency: &'a storage_enums::Currency,
+ pub destination_currency: storage_enums::Currency,
+ pub source_currency: storage_enums::Currency,
pub description: Option<&'a String>,
pub recurring: bool,
pub auto_fulfill: bool,
pub return_url: Option<&'a String>,
- pub entity_type: &'a storage_enums::PayoutEntityType,
- pub metadata: Option<&'a pii::SecretSerdeValue>,
- #[serde(default, with = "time::serde::timestamp")]
+ pub entity_type: storage_enums::PayoutEntityType,
+ pub metadata: Option<pii::SecretSerdeValue>,
+ #[serde(with = "time::serde::timestamp")]
pub created_at: OffsetDateTime,
- #[serde(default, with = "time::serde::timestamp")]
+ #[serde(with = "time::serde::timestamp")]
pub last_modified_at: OffsetDateTime,
pub attempt_count: i16,
- pub profile_id: &'a String,
- pub status: &'a storage_enums::PayoutStatus,
+ pub status: storage_enums::PayoutStatus,
+
+ pub connector: Option<&'a String>,
+ pub connector_payout_id: &'a String,
+ pub is_eligible: Option<bool>,
+ pub error_message: Option<&'a String>,
+ pub error_code: Option<&'a String>,
+ pub business_country: Option<storage_enums::CountryAlpha2>,
+ pub business_label: Option<&'a String>,
+ pub merchant_connector_id: Option<&'a String>,
}
-#[cfg(feature = "payouts")]
impl<'a> KafkaPayout<'a> {
- pub fn from_storage(payout: &'a Payouts) -> Self {
+ pub fn from_storage(payouts: &'a Payouts, payout_attempt: &'a PayoutAttempt) -> Self {
Self {
- payout_id: &payout.payout_id,
- merchant_id: &payout.merchant_id,
- customer_id: &payout.customer_id,
- address_id: &payout.address_id,
- payout_type: &payout.payout_type,
- payout_method_id: payout.payout_method_id.as_ref(),
- amount: payout.amount,
- destination_currency: &payout.destination_currency,
- source_currency: &payout.source_currency,
- description: payout.description.as_ref(),
- recurring: payout.recurring,
- auto_fulfill: payout.auto_fulfill,
- return_url: payout.return_url.as_ref(),
- entity_type: &payout.entity_type,
- metadata: payout.metadata.as_ref(),
- created_at: payout.created_at.assume_utc(),
- last_modified_at: payout.last_modified_at.assume_utc(),
- attempt_count: payout.attempt_count,
- profile_id: &payout.profile_id,
- status: &payout.status,
+ payout_id: &payouts.payout_id,
+ payout_attempt_id: &payout_attempt.payout_attempt_id,
+ merchant_id: &payouts.merchant_id,
+ customer_id: &payouts.customer_id,
+ address_id: &payouts.address_id,
+ profile_id: &payouts.profile_id,
+ payout_method_id: payouts.payout_method_id.as_ref(),
+ payout_type: payouts.payout_type,
+ amount: payouts.amount,
+ destination_currency: payouts.destination_currency,
+ source_currency: payouts.source_currency,
+ description: payouts.description.as_ref(),
+ recurring: payouts.recurring,
+ auto_fulfill: payouts.auto_fulfill,
+ return_url: payouts.return_url.as_ref(),
+ entity_type: payouts.entity_type,
+ metadata: payouts.metadata.clone(),
+ created_at: payouts.created_at.assume_utc(),
+ last_modified_at: payouts.last_modified_at.assume_utc(),
+ attempt_count: payouts.attempt_count,
+ status: payouts.status,
+ connector: payout_attempt.connector.as_ref(),
+ connector_payout_id: &payout_attempt.connector_payout_id,
+ is_eligible: payout_attempt.is_eligible,
+ error_message: payout_attempt.error_message.as_ref(),
+ error_code: payout_attempt.error_code.as_ref(),
+ business_country: payout_attempt.business_country,
+ business_label: payout_attempt.business_label.as_ref(),
+ merchant_connector_id: payout_attempt.merchant_connector_id.as_ref(),
}
}
}
impl<'a> super::KafkaMessage for KafkaPayout<'a> {
fn key(&self) -> String {
- format!("{}_{}", self.merchant_id, self.payout_id)
+ format!("{}_{}", self.merchant_id, self.payout_attempt_id)
}
fn creation_timestamp(&self) -> Option<i64> {
diff --git a/crates/storage_impl/src/mock_db/payout_attempt.rs b/crates/storage_impl/src/mock_db/payout_attempt.rs
index 1590dea6e72..6b792e033d1 100644
--- a/crates/storage_impl/src/mock_db/payout_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payout_attempt.rs
@@ -1,8 +1,11 @@
use common_utils::errors::CustomResult;
use data_models::{
errors::StorageError,
- payouts::payout_attempt::{
- PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate,
+ payouts::{
+ payout_attempt::{
+ PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate,
+ },
+ payouts::Payouts,
},
};
use diesel_models::enums as storage_enums;
@@ -15,6 +18,7 @@ impl PayoutAttemptInterface for MockDb {
&self,
_this: &PayoutAttempt,
_payout_attempt_update: PayoutAttemptUpdate,
+ _payouts: &Payouts,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
// TODO: Implement function for `MockDb`
@@ -23,7 +27,8 @@ impl PayoutAttemptInterface for MockDb {
async fn insert_payout_attempt(
&self,
- _payout: PayoutAttemptNew,
+ _payout_attempt: PayoutAttemptNew,
+ _payouts: &Payouts,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
// TODO: Implement function for `MockDb`
@@ -42,7 +47,7 @@ impl PayoutAttemptInterface for MockDb {
async fn get_filters_for_payouts(
&self,
- _payouts: &[data_models::payouts::payouts::Payouts],
+ _payouts: &[Payouts],
_merchant_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<data_models::payouts::payout_attempt::PayoutListFilters, StorageError> {
diff --git a/crates/storage_impl/src/mock_db/payouts.rs b/crates/storage_impl/src/mock_db/payouts.rs
index 323f3e11ac0..1aee200eed0 100644
--- a/crates/storage_impl/src/mock_db/payouts.rs
+++ b/crates/storage_impl/src/mock_db/payouts.rs
@@ -1,9 +1,10 @@
use common_utils::errors::CustomResult;
-#[cfg(all(feature = "olap", feature = "payouts"))]
-use data_models::payouts::payout_attempt::PayoutAttempt;
use data_models::{
errors::StorageError,
- payouts::payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate},
+ payouts::{
+ payout_attempt::PayoutAttempt,
+ payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate},
+ },
};
use diesel_models::enums as storage_enums;
@@ -25,6 +26,7 @@ impl PayoutsInterface for MockDb {
&self,
_this: &Payouts,
_payout_update: PayoutsUpdate,
+ _payout_attempt: &PayoutAttempt,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Payouts, StorageError> {
// TODO: Implement function for `MockDb`
diff --git a/crates/storage_impl/src/payouts/payout_attempt.rs b/crates/storage_impl/src/payouts/payout_attempt.rs
index 1f6c02c1fba..991a11d86ff 100644
--- a/crates/storage_impl/src/payouts/payout_attempt.rs
+++ b/crates/storage_impl/src/payouts/payout_attempt.rs
@@ -40,12 +40,13 @@ impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {
async fn insert_payout_attempt(
&self,
new_payout_attempt: PayoutAttemptNew,
+ payouts: &Payouts,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .insert_payout_attempt(new_payout_attempt, storage_scheme)
+ .insert_payout_attempt(new_payout_attempt, payouts, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => {
@@ -129,12 +130,13 @@ impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {
&self,
this: &PayoutAttempt,
payout_update: PayoutAttemptUpdate,
+ payouts: &Payouts,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .update_payout_attempt(this, payout_update, storage_scheme)
+ .update_payout_attempt(this, payout_update, payouts, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => {
@@ -254,6 +256,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
async fn insert_payout_attempt(
&self,
new: PayoutAttemptNew,
+ _payouts: &Payouts,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
@@ -272,6 +275,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
&self,
this: &PayoutAttempt,
payout: PayoutAttemptUpdate,
+ _payouts: &Payouts,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs
index fd4dbc8e3aa..437874729be 100644
--- a/crates/storage_impl/src/payouts/payouts.rs
+++ b/crates/storage_impl/src/payouts/payouts.rs
@@ -2,10 +2,13 @@
use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};
use common_utils::ext_traits::Encode;
#[cfg(feature = "olap")]
-use data_models::payouts::{payout_attempt::PayoutAttempt, PayoutFetchConstraints};
+use data_models::payouts::PayoutFetchConstraints;
use data_models::{
errors::StorageError,
- payouts::payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate},
+ payouts::{
+ payout_attempt::PayoutAttempt,
+ payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate},
+ },
};
#[cfg(feature = "olap")]
use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl};
@@ -115,12 +118,13 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
&self,
this: &Payouts,
payout_update: PayoutsUpdate,
+ payout_attempt: &PayoutAttempt,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Payouts, StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .update_payout(this, payout_update, storage_scheme)
+ .update_payout(this, payout_update, payout_attempt, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => {
@@ -316,6 +320,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
&self,
this: &Payouts,
payout: PayoutsUpdate,
+ _payout_attempt: &PayoutAttempt,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Payouts, StorageError> {
let conn = pg_connection_write(self).await?;
|
feat
|
add kafka events (#4264)
|
eb10aca6313b3b3cb1763ca20b54b11c31b93b26
|
2023-09-21 14:12:41
|
Abhishek Marrivagu
|
feat(db): enable caching for merchant_account fetch using publishable key (#2186)
| false
|
diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs
index d8bbd911de7..0699c7d8ac7 100644
--- a/crates/router/src/db/merchant_account.rs
+++ b/crates/router/src/db/merchant_account.rs
@@ -198,23 +198,44 @@ impl MerchantAccountInterface for Store {
&self,
publishable_key: &str,
) -> CustomResult<authentication::AuthenticationData, errors::StorageError> {
- let conn = connection::pg_connection_read(self).await?;
- let merchant = storage::MerchantAccount::find_by_publishable_key(&conn, publishable_key)
- .await
- .map_err(Into::into)
- .into_report()?;
+ let fetch_by_pub_key_func = || async {
+ let conn = connection::pg_connection_read(self).await?;
+
+ storage::MerchantAccount::find_by_publishable_key(&conn, publishable_key)
+ .await
+ .map_err(Into::into)
+ .into_report()
+ };
+
+ let merchant_account;
+ #[cfg(not(feature = "accounts_cache"))]
+ {
+ merchant_account = fetch_by_pub_key_func().await?;
+ }
+
+ #[cfg(feature = "accounts_cache")]
+ {
+ merchant_account = super::cache::get_or_populate_in_memory(
+ self,
+ publishable_key,
+ fetch_by_pub_key_func,
+ &ACCOUNTS_CACHE,
+ )
+ .await?;
+ }
let key_store = self
.get_merchant_key_store_by_merchant_id(
- &merchant.merchant_id,
+ &merchant_account.merchant_id,
&self.get_master_key().to_vec().into(),
)
.await?;
Ok(authentication::AuthenticationData {
- merchant_account: merchant
+ merchant_account: merchant_account
.convert(key_store.key.get_inner())
.await
.change_context(errors::StorageError::DecryptionError)?,
+
key_store,
})
}
|
feat
|
enable caching for merchant_account fetch using publishable key (#2186)
|
7b0bce555845c6d1187c97a921342fe129b6acba
|
2024-02-21 13:37:25
|
Prajjwal Kumar
|
refactor(core): inclusion of locker to store fingerprints (#3630)
| false
|
diff --git a/crates/api_models/src/blocklist.rs b/crates/api_models/src/blocklist.rs
index 9672b6de6ee..2afeb2db4f6 100644
--- a/crates/api_models/src/blocklist.rs
+++ b/crates/api_models/src/blocklist.rs
@@ -1,5 +1,6 @@
use common_enums::enums;
use common_utils::events::ApiEventMetric;
+use masking::StrongSecret;
use utoipa::ToSchema;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -10,6 +11,15 @@ pub enum BlocklistRequest {
ExtendedCardBin(String),
}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct GenerateFingerprintRequest {
+ pub card: Card,
+ pub hash_key: StrongSecret<String>,
+}
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
+pub struct Card {
+ pub card_number: StrongSecret<String>,
+}
pub type AddToBlocklistRequest = BlocklistRequest;
pub type DeleteFromBlocklistRequest = BlocklistRequest;
@@ -22,6 +32,11 @@ pub struct BlocklistResponse {
pub created_at: time::PrimitiveDateTime,
}
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "snake_case")]
+pub struct GenerateFingerprintResponsePayload {
+ pub card_fingerprint: String,
+}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ToggleBlocklistResponse {
pub blocklist_guard_status: String,
@@ -54,4 +69,7 @@ impl ApiEventMetric for BlocklistRequest {}
impl ApiEventMetric for BlocklistResponse {}
impl ApiEventMetric for ToggleBlocklistResponse {}
impl ApiEventMetric for ListBlocklistQuery {}
+impl ApiEventMetric for GenerateFingerprintRequest {}
impl ApiEventMetric for ToggleBlocklistQuery {}
+impl ApiEventMetric for GenerateFingerprintResponsePayload {}
+impl ApiEventMetric for Card {}
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index 084b0ef251e..3e187e25bc5 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -160,6 +160,7 @@ pub struct PaymentAttempt {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub mandate_data: Option<MandateDetails>,
+ pub fingerprint_id: Option<String>,
}
impl PaymentAttempt {
@@ -238,6 +239,7 @@ pub struct PaymentAttemptNew {
pub unified_code: Option<String>,
pub unified_message: Option<String>,
pub mandate_data: Option<MandateDetails>,
+ pub fingerprint_id: Option<String>,
}
impl PaymentAttemptNew {
@@ -270,6 +272,7 @@ pub enum PaymentAttemptUpdate {
capture_method: Option<storage_enums::CaptureMethod>,
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
+ fingerprint_id: Option<String>,
updated_by: String,
},
UpdateTrackers {
@@ -307,6 +310,7 @@ pub enum PaymentAttemptUpdate {
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
merchant_connector_id: Option<String>,
+ fingerprint_id: Option<String>,
},
RejectUpdate {
status: storage_enums::AttemptStatus,
diff --git a/crates/data_models/src/payments/payment_intent.rs b/crates/data_models/src/payments/payment_intent.rs
index 7470b5f8502..b2fafeb92a0 100644
--- a/crates/data_models/src/payments/payment_intent.rs
+++ b/crates/data_models/src/payments/payment_intent.rs
@@ -121,6 +121,7 @@ pub enum PaymentIntentUpdate {
amount_captured: Option<i64>,
return_url: Option<String>,
updated_by: String,
+ fingerprint_id: Option<String>,
incremental_authorization_allowed: Option<bool>,
},
MetadataUpdate {
@@ -335,6 +336,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
// currency,
status,
amount_captured,
+ fingerprint_id,
// customer_id,
return_url,
updated_by,
@@ -344,6 +346,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
// currency: Some(currency),
status: Some(status),
amount_captured,
+ fingerprint_id,
// customer_id,
return_url,
modified_at: Some(common_utils::date_time::now()),
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 9af4595c9f4..927a05bfa56 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -65,6 +65,7 @@ pub struct PaymentAttempt {
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
pub mandate_data: Option<storage_enums::MandateDetails>,
+ pub fingerprint_id: Option<String>,
}
impl PaymentAttempt {
@@ -140,6 +141,7 @@ pub struct PaymentAttemptNew {
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
pub mandate_data: Option<storage_enums::MandateDetails>,
+ pub fingerprint_id: Option<String>,
}
impl PaymentAttemptNew {
@@ -177,6 +179,7 @@ pub enum PaymentAttemptUpdate {
capture_method: Option<storage_enums::CaptureMethod>,
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
+ fingerprint_id: Option<String>,
updated_by: String,
},
UpdateTrackers {
@@ -212,6 +215,7 @@ pub enum PaymentAttemptUpdate {
amount_capturable: Option<i64>,
surcharge_amount: Option<i64>,
tax_amount: Option<i64>,
+ fingerprint_id: Option<String>,
updated_by: String,
merchant_connector_id: Option<String>,
},
@@ -351,6 +355,7 @@ pub struct PaymentAttemptUpdateInternal {
encoded_data: Option<String>,
unified_code: Option<Option<String>>,
unified_message: Option<Option<String>>,
+ fingerprint_id: Option<String>,
}
impl PaymentAttemptUpdateInternal {
@@ -411,6 +416,7 @@ impl PaymentAttemptUpdate {
encoded_data,
unified_code,
unified_message,
+ fingerprint_id,
} = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source);
PaymentAttempt {
amount: amount.unwrap_or(source.amount),
@@ -452,6 +458,7 @@ impl PaymentAttemptUpdate {
encoded_data: encoded_data.or(source.encoded_data),
unified_code: unified_code.unwrap_or(source.unified_code),
unified_message: unified_message.unwrap_or(source.unified_message),
+ fingerprint_id: fingerprint_id.or(source.fingerprint_id),
..source
}
}
@@ -476,6 +483,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
} => Self {
amount: Some(amount),
@@ -494,6 +502,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
..Default::default()
},
@@ -527,6 +536,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
merchant_connector_id,
surcharge_amount,
tax_amount,
+ fingerprint_id,
} => Self {
amount: Some(amount),
currency: Some(currency),
@@ -549,6 +559,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
merchant_connector_id: merchant_connector_id.map(Some),
surcharge_amount,
tax_amount,
+ fingerprint_id,
..Default::default()
},
PaymentAttemptUpdate::VoidUpdate {
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 31bc0c06c51..69fb61a8d42 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -116,6 +116,7 @@ pub enum PaymentIntentUpdate {
ResponseUpdate {
status: storage_enums::IntentStatus,
amount_captured: Option<i64>,
+ fingerprint_id: Option<String>,
return_url: Option<String>,
updated_by: String,
incremental_authorization_allowed: Option<bool>,
@@ -405,6 +406,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
// currency,
status,
amount_captured,
+ fingerprint_id,
// customer_id,
return_url,
updated_by,
@@ -414,6 +416,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
// currency: Some(currency),
status: Some(status),
amount_captured,
+ fingerprint_id,
// customer_id,
return_url,
modified_at: Some(common_utils::date_time::now()),
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 2cbcb52fb44..5093f0df7d0 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -689,6 +689,8 @@ diesel::table! {
unified_message -> Nullable<Varchar>,
net_amount -> Nullable<Int8>,
mandate_data -> Nullable<Jsonb>,
+ #[max_length = 64]
+ fingerprint_id -> Nullable<Varchar>,
}
}
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index 6a6d4c52c97..beac5b0733e 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -68,6 +68,7 @@ pub struct PaymentAttemptBatchNew {
pub unified_message: Option<String>,
pub net_amount: Option<i64>,
pub mandate_data: Option<MandateDetails>,
+ pub fingerprint_id: Option<String>,
}
#[allow(dead_code)]
@@ -122,6 +123,7 @@ impl PaymentAttemptBatchNew {
unified_message: self.unified_message,
net_amount: self.net_amount,
mandate_data: self.mandate_data,
+ fingerprint_id: self.fingerprint_id,
}
}
}
diff --git a/crates/router/src/core/blocklist/transformers.rs b/crates/router/src/core/blocklist/transformers.rs
index 2cb5f86a264..f4122a6a651 100644
--- a/crates/router/src/core/blocklist/transformers.rs
+++ b/crates/router/src/core/blocklist/transformers.rs
@@ -1,6 +1,28 @@
-use api_models::blocklist;
+use api_models::{blocklist, enums as api_enums};
+use common_utils::{
+ ext_traits::{Encode, StringExt},
+ request::RequestContent,
+};
+use error_stack::ResultExt;
+use josekit::jwe;
+#[cfg(feature = "aws_kms")]
+use masking::PeekInterface;
+use masking::StrongSecret;
+use router_env::{instrument, tracing};
-use crate::types::{storage, transformers::ForeignFrom};
+use crate::{
+ configs::settings,
+ core::{
+ errors::{self, CustomResult},
+ payment_methods::transformers as payment_methods,
+ },
+ headers, routes,
+ services::{api as services, encryption},
+ types::{storage, transformers::ForeignFrom},
+ utils::ConnectorResponseExt,
+};
+
+const LOCKER_FINGERPRINT_PATH: &str = "/cards/fingerprint";
impl ForeignFrom<storage::Blocklist> for blocklist::AddToBlocklistResponse {
fn foreign_from(from: storage::Blocklist) -> Self {
@@ -11,3 +33,192 @@ impl ForeignFrom<storage::Blocklist> for blocklist::AddToBlocklistResponse {
}
}
}
+
+async fn generate_fingerprint_request<'a>(
+ #[cfg(not(feature = "aws_kms"))] jwekey: &settings::Jwekey,
+ #[cfg(feature = "aws_kms")] jwekey: &settings::ActiveKmsSecrets,
+ locker: &settings::Locker,
+ payload: &blocklist::GenerateFingerprintRequest,
+ locker_choice: api_enums::LockerChoice,
+) -> CustomResult<services::Request, errors::VaultError> {
+ let payload = payload
+ .encode_to_vec()
+ .change_context(errors::VaultError::RequestEncodingFailed)?;
+
+ #[cfg(feature = "aws_kms")]
+ let private_key = jwekey.jwekey.peek().vault_private_key.as_bytes();
+
+ #[cfg(not(feature = "aws_kms"))]
+ let private_key = jwekey.vault_private_key.as_bytes();
+
+ let jws = encryption::jws_sign_payload(&payload, &locker.locker_signing_key_id, private_key)
+ .await
+ .change_context(errors::VaultError::RequestEncodingFailed)?;
+
+ let jwe_payload = generate_jwe_payload_for_request(jwekey, &jws, locker_choice).await?;
+ let mut url = match locker_choice {
+ api_enums::LockerChoice::HyperswitchCardVault => locker.host.to_owned(),
+ };
+ url.push_str(LOCKER_FINGERPRINT_PATH);
+ let mut request = services::Request::new(services::Method::Post, &url);
+ request.add_header(headers::CONTENT_TYPE, "application/json".into());
+ request.set_body(RequestContent::Json(Box::new(jwe_payload)));
+ Ok(request)
+}
+
+async fn generate_jwe_payload_for_request(
+ #[cfg(feature = "aws_kms")] jwekey: &settings::ActiveKmsSecrets,
+ #[cfg(not(feature = "aws_kms"))] jwekey: &settings::Jwekey,
+ jws: &str,
+ locker_choice: api_enums::LockerChoice,
+) -> CustomResult<encryption::JweBody, errors::VaultError> {
+ let jws_payload: Vec<&str> = jws.split('.').collect();
+
+ let generate_jws_body = |payload: Vec<&str>| -> Option<encryption::JwsBody> {
+ Some(encryption::JwsBody {
+ header: payload.first()?.to_string(),
+ payload: payload.get(1)?.to_string(),
+ signature: payload.get(2)?.to_string(),
+ })
+ };
+
+ let jws_body =
+ generate_jws_body(jws_payload).ok_or(errors::VaultError::GenerateFingerprintFailed)?;
+
+ let payload = jws_body
+ .encode_to_vec()
+ .change_context(errors::VaultError::GenerateFingerprintFailed)?;
+
+ #[cfg(feature = "aws_kms")]
+ let public_key = match locker_choice {
+ api_enums::LockerChoice::HyperswitchCardVault => {
+ jwekey.jwekey.peek().vault_encryption_key.as_bytes()
+ }
+ };
+
+ #[cfg(not(feature = "aws_kms"))]
+ let public_key = match locker_choice {
+ api_enums::LockerChoice::HyperswitchCardVault => jwekey.vault_encryption_key.as_bytes(),
+ };
+
+ let jwe_encrypted = encryption::encrypt_jwe(&payload, public_key)
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Error on jwe encrypt")?;
+ let jwe_payload: Vec<&str> = jwe_encrypted.split('.').collect();
+
+ let generate_jwe_body = |payload: Vec<&str>| -> Option<encryption::JweBody> {
+ Some(encryption::JweBody {
+ header: payload.first()?.to_string(),
+ iv: payload.get(2)?.to_string(),
+ encrypted_payload: payload.get(3)?.to_string(),
+ tag: payload.get(4)?.to_string(),
+ encrypted_key: payload.get(1)?.to_string(),
+ })
+ };
+
+ let jwe_body =
+ generate_jwe_body(jwe_payload).ok_or(errors::VaultError::GenerateFingerprintFailed)?;
+
+ Ok(jwe_body)
+}
+
+#[instrument(skip_all)]
+pub async fn generate_fingerprint(
+ state: &routes::AppState,
+ card_number: StrongSecret<String>,
+ hash_key: StrongSecret<String>,
+ locker_choice: api_enums::LockerChoice,
+) -> CustomResult<blocklist::GenerateFingerprintResponsePayload, errors::VaultError> {
+ let payload = blocklist::GenerateFingerprintRequest {
+ card: blocklist::Card { card_number },
+ hash_key,
+ };
+
+ let generate_fingerprint_resp =
+ call_to_locker_for_fingerprint(state, &payload, locker_choice).await?;
+
+ Ok(generate_fingerprint_resp)
+}
+
+#[instrument(skip_all)]
+async fn call_to_locker_for_fingerprint(
+ state: &routes::AppState,
+ payload: &blocklist::GenerateFingerprintRequest,
+ locker_choice: api_enums::LockerChoice,
+) -> CustomResult<blocklist::GenerateFingerprintResponsePayload, errors::VaultError> {
+ let locker = &state.conf.locker;
+ #[cfg(not(feature = "aws_kms"))]
+ let jwekey = &state.conf.jwekey;
+ #[cfg(feature = "aws_kms")]
+ let jwekey = &state.kms_secrets;
+
+ let request = generate_fingerprint_request(jwekey, locker, payload, locker_choice).await?;
+ let response = services::call_connector_api(state, request)
+ .await
+ .change_context(errors::VaultError::GenerateFingerprintFailed);
+ let jwe_body: encryption::JweBody = response
+ .get_response_inner("JweBody")
+ .change_context(errors::VaultError::GenerateFingerprintFailed)?;
+
+ let decrypted_payload =
+ decrypt_generate_fingerprint_response_payload(jwekey, jwe_body, Some(locker_choice))
+ .await
+ .change_context(errors::VaultError::GenerateFingerprintFailed)
+ .attach_printable("Error getting decrypted fingerprint response payload")?;
+ let generate_fingerprint_response: blocklist::GenerateFingerprintResponsePayload =
+ decrypted_payload
+ .parse_struct("GenerateFingerprintResponse")
+ .change_context(errors::VaultError::ResponseDeserializationFailed)?;
+
+ Ok(generate_fingerprint_response)
+}
+
+async fn decrypt_generate_fingerprint_response_payload(
+ #[cfg(not(feature = "aws_kms"))] jwekey: &settings::Jwekey,
+ #[cfg(feature = "aws_kms")] jwekey: &settings::ActiveKmsSecrets,
+ jwe_body: encryption::JweBody,
+ locker_choice: Option<api_enums::LockerChoice>,
+) -> CustomResult<String, errors::VaultError> {
+ let target_locker = locker_choice.unwrap_or(api_enums::LockerChoice::HyperswitchCardVault);
+
+ #[cfg(feature = "aws_kms")]
+ let public_key = match target_locker {
+ api_enums::LockerChoice::HyperswitchCardVault => {
+ jwekey.jwekey.peek().vault_encryption_key.as_bytes()
+ }
+ };
+
+ #[cfg(feature = "aws_kms")]
+ let private_key = jwekey.jwekey.peek().vault_private_key.as_bytes();
+
+ #[cfg(not(feature = "aws_kms"))]
+ let public_key = match target_locker {
+ api_enums::LockerChoice::HyperswitchCardVault => jwekey.vault_encryption_key.as_bytes(),
+ };
+
+ #[cfg(not(feature = "aws_kms"))]
+ let private_key = jwekey.vault_private_key.as_bytes();
+
+ let jwt = payment_methods::get_dotted_jwe(jwe_body);
+ let alg = jwe::RSA_OAEP;
+
+ let jwe_decrypted = encryption::decrypt_jwe(
+ &jwt,
+ encryption::KeyIdCheck::SkipKeyIdCheck,
+ private_key,
+ alg,
+ )
+ .await
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Jwe Decryption failed for JweBody for vault")?;
+
+ let jws = jwe_decrypted
+ .parse_struct("JwsBody")
+ .change_context(errors::VaultError::ResponseDeserializationFailed)?;
+ let jws_body = payment_methods::get_dotted_jws(jws);
+
+ encryption::verify_sign(jws_body, public_key)
+ .change_context(errors::VaultError::SaveCardFailed)
+ .attach_printable("Jws Decryption failed for JwsBody for vault")
+}
diff --git a/crates/router/src/core/blocklist/utils.rs b/crates/router/src/core/blocklist/utils.rs
index 733b565beed..68cdb2690b7 100644
--- a/crates/router/src/core/blocklist/utils.rs
+++ b/crates/router/src/core/blocklist/utils.rs
@@ -1,15 +1,11 @@
use api_models::blocklist as api_blocklist;
use common_enums::MerchantDecision;
-use common_utils::{
- crypto::{self, SignMessage},
- errors::CustomResult,
-};
+use common_utils::errors::CustomResult;
use diesel_models::configs;
use error_stack::{IntoReport, ResultExt};
-#[cfg(feature = "aws_kms")]
-use external_services::aws_kms;
+use masking::StrongSecret;
-use super::{errors, AppState};
+use super::{errors, transformers::generate_fingerprint, AppState};
use crate::{
consts,
core::{
@@ -35,52 +31,13 @@ pub async fn delete_entry_from_blocklist(
delete_card_bin_blocklist_entry(state, &xbin, &merchant_id).await?
}
- api_blocklist::DeleteFromBlocklistRequest::Fingerprint(fingerprint_id) => {
- let blocklist_fingerprint = state
- .store
- .find_blocklist_fingerprint_by_merchant_id_fingerprint_id(
- &merchant_id,
- &fingerprint_id,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
- message: "blocklist record with given fingerprint id not found".to_string(),
- })?;
-
- #[cfg(feature = "aws_kms")]
- let decrypted_fingerprint = aws_kms::core::get_aws_kms_client(&state.conf.kms)
- .await
- .decrypt(blocklist_fingerprint.encrypted_fingerprint)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("failed to kms decrypt fingerprint")?;
-
- #[cfg(not(feature = "aws_kms"))]
- let decrypted_fingerprint = blocklist_fingerprint.encrypted_fingerprint;
-
- let blocklist_entry = state
- .store
- .delete_blocklist_entry_by_merchant_id_fingerprint_id(&merchant_id, &fingerprint_id)
- .await
- .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
- message: "no blocklist record for the given fingerprint id was found"
- .to_string(),
- })?;
-
- state
- .store
- .delete_blocklist_lookup_entry_by_merchant_id_fingerprint(
- &merchant_id,
- &decrypted_fingerprint,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
- message: "no blocklist record for the given fingerprint id was found"
- .to_string(),
- })?;
-
- blocklist_entry
- }
+ api_blocklist::DeleteFromBlocklistRequest::Fingerprint(fingerprint_id) => state
+ .store
+ .delete_blocklist_entry_by_merchant_id_fingerprint_id(&merchant_id, &fingerprint_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
+ message: "no blocklist record for the given fingerprint id was found".to_string(),
+ })?,
};
Ok(blocklist_entry.foreign_into())
@@ -232,57 +189,20 @@ pub async fn insert_entry_into_blocklist(
}
}
- let blocklist_fingerprint = state
- .store
- .find_blocklist_fingerprint_by_merchant_id_fingerprint_id(
- &merchant_id,
- fingerprint_id,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
- message: "fingerprint not found".to_string(),
- })?;
-
- #[cfg(feature = "aws_kms")]
- let decrypted_fingerprint = aws_kms::core::get_aws_kms_client(&state.conf.kms)
- .await
- .decrypt(blocklist_fingerprint.encrypted_fingerprint)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("failed to kms decrypt encrypted fingerprint")?;
-
- #[cfg(not(feature = "aws_kms"))]
- let decrypted_fingerprint = blocklist_fingerprint.encrypted_fingerprint;
-
- state
- .store
- .insert_blocklist_lookup_entry(
- diesel_models::blocklist_lookup::BlocklistLookupNew {
- merchant_id: merchant_id.clone(),
- fingerprint: decrypted_fingerprint,
- },
- )
- .await
- .to_duplicate_response(errors::ApiErrorResponse::PreconditionFailed {
- message: "the payment instrument associated with the given fingerprint is already in the blocklist".to_string(),
- })
- .attach_printable("failed to add fingerprint to blocklist lookup")?;
-
state
.store
.insert_blocklist_entry(storage::BlocklistNew {
merchant_id: merchant_id.clone(),
fingerprint_id: fingerprint_id.clone(),
- data_kind: blocklist_fingerprint.data_kind,
+ data_kind: api_models::enums::enums::BlocklistDataKind::PaymentMethod,
metadata: None,
created_at: common_utils::date_time::now(),
})
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("failed to add fingerprint to pm blocklist")?
+ .attach_printable("failed to add fingerprint to blocklist")?
}
};
-
Ok(blocklist_entry.foreign_into())
}
@@ -330,17 +250,6 @@ async fn duplicate_check_insert_bin(
merchant_id: &str,
data_kind: common_enums::BlocklistDataKind,
) -> RouterResult<storage::Blocklist> {
- let merchant_secret = get_merchant_fingerprint_secret(state, merchant_id).await?;
- let bin_fingerprint = crypto::HmacSha512::sign_message(
- &crypto::HmacSha512,
- merchant_secret.clone().as_bytes(),
- bin.as_bytes(),
- )
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error in bin hash creation")?;
-
- let encoded_fingerprint = hex::encode(bin_fingerprint.clone());
-
let blocklist_entry_result = state
.store
.find_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, bin)
@@ -363,17 +272,6 @@ async fn duplicate_check_insert_bin(
}
}
- // Checking for duplicacy
- state
- .store
- .insert_blocklist_lookup_entry(diesel_models::blocklist_lookup::BlocklistLookupNew {
- merchant_id: merchant_id.to_string(),
- fingerprint: encoded_fingerprint.clone(),
- })
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error inserting blocklist lookup entry")?;
-
state
.store
.insert_blocklist_entry(storage::BlocklistNew {
@@ -393,21 +291,6 @@ async fn delete_card_bin_blocklist_entry(
bin: &str,
merchant_id: &str,
) -> RouterResult<storage::Blocklist> {
- let merchant_secret = get_merchant_fingerprint_secret(state, merchant_id).await?;
- let bin_fingerprint = crypto::HmacSha512
- .sign_message(merchant_secret.as_bytes(), bin.as_bytes())
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("error when hashing card bin")?;
- let encoded_fingerprint = hex::encode(bin_fingerprint);
-
- state
- .store
- .delete_blocklist_lookup_entry_by_merchant_id_fingerprint(merchant_id, &encoded_fingerprint)
- .await
- .to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {
- message: "could not find a blocklist entry for the given bin".to_string(),
- })?;
-
state
.store
.delete_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, bin)
@@ -431,28 +314,28 @@ where
get_merchant_fingerprint_secret(state, merchant_id.as_str()).await?;
// Hashed Fingerprint to check whether or not this payment should be blocked.
- let card_number_fingerprint = payment_data
- .payment_method_data
- .as_ref()
- .and_then(|pm_data| match pm_data {
- api_models::payments::PaymentMethodData::Card(card) => {
- crypto::HmacSha512::sign_message(
- &crypto::HmacSha512,
- merchant_fingerprint_secret.as_bytes(),
- card.card_number.clone().get_card_no().as_bytes(),
- )
- .attach_printable("error in pm fingerprint creation")
- .map_or_else(
- |err| {
- logger::error!(error=?err);
- None
- },
- Some,
- )
- }
- _ => None,
- })
- .map(hex::encode);
+ let card_number_fingerprint = if let Some(api_models::payments::PaymentMethodData::Card(card)) =
+ payment_data.payment_method_data.as_ref()
+ {
+ generate_fingerprint(
+ state,
+ StrongSecret::new(card.card_number.clone().get_card_no()),
+ StrongSecret::new(merchant_fingerprint_secret.clone()),
+ api_models::enums::LockerChoice::HyperswitchCardVault,
+ )
+ .await
+ .attach_printable("error in pm fingerprint creation")
+ .map_or_else(
+ |err| {
+ logger::error!(error=?err);
+ None
+ },
+ Some,
+ )
+ .map(|payload| payload.card_fingerprint)
+ } else {
+ None
+ };
// Hashed Cardbin to check whether or not this payment should be blocked.
let card_bin_fingerprint = payment_data
@@ -460,66 +343,43 @@ where
.as_ref()
.and_then(|pm_data| match pm_data {
api_models::payments::PaymentMethodData::Card(card) => {
- crypto::HmacSha512::sign_message(
- &crypto::HmacSha512,
- merchant_fingerprint_secret.as_bytes(),
- card.card_number.clone().get_card_isin().as_bytes(),
- )
- .attach_printable("error in card bin hash creation")
- .map_or_else(
- |err| {
- logger::error!(error=?err);
- None
- },
- Some,
- )
+ Some(card.card_number.clone().get_card_isin())
}
_ => None,
- })
- .map(hex::encode);
+ });
// Hashed Extended Cardbin to check whether or not this payment should be blocked.
- let extended_card_bin_fingerprint = payment_data
- .payment_method_data
- .as_ref()
- .and_then(|pm_data| match pm_data {
- api_models::payments::PaymentMethodData::Card(card) => {
- crypto::HmacSha512::sign_message(
- &crypto::HmacSha512,
- merchant_fingerprint_secret.as_bytes(),
- card.card_number.clone().get_extended_card_bin().as_bytes(),
- )
- .attach_printable("error in extended card bin hash creation")
- .map_or_else(
- |err| {
- logger::error!(error=?err);
- None
- },
- Some,
- )
- }
- _ => None,
- })
- .map(hex::encode);
+ let extended_card_bin_fingerprint =
+ payment_data
+ .payment_method_data
+ .as_ref()
+ .and_then(|pm_data| match pm_data {
+ api_models::payments::PaymentMethodData::Card(card) => {
+ Some(card.card_number.clone().get_extended_card_bin())
+ }
+ _ => None,
+ });
//validating the payment method.
let mut blocklist_futures = Vec::new();
if let Some(card_number_fingerprint) = card_number_fingerprint.as_ref() {
- blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
+ blocklist_futures.push(db.find_blocklist_entry_by_merchant_id_fingerprint_id(
merchant_id,
card_number_fingerprint,
));
}
if let Some(card_bin_fingerprint) = card_bin_fingerprint.as_ref() {
- blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
- merchant_id,
- card_bin_fingerprint,
- ));
+ blocklist_futures.push(
+ db.find_blocklist_entry_by_merchant_id_fingerprint_id(
+ merchant_id,
+ card_bin_fingerprint,
+ ),
+ );
}
if let Some(extended_card_bin_fingerprint) = extended_card_bin_fingerprint.as_ref() {
- blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
+ blocklist_futures.push(db.find_blocklist_entry_by_merchant_id_fingerprint_id(
merchant_id,
extended_card_bin_fingerprint,
));
@@ -538,7 +398,6 @@ where
}
}
}
-
if should_payment_be_blocked {
// Update db for attempt and intent status.
db.update_payment_intent(
@@ -582,13 +441,12 @@ where
}
.into())
} else {
- payment_data.payment_intent.fingerprint_id = generate_payment_fingerprint(
+ payment_data.payment_attempt.fingerprint_id = generate_payment_fingerprint(
state,
payment_data.payment_attempt.merchant_id.clone(),
payment_data.payment_method_data.clone(),
)
.await?;
-
Ok(false)
}
}
@@ -598,68 +456,31 @@ pub async fn generate_payment_fingerprint(
merchant_id: String,
payment_method_data: Option<crate::types::api::PaymentMethodData>,
) -> CustomResult<Option<String>, errors::ApiErrorResponse> {
- let db = &state.store;
let merchant_fingerprint_secret = get_merchant_fingerprint_secret(state, &merchant_id).await?;
- let card_number_fingerprint = payment_method_data
- .as_ref()
- .and_then(|pm_data| match pm_data {
- api_models::payments::PaymentMethodData::Card(card) => {
- crypto::HmacSha512::sign_message(
- &crypto::HmacSha512,
- merchant_fingerprint_secret.as_bytes(),
- card.card_number.clone().get_card_no().as_bytes(),
- )
- .attach_printable("error in pm fingerprint creation")
- .map_or_else(
- |err| {
- logger::error!(error=?err);
- None
- },
- Some,
- )
- }
- _ => None,
- })
- .map(hex::encode);
- let mut fingerprint_id = None;
- if let Some(encoded_hash) = card_number_fingerprint {
- #[cfg(feature = "kms")]
- let encrypted_fingerprint = kms::get_kms_client(&state.conf.kms)
- .await
- .encrypt(encoded_hash)
+ Ok(
+ if let Some(api_models::payments::PaymentMethodData::Card(card)) =
+ payment_method_data.as_ref()
+ {
+ generate_fingerprint(
+ state,
+ StrongSecret::new(card.card_number.clone().get_card_no()),
+ StrongSecret::new(merchant_fingerprint_secret),
+ api_models::enums::LockerChoice::HyperswitchCardVault,
+ )
.await
+ .attach_printable("error in pm fingerprint creation")
.map_or_else(
- |e| {
- logger::error!(error=?e, "failed kms encryption of card fingerprint");
+ |err| {
+ logger::error!(error=?err);
None
},
Some,
- );
-
- #[cfg(not(feature = "kms"))]
- let encrypted_fingerprint = Some(encoded_hash);
-
- if let Some(encrypted_fingerprint) = encrypted_fingerprint {
- fingerprint_id = db
- .insert_blocklist_fingerprint_entry(
- diesel_models::blocklist_fingerprint::BlocklistFingerprintNew {
- merchant_id,
- fingerprint_id: utils::generate_id(consts::ID_LENGTH, "fingerprint"),
- encrypted_fingerprint,
- data_kind: common_enums::BlocklistDataKind::PaymentMethod,
- created_at: common_utils::date_time::now(),
- },
- )
- .await
- .map_or_else(
- |e| {
- logger::error!(error=?e, "failed storing card fingerprint in db");
- None
- },
- |fp| Some(fp.fingerprint_id),
- );
- }
- }
- Ok(fingerprint_id)
+ )
+ .map(|payload| payload.card_fingerprint)
+ } else {
+ logger::error!("failed to retrieve card fingerprint");
+ None
+ },
+ )
}
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index d1814f7ee82..cec563b9631 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -236,6 +236,8 @@ pub enum VaultError {
FetchPaymentMethodFailed,
#[error("Failed to save payment method in vault")]
SavePaymentMethodFailed,
+ #[error("Failed to generate fingerprint")]
+ GenerateFingerprintFailed,
}
#[derive(Debug, thiserror::Error)]
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 635ba917168..764752ba903 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3202,6 +3202,7 @@ impl AttemptType {
unified_message: None,
net_amount: old_payment_attempt.amount,
mandate_data: old_payment_attempt.mandate_data,
+ fingerprint_id: None,
}
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 734839c9b6d..2d2ee0e8728 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -739,6 +739,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
let m_straight_through_algorithm = straight_through_algorithm.clone();
let m_error_code = error_code.clone();
let m_error_message = error_message.clone();
+ let m_fingerprint_id = payment_data.payment_attempt.fingerprint_id.clone();
let m_db = state.clone().store;
let surcharge_amount = payment_data
.surcharge_details
@@ -774,6 +775,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
merchant_connector_id,
surcharge_amount,
tax_amount,
+ fingerprint_id: m_fingerprint_id,
},
storage_scheme,
)
@@ -784,7 +786,6 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
);
let m_payment_data_payment_intent = payment_data.payment_intent.clone();
- let m_fingerprint_id = payment_data.payment_intent.fingerprint_id.clone();
let m_customer_id = customer_id.clone();
let m_shipping_address_id = shipping_address.clone();
let m_billing_address_id = billing_address.clone();
@@ -821,7 +822,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
metadata: m_metadata,
payment_confirm_source: header_payload.payment_confirm_source,
updated_by: m_storage_scheme,
- fingerprint_id: m_fingerprint_id,
+ fingerprint_id: None,
session_expiry,
},
storage_scheme,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 6bd6ca91100..099eae71800 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -604,6 +604,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
};
if router_data.status == enums::AttemptStatus::Charged {
+ payment_data.payment_intent.fingerprint_id =
+ payment_data.payment_attempt.fingerprint_id.clone();
metrics::SUCCESSFUL_PAYMENT.add(&metrics::CONTEXT, 1, &[]);
}
@@ -798,6 +800,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
return_url: router_data.return_url.clone(),
amount_captured,
updated_by: storage_scheme.to_string(),
+ fingerprint_id: payment_data.payment_attempt.fingerprint_id.clone(),
incremental_authorization_allowed: payment_data
.payment_intent
.incremental_authorization_allowed,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 0ec11e39f62..071d919eb19 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -559,6 +559,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id: None,
updated_by: storage_scheme.to_string(),
},
storage_scheme,
diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs
index f4d74c4f81b..a2cf65ce66b 100644
--- a/crates/router/src/services/api/client.rs
+++ b/crates/router/src/services/api/client.rs
@@ -114,6 +114,7 @@ pub fn proxy_bypass_urls(locker: &Locker) -> Vec<String> {
let locker_host_rs = locker.host_rs.to_owned();
vec![
format!("{locker_host}/cards/add"),
+ format!("{locker_host}/cards/fingerprint"),
format!("{locker_host}/cards/retrieve"),
format!("{locker_host}/cards/delete"),
format!("{locker_host_rs}/cards/add"),
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index e60e32227d3..5add5036f08 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -148,6 +148,7 @@ impl PaymentAttemptInterface for MockDb {
unified_code: payment_attempt.unified_code,
unified_message: payment_attempt.unified_message,
mandate_data: payment_attempt.mandate_data,
+ fingerprint_id: payment_attempt.fingerprint_id,
};
payment_attempts.push(payment_attempt.clone());
Ok(payment_attempt)
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index ec19e30c0ec..a51f95e1e74 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -391,6 +391,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
unified_code: payment_attempt.unified_code.clone(),
unified_message: payment_attempt.unified_message.clone(),
mandate_data: payment_attempt.mandate_data.clone(),
+ fingerprint_id: payment_attempt.fingerprint_id.clone(),
};
let field = format!("pa_{}", created_attempt.attempt_id);
@@ -1105,6 +1106,7 @@ impl DataModelExt for PaymentAttempt {
unified_code: self.unified_code,
unified_message: self.unified_message,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
+ fingerprint_id: self.fingerprint_id,
}
}
@@ -1163,6 +1165,7 @@ impl DataModelExt for PaymentAttempt {
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
+ fingerprint_id: storage_model.fingerprint_id,
}
}
}
@@ -1219,6 +1222,7 @@ impl DataModelExt for PaymentAttemptNew {
unified_code: self.unified_code,
unified_message: self.unified_message,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
+ fingerprint_id: self.fingerprint_id,
}
}
@@ -1275,6 +1279,7 @@ impl DataModelExt for PaymentAttemptNew {
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
+ fingerprint_id: storage_model.fingerprint_id,
}
}
}
@@ -1299,6 +1304,7 @@ impl DataModelExt for PaymentAttemptUpdate {
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
} => DieselPaymentAttemptUpdate::Update {
amount,
@@ -1315,6 +1321,7 @@ impl DataModelExt for PaymentAttemptUpdate {
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
},
Self::UpdateTrackers {
@@ -1373,6 +1380,7 @@ impl DataModelExt for PaymentAttemptUpdate {
amount_capturable,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
@@ -1394,6 +1402,7 @@ impl DataModelExt for PaymentAttemptUpdate {
amount_capturable,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
},
@@ -1578,6 +1587,7 @@ impl DataModelExt for PaymentAttemptUpdate {
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
} => Self::Update {
amount,
@@ -1594,6 +1604,7 @@ impl DataModelExt for PaymentAttemptUpdate {
capture_method,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
},
DieselPaymentAttemptUpdate::UpdateTrackers {
@@ -1641,6 +1652,7 @@ impl DataModelExt for PaymentAttemptUpdate {
amount_capturable,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
} => Self::ConfirmUpdate {
@@ -1662,6 +1674,7 @@ impl DataModelExt for PaymentAttemptUpdate {
amount_capturable,
surcharge_amount,
tax_amount,
+ fingerprint_id,
updated_by,
merchant_connector_id: connector_id,
},
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 7efbafb662d..d201d2a053a 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -925,12 +925,14 @@ impl DataModelExt for PaymentIntentUpdate {
Self::ResponseUpdate {
status,
amount_captured,
+ fingerprint_id,
return_url,
updated_by,
incremental_authorization_allowed,
} => DieselPaymentIntentUpdate::ResponseUpdate {
status,
amount_captured,
+ fingerprint_id,
return_url,
updated_by,
incremental_authorization_allowed,
diff --git a/migrations/2024-02-12-135546_add_fingerprint_id_in_payment_attempt/down.sql b/migrations/2024-02-12-135546_add_fingerprint_id_in_payment_attempt/down.sql
new file mode 100644
index 00000000000..c6647bd3ab0
--- /dev/null
+++ b/migrations/2024-02-12-135546_add_fingerprint_id_in_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS fingerprint_id;
diff --git a/migrations/2024-02-12-135546_add_fingerprint_id_in_payment_attempt/up.sql b/migrations/2024-02-12-135546_add_fingerprint_id_in_payment_attempt/up.sql
new file mode 100644
index 00000000000..8d219935234
--- /dev/null
+++ b/migrations/2024-02-12-135546_add_fingerprint_id_in_payment_attempt/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS fingerprint_id VARCHAR(64);
|
refactor
|
inclusion of locker to store fingerprints (#3630)
|
b481e5cb8ffe417591a2fb917f37ba72667f2fcd
|
2024-11-05 14:53:31
|
Suman Maji
|
feat(connector): [ELAVON] Template PR (#6309)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index b0d3c743673..b1189b51fae 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -206,6 +206,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.demo.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 780af87383f..5228f435fcd 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -48,6 +48,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.demo.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 430475b9e5c..ed2430b266a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -52,6 +52,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com"
fiuu.base_url = "https://pay.merchant.razer.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 99d4253aea3..3c39f31faec 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -52,6 +52,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.demo.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
diff --git a/config/development.toml b/config/development.toml
index cbc4573e555..ca4dcb9529e 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -118,6 +118,7 @@ cards = [
"dlocal",
"dummyconnector",
"ebanx",
+ "elavon",
"fiserv",
"fiservemea",
"fiuu",
@@ -216,6 +217,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.demo.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index cf07a1bf9be..b84c3dacd9c 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -135,6 +135,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.demo.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
@@ -231,6 +232,7 @@ cards = [
"dlocal",
"dummyconnector",
"ebanx",
+ "elavon",
"fiserv",
"fiservemea",
"fiuu",
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index f257d63cbb5..bd9efa57bc6 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -8,6 +8,7 @@ pub mod cryptopay;
pub mod deutschebank;
pub mod digitalvirgo;
pub mod dlocal;
+pub mod elavon;
pub mod fiserv;
pub mod fiservemea;
pub mod fiuu;
@@ -38,10 +39,10 @@ pub mod zsl;
pub use self::{
airwallex::Airwallex, bambora::Bambora, billwerk::Billwerk, bitpay::Bitpay,
cashtocode::Cashtocode, coinbase::Coinbase, cryptopay::Cryptopay, deutschebank::Deutschebank,
- digitalvirgo::Digitalvirgo, dlocal::Dlocal, fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu,
- forte::Forte, globepay::Globepay, helcim::Helcim, mollie::Mollie, multisafepay::Multisafepay,
- nexinets::Nexinets, nexixpay::Nexixpay, novalnet::Novalnet, payeezy::Payeezy, payu::Payu,
- powertranz::Powertranz, razorpay::Razorpay, shift4::Shift4, square::Square, stax::Stax,
- taxjar::Taxjar, thunes::Thunes, tsys::Tsys, volt::Volt, worldline::Worldline,
- worldpay::Worldpay, zen::Zen, zsl::Zsl,
+ digitalvirgo::Digitalvirgo, dlocal::Dlocal, elavon::Elavon, fiserv::Fiserv,
+ fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, globepay::Globepay, helcim::Helcim,
+ mollie::Mollie, multisafepay::Multisafepay, nexinets::Nexinets, nexixpay::Nexixpay,
+ novalnet::Novalnet, payeezy::Payeezy, payu::Payu, powertranz::Powertranz, razorpay::Razorpay,
+ shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys,
+ volt::Volt, worldline::Worldline, worldpay::Worldpay, zen::Zen, zsl::Zsl,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon.rs b/crates/hyperswitch_connectors/src/connectors/elavon.rs
new file mode 100644
index 00000000000..7e4408d301f
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/elavon.rs
@@ -0,0 +1,563 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as elavon;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Elavon {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Elavon {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Elavon {}
+impl api::PaymentSession for Elavon {}
+impl api::ConnectorAccessToken for Elavon {}
+impl api::MandateSetup for Elavon {}
+impl api::PaymentAuthorize for Elavon {}
+impl api::PaymentSync for Elavon {}
+impl api::PaymentCapture for Elavon {}
+impl api::PaymentVoid for Elavon {}
+impl api::Refund for Elavon {}
+impl api::RefundExecute for Elavon {}
+impl api::RefundSync for Elavon {}
+impl api::PaymentToken for Elavon {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Elavon
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Elavon
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &RouterData<Flow, Request, Response>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Elavon {
+ fn id(&self) -> &'static str {
+ "elavon"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Base
+ // TODO! Check connector documentation, on which unit they are processing the currency.
+ // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
+ // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.elavon.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = elavon::ElavonAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.expose().into_masked(),
+ )])
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: elavon::ElavonErrorResponse = res
+ .response
+ .parse_struct("ElavonErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Elavon {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Elavon {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Elavon {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Elavon {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Elavon {
+ fn get_headers(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = elavon::ElavonRouterData::from((amount, req));
+ let connector_req = elavon::ElavonPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: elavon::ElavonPaymentsResponse = res
+ .response
+ .parse_struct("Elavon PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Elavon {
+ fn get_headers(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: elavon::ElavonPaymentsResponse = res
+ .response
+ .parse_struct("elavon PaymentsSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Elavon {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: elavon::ElavonPaymentsResponse = res
+ .response
+ .parse_struct("Elavon PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Elavon {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Elavon {
+ fn get_headers(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = elavon::ElavonRouterData::from((refund_amount, req));
+ let connector_req = elavon::ElavonRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundsRouterData<Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ let response: elavon::RefundResponse =
+ res.response
+ .parse_struct("elavon RefundResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Elavon {
+ fn get_headers(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ let response: elavon::RefundResponse = res
+ .response
+ .parse_struct("elavon RefundSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Elavon {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
new file mode 100644
index 00000000000..1dbf03ea275
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
@@ -0,0 +1,228 @@
+use common_enums::enums;
+use common_utils::types::StringMinorUnit;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{ConnectorAuthType, RouterData},
+ router_flow_types::refunds::{Execute, RSync},
+ router_request_types::ResponseId,
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ types::{RefundsResponseRouterData, ResponseRouterData},
+ utils::PaymentsAuthorizeRequestData,
+};
+
+//TODO: Fill the struct with respective fields
+pub struct ElavonRouterData<T> {
+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for ElavonRouterData<T> {
+ fn from((amount, item): (StringMinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct ElavonPaymentsRequest {
+ amount: StringMinorUnit,
+ card: ElavonCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct ElavonCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&ElavonRouterData<&PaymentsAuthorizeRouterData>> for ElavonPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &ElavonRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = ElavonCard {
+ 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.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct ElavonAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for ElavonAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => 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 ElavonPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<ElavonPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: ElavonPaymentStatus) -> Self {
+ match item {
+ ElavonPaymentStatus::Succeeded => Self::Charged,
+ ElavonPaymentStatus::Failed => Self::Failure,
+ ElavonPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct ElavonPaymentsResponse {
+ status: ElavonPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, ElavonPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, ElavonPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct ElavonRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&ElavonRouterData<&RefundsRouterData<F>>> for ElavonRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &ElavonRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct ElavonErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 26d7834dc69..31071bead44 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -99,6 +99,7 @@ default_imp_for_authorize_session_token!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -151,6 +152,7 @@ default_imp_for_calculate_tax!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -202,6 +204,7 @@ default_imp_for_session_update!(
connectors::Cryptopay,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Forte,
@@ -255,6 +258,7 @@ default_imp_for_post_session_tokens!(
connectors::Cryptopay,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Square,
connectors::Fiserv,
connectors::Fiservemea,
@@ -308,6 +312,7 @@ default_imp_for_complete_authorize!(
connectors::Cryptopay,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -357,6 +362,7 @@ default_imp_for_incremental_authorization!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -411,6 +417,7 @@ default_imp_for_create_customer!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -464,6 +471,7 @@ default_imp_for_connector_redirect_response!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -513,6 +521,7 @@ default_imp_for_pre_processing_steps!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -565,6 +574,7 @@ default_imp_for_post_processing_steps!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -619,6 +629,7 @@ default_imp_for_approve!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -673,6 +684,7 @@ default_imp_for_reject!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -727,6 +739,7 @@ default_imp_for_webhook_source_verification!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -782,6 +795,7 @@ default_imp_for_accept_dispute!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -836,6 +850,7 @@ default_imp_for_submit_evidence!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -890,6 +905,7 @@ default_imp_for_defend_dispute!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -953,6 +969,7 @@ default_imp_for_file_upload!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1009,6 +1026,7 @@ default_imp_for_payouts_create!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1065,6 +1083,7 @@ default_imp_for_payouts_retrieve!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1121,6 +1140,7 @@ default_imp_for_payouts_eligibility!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1177,6 +1197,7 @@ default_imp_for_payouts_fulfill!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1233,6 +1254,7 @@ default_imp_for_payouts_cancel!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1289,6 +1311,7 @@ default_imp_for_payouts_quote!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1345,6 +1368,7 @@ default_imp_for_payouts_recipient!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1401,6 +1425,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1457,6 +1482,7 @@ default_imp_for_frm_sale!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1513,6 +1539,7 @@ default_imp_for_frm_checkout!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1569,6 +1596,7 @@ default_imp_for_frm_transaction!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1625,6 +1653,7 @@ default_imp_for_frm_fulfillment!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1681,6 +1710,7 @@ default_imp_for_frm_record_return!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1734,6 +1764,7 @@ default_imp_for_revoking_mandates!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index b5d20198df3..04af3298933 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -215,6 +215,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -270,6 +271,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -320,6 +322,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -376,6 +379,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -431,6 +435,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -486,6 +491,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -551,6 +557,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -608,6 +615,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -665,6 +673,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -722,6 +731,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -779,6 +789,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -836,6 +847,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -893,6 +905,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -950,6 +963,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1007,6 +1021,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1062,6 +1077,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1119,6 +1135,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1176,6 +1193,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1233,6 +1251,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1290,6 +1309,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1347,6 +1367,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
@@ -1401,6 +1422,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
+ connectors::Elavon,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 6f9beb55054..fd09251699b 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -35,6 +35,7 @@ pub struct Connectors {
#[cfg(feature = "dummy_connector")]
pub dummyconnector: ConnectorParams,
pub ebanx: ConnectorParams,
+ pub elavon: ConnectorParams,
pub fiserv: ConnectorParams,
pub fiservemea: ConnectorParams,
pub fiuu: ConnectorParamsWithThreeUrls,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 97a4a763a83..899e5f2b15c 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -48,14 +48,15 @@ pub use hyperswitch_connectors::connectors::{
airwallex, airwallex::Airwallex, bambora, bambora::Bambora, billwerk, billwerk::Billwerk,
bitpay, bitpay::Bitpay, cashtocode, cashtocode::Cashtocode, coinbase, coinbase::Coinbase,
cryptopay, cryptopay::Cryptopay, deutschebank, deutschebank::Deutschebank, digitalvirgo,
- digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, fiserv, fiserv::Fiserv, fiservemea,
- fiservemea::Fiservemea, fiuu, fiuu::Fiuu, forte, forte::Forte, globepay, globepay::Globepay,
- helcim, helcim::Helcim, mollie, mollie::Mollie, multisafepay, multisafepay::Multisafepay,
- nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, novalnet, novalnet::Novalnet,
- payeezy, payeezy::Payeezy, payu, payu::Payu, powertranz, powertranz::Powertranz, razorpay,
- razorpay::Razorpay, shift4, shift4::Shift4, square, square::Square, stax, stax::Stax, taxjar,
- taxjar::Taxjar, thunes, thunes::Thunes, tsys, tsys::Tsys, volt, volt::Volt, worldline,
- worldline::Worldline, worldpay, worldpay::Worldpay, zen, zen::Zen, zsl, zsl::Zsl,
+ digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, elavon, elavon::Elavon, fiserv,
+ fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, forte, forte::Forte,
+ globepay, globepay::Globepay, helcim, helcim::Helcim, mollie, mollie::Mollie, multisafepay,
+ multisafepay::Multisafepay, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay,
+ novalnet, novalnet::Novalnet, payeezy, payeezy::Payeezy, payu, payu::Payu, powertranz,
+ powertranz::Powertranz, razorpay, razorpay::Razorpay, shift4, shift4::Shift4, square,
+ square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, thunes, thunes::Thunes, tsys,
+ tsys::Tsys, volt, volt::Volt, worldline, worldline::Worldline, worldpay, worldpay::Worldpay,
+ zen, zen::Zen, zsl, zsl::Zsl,
};
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs
index ac3d5d58859..6ec9cd7c932 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1130,6 +1130,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Digitalvirgo,
connector::Dlocal,
connector::Ebanx,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Fiuu,
@@ -1773,6 +1774,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Digitalvirgo,
connector::Dlocal,
connector::Ebanx,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Forte,
@@ -2264,6 +2266,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Digitalvirgo,
connector::Dlocal,
connector::Ebanx,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Forte,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 29629d03773..5597ef41389 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -471,6 +471,7 @@ default_imp_for_connector_request_id!(
connector::Digitalvirgo,
connector::Dlocal,
connector::Ebanx,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Fiuu,
@@ -993,6 +994,7 @@ default_imp_for_payouts!(
connector::Deutschebank,
connector::Digitalvirgo,
connector::Dlocal,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Fiuu,
@@ -1787,6 +1789,7 @@ default_imp_for_fraud_check!(
connector::Digitalvirgo,
connector::Dlocal,
connector::Ebanx,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Fiuu,
@@ -2447,6 +2450,7 @@ default_imp_for_connector_authentication!(
connector::Digitalvirgo,
connector::Dlocal,
connector::Ebanx,
+ connector::Elavon,
connector::Fiserv,
connector::Fiservemea,
connector::Fiuu,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index ee25cb5fcb1..428506d6c8a 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -406,6 +406,7 @@ impl ConnectorData {
enums::Connector::Ebanx => {
Ok(ConnectorEnum::Old(Box::new(connector::Ebanx::new())))
}
+ // enums::Connector::Elavon => Ok(ConnectorEnum::Old(Box::new(connector::Elavon))),
enums::Connector::Fiserv => Ok(ConnectorEnum::Old(Box::new(&connector::Fiserv))),
enums::Connector::Fiservemea => {
Ok(ConnectorEnum::Old(Box::new(connector::Fiservemea::new())))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 0585aee4a0e..8e5f0944997 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -265,6 +265,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Deutschebank => Self::Deutschebank,
api_enums::Connector::Dlocal => Self::Dlocal,
api_enums::Connector::Ebanx => Self::Ebanx,
+ // api_enums::Connector::Elavon => Self::Elavon,
api_enums::Connector::Fiserv => Self::Fiserv,
api_enums::Connector::Fiservemea => Self::Fiservemea,
api_enums::Connector::Fiuu => Self::Fiuu,
diff --git a/crates/router/tests/connectors/elavon.rs b/crates/router/tests/connectors/elavon.rs
new file mode 100644
index 00000000000..af00ab909a1
--- /dev/null
+++ b/crates/router/tests/connectors/elavon.rs
@@ -0,0 +1,427 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct ElavonTest;
+impl ConnectorActions for ElavonTest {}
+impl utils::Connector for ElavonTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Elavon;
+ utils::construct_connector_data_old(
+ Box::new(Elavon::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ // api::ConnectorData {
+ // connector: Box::new(Elavon::new()),
+ // connector_name: types::Connector::Elavon,
+ // get_token: types::api::GetToken::Connector,
+ // merchant_connector_id: None,
+ // }
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .elavon
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "elavon".to_string()
+ }
+}
+
+static CONNECTOR: ElavonTest = ElavonTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 433f2d03eea..24d1de432f9 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -31,6 +31,7 @@ mod dlocal;
#[cfg(feature = "dummy_connector")]
mod dummyconnector;
mod ebanx;
+mod elavon;
mod fiserv;
mod fiservemea;
mod fiuu;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 2b20ed4cf16..6ec2ec5a1dc 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -283,3 +283,7 @@ api_secret = "Client Key"
[thunes]
api_key="API Key"
+
+
+[elavon]
+api_key="API Key"
\ No newline at end of file
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index c71db4472c1..08aa09599ca 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -37,6 +37,7 @@ pub struct ConnectorAuthentication {
#[cfg(feature = "dummy_connector")]
pub dummyconnector: Option<HeaderKey>,
pub ebanx: Option<HeaderKey>,
+ pub elavon: Option<HeaderKey>,
pub fiserv: Option<SignatureKey>,
pub fiservemea: Option<HeaderKey>,
pub fiuu: Option<HeaderKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 11268e15e54..be7d71314ac 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -101,6 +101,7 @@ digitalvirgo.base_url = "https://dcb-integration-service-sandbox-external.stagin
dlocal.base_url = "https://sandbox.dlocal.com/"
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
ebanx.base_url = "https://sandbox.ebanxpay.com/"
+elavon.base_url = "https://api.demo.convergepay.com"
fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
@@ -197,6 +198,7 @@ cards = [
"dlocal",
"dummyconnector",
"ebanx",
+ "elavon",
"fiserv",
"fiservemea",
"fiuu",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index b8ec9ac7b7d..f7609ff9292 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx fiserv fiservemea fiuu forte globalpay globepay gocardless gpayments helcim iatapay itaubank klarna mifinity mollie multisafepay netcetera nexinets nexixpay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys volt wellsfargo wellsfargopayout wise worldline worldpay zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte globalpay globepay gocardless gpayments helcim iatapay itaubank klarna mifinity mollie multisafepay netcetera nexinets nexixpay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys volt wellsfargo wellsfargopayout wise worldline worldpay zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
feat
|
[ELAVON] Template PR (#6309)
|
b9583e1720e92180b7f0430b2d84f586441c2250
|
2025-02-25 22:58:45
|
GORAKHNATH YADAV
|
docs: changes for api ref (#7324)
| false
|
diff --git a/api-reference/api-reference/payments/Introduction--to--payments.mdx b/api-reference/api-reference/payments/Introduction--to--payments.mdx
new file mode 100644
index 00000000000..4cccc9cde2c
--- /dev/null
+++ b/api-reference/api-reference/payments/Introduction--to--payments.mdx
@@ -0,0 +1,60 @@
+---
+tags: [Payments]
+sidebarTitle: "Getting Started with Payments"
+icon: "circle-play"
+iconType: "solid"
+color: "Green"
+---
+
+The **Hyperswitch Payments API** enables businesses to **accept, process, and manage payments seamlessly**. It supports the entire **payment lifecycle**—from creation to capture, refunds, and disputes—allowing smooth integration of **various payment methods** into any application with minimal complexity.
+
+### How to try your first payment through hyperswitch?
+You have two options to use the Payments API:
+
+1. **Sandbox API Key (Dashboard)** – Quick testing without setup.
+2. **Self-Deploy** – Create merchants and API keys through Rest API.
+
+Each option has specific nuances, we have mentioned the differences in the below step by step guide
+<Tip>We recommend using our [Dashboard](https://app.hyperswitch.io/dashboard/login) to generate API Key and setting up Connectors (Step 4)</Tip> for faster trial and simple setup
+<Steps>
+ <Step title="Create a Merchant Account">
+ This account is representative of you or your organization that would like to accept payments from different <Tooltip tip="Can be a payment method or payment service provider">payment connectors</Tooltip>
+ <Steps>
+ <Step title="Hyperswitch Dashboard flow" icon= "box-open">
+ Access the <Tooltip tip="Control Center is a frontend interface for the API to track and test payments">[Dashboard](https://app.hyperswitch.io/dashboard/login)</Tooltip> and sign up -> **Sign up here is equivalent to creating a Merchant Account**
+ </Step>
+ <Step title="Self-Deploy flow" icon="map-pin">
+ Use the admin api key and the [Merchant Account - Create](api-reference/merchant-account/merchant-account--create) endpoint to create your Merchant Account
+ </Step>
+</Steps>
+ </Step>
+ <Step title="Create API Key">
+ You can now generate an API key that will be the secret key used to authenticate your payment request
+ <Steps>
+ <Step title="Hyperswitch Dashboard flow" icon= "box-open">
+ In Dashboard go to Developer-> API Keys -> +Create New Api Key. This key can be used in your API requests for authentication.
+ </Step>
+ <Step title="Self-Deploy flow" icon="map-pin">
+ Use the admin api key and the [Merchant Account - Create](api-reference/merchant-account/merchant-account--create) endpoint to create your Merchant Account
+ </Step>
+</Steps>
+ </Step>
+ <Step title="Set up Connectors">
+ Connect the payment [connectors](api-reference/merchant-connector-account/merchant-connector--create) and payment methods that your organization will accept. Connectors could be a payment processor/facilitator/acquirer or a provider of specialized services like Fraud/Accounting
+ <Steps>
+ <Step title="Hyperswitch Dashboard flow" icon= "box-open">
+ In Dashboard go to Connectors -> <Tooltip tip="Adding other connectors (eg. Adyen) will require you to go through their respective documentation">+Connect a Dummy Processor</Tooltip>. Choose the payments methods to enable and complete setup.
+ </Step>
+ <Step title="Self-Deploy flow" icon="map-pin">
+ Use the admin api key and the [Connector Account](api-reference/merchant-connector-account/merchant-connector--create) endpoints to set up a connector
+ </Step>
+</Steps>
+ </Step>
+ <Step title="Try your first payment">
+ You are all set! Go ahead and try the [Payments API](api-reference/payments/payments--create), be sure to try the different use cases provided
+ </Step>
+ <Step title="We are here to help" icon="circle-info">
+ Test the use cases you are interested in and in case of difficulty, feel free to contact us on our [slack channel](https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2jqxmpsbm-WXUENx022HjNEy~Ark7Orw)
+ </Step>
+</Steps>
+---
diff --git a/api-reference/api-reference/payments/payments--create.mdx b/api-reference/api-reference/payments/payments--create.mdx
index 0b7038a4ea6..af436038731 100644
--- a/api-reference/api-reference/payments/payments--create.mdx
+++ b/api-reference/api-reference/payments/payments--create.mdx
@@ -1,3 +1,4 @@
---
openapi: openapi_spec post /payments
----
\ No newline at end of file
+---
+<Tip> Use the dropdown on the top right corner of the code snippet to try out different payment scenarios. </Tip>
\ No newline at end of file
diff --git a/api-reference/introduction.mdx b/api-reference/introduction.mdx
index 5f92f11fda2..2549b6c43a8 100644
--- a/api-reference/introduction.mdx
+++ b/api-reference/introduction.mdx
@@ -1,15 +1,32 @@
---
tags: [Getting Started]
+title: "👋 Welcome to Hyperswitch API Reference"
+sidebarTitle: "Introduction"
stoplight-id: 3lmsk7ocvq21v
+icon: "rectangle-code"
+iconType: "solid"
---
-# 👋 Welcome to Hyperswitch API Reference
-
Hyperswitch 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. You can consume the APIs directly using your favorite HTTP/REST library.
+<CardGroup horizontal cols={2} row={3}>
+ <Card horizontal title="Try a Payment" href="api-reference/payments/Introduction--to--payments" icon="money-bill">
+ Explore the versatile payments endpoint, through multiple test scenarios
+ </Card>
+ <Card horizontal title="Refund" href="api-reference/refunds/refunds--create" icon="receipt">
+ Process refunds for completed payments using our API
+ </Card>
+ <Card horizontal title="Save a payment method" href="api-reference/payment-methods/paymentmethods--create" icon="vault">
+ Save customer payment methods securely for future transactions
+ </Card>
+ <Card horizontal title="Self Hosted?" href="api-reference/organization/organization--create" icon="circle-down">
+ Host Hyperswitch on-premise? Utilize our full API suite.
+ </Card>
+</CardGroup>
+
## Environment
-We have a testing environment referred to "sandbox," which you can set up to test API calls without affecting production data. You can sign up on our Dashboard to get API keys to access Hyperswitch API.
+We have a testing environment referred to <Tooltip tip="Testing environment!">"sandbox</Tooltip>," which you can set up to test API calls without affecting production data. You can sign up on our Dashboard to get API keys to access Hyperswitch API.
Use the following base URLs when making requests to the APIs:
diff --git a/api-reference/mint.json b/api-reference/mint.json
index a134b3c5b2b..e74a8f1386a 100644
--- a/api-reference/mint.json
+++ b/api-reference/mint.json
@@ -5,6 +5,17 @@
"dark": "/logo/dark.svg",
"light": "/logo/light.svg"
},
+ "topbarLinks": [
+ {
+ "name": "Contact Us",
+ "url": "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2jqxmpsbm-WXUENx022HjNEy~Ark7Orw"
+ }
+ ],
+ "topbarCtaButton": {
+ "type": "link",
+ "url": "https://docs.hyperswitch.io/hyperswitch-open-source/overview",
+ "name": "Self-Deploy"
+ },
"favicon": "/favicon.png",
"colors": {
"primary": "#006DF9",
@@ -14,6 +25,9 @@
"dark": "#242F48"
}
},
+ "sidebar": {
+ "items": "card"
+ },
"tabs": [
{
"name": "Locker API Reference",
@@ -39,6 +53,7 @@
{
"group": "Payments",
"pages": [
+ "api-reference/payments/Introduction--to--payments",
"api-reference/payments/payments--create",
"api-reference/payments/payments--update",
"api-reference/payments/payments--confirm",
@@ -101,54 +116,6 @@
"api-reference/disputes/disputes--list"
]
},
- {
- "group": "Organization",
- "pages": [
- "api-reference/organization/organization--create",
- "api-reference/organization/organization--retrieve",
- "api-reference/organization/organization--update"
- ]
- },
- {
- "group": "Merchant Account",
- "pages": [
- "api-reference/merchant-account/merchant-account--create",
- "api-reference/merchant-account/merchant-account--retrieve",
- "api-reference/merchant-account/merchant-account--update",
- "api-reference/merchant-account/merchant-account--delete",
- "api-reference/merchant-account/merchant-account--kv-status"
- ]
- },
- {
- "group": "Business Profile",
- "pages": [
- "api-reference/business-profile/business-profile--create",
- "api-reference/business-profile/business-profile--update",
- "api-reference/business-profile/business-profile--retrieve",
- "api-reference/business-profile/business-profile--delete",
- "api-reference/business-profile/business-profile--list"
- ]
- },
- {
- "group": "API Key",
- "pages": [
- "api-reference/api-key/api-key--create",
- "api-reference/api-key/api-key--retrieve",
- "api-reference/api-key/api-key--update",
- "api-reference/api-key/api-key--revoke",
- "api-reference/api-key/api-key--list"
- ]
- },
- {
- "group": "Merchant Connector Account",
- "pages": [
- "api-reference/merchant-connector-account/merchant-connector--create",
- "api-reference/merchant-connector-account/merchant-connector--retrieve",
- "api-reference/merchant-connector-account/merchant-connector--update",
- "api-reference/merchant-connector-account/merchant-connector--delete",
- "api-reference/merchant-connector-account/merchant-connector--list"
- ]
- },
{
"group": "Payouts",
"pages": [
@@ -171,15 +138,6 @@
"api-reference/event/events--manual-retry"
]
},
- {
- "group": "GSM (Global Status Mapping)",
- "pages": [
- "api-reference/gsm/gsm--create",
- "api-reference/gsm/gsm--get",
- "api-reference/gsm/gsm--update",
- "api-reference/gsm/gsm--delete"
- ]
- },
{
"group": "Poll",
"pages": ["api-reference/poll/poll--retrieve-poll-status"]
@@ -221,6 +179,76 @@
}
]
},
+ {
+ "group": "Admin API based",
+ "pages": [
+ {
+ "group": "Organization",
+ "pages": [
+ "api-reference/organization/organization--create",
+ "api-reference/organization/organization--retrieve",
+ "api-reference/organization/organization--update"
+ ]
+ },
+ {
+ "group": "Merchant Account",
+ "pages": [
+ "api-reference/merchant-account/merchant-account--create",
+ "api-reference/merchant-account/merchant-account--retrieve",
+ "api-reference/merchant-account/merchant-account--update",
+ "api-reference/merchant-account/merchant-account--delete",
+ "api-reference/merchant-account/merchant-account--kv-status"
+ ]
+ },
+ {
+ "group": "Business Profile",
+ "pages": [
+ "api-reference/business-profile/business-profile--create",
+ "api-reference/business-profile/business-profile--update",
+ "api-reference/business-profile/business-profile--retrieve",
+ "api-reference/business-profile/business-profile--delete",
+ "api-reference/business-profile/business-profile--list"
+ ]
+ },
+ {
+ "group": "API Key",
+ "pages": [
+ "api-reference/api-key/api-key--create",
+ "api-reference/api-key/api-key--retrieve",
+ "api-reference/api-key/api-key--update",
+ "api-reference/api-key/api-key--revoke",
+ "api-reference/api-key/api-key--list"
+ ]
+ },
+ {
+ "group": "Merchant Connector Account",
+ "pages": [
+ "api-reference/merchant-connector-account/merchant-connector--create",
+ "api-reference/merchant-connector-account/merchant-connector--retrieve",
+ "api-reference/merchant-connector-account/merchant-connector--update",
+ "api-reference/merchant-connector-account/merchant-connector--delete",
+ "api-reference/merchant-connector-account/merchant-connector--list"
+ ]
+ },
+ {
+ "group": "GSM (Global Status Mapping)",
+ "pages": [
+ "api-reference/gsm/gsm--create",
+ "api-reference/gsm/gsm--get",
+ "api-reference/gsm/gsm--update",
+ "api-reference/gsm/gsm--delete"
+ ]
+ },
+ {
+ "group": "Event",
+ "pages": [
+ "api-reference/event/events--list",
+ "api-reference/event/events--delivery-attempt-list",
+ "api-reference/event/events--manual-retry"
+ ]
+ }
+ ]
+ },
{
"group": "Hyperswitch Card Vault",
"pages": ["locker-api-reference/overview"]
@@ -263,11 +291,9 @@
"analytics": {
"gtm": {
"tagId": "GTM-PLBNKQFQ"
- }
- },
- "analytics": {
+ },
"mixpanel": {
"projectToken": "b00355f29d9548d1333608df71d5d53d"
}
}
-}
+}
\ No newline at end of file
|
docs
|
changes for api ref (#7324)
|
e0ec27d936fc62a6feb2f8f643a218f3ad7483b5
|
2025-02-05 15:24:57
|
Sakil Mostak
|
feat(core): google pay decrypt flow (#6991)
| false
|
diff --git a/.deepsource.toml b/.deepsource.toml
index 3cac181614e..8d0b3c501af 100644
--- a/.deepsource.toml
+++ b/.deepsource.toml
@@ -13,4 +13,4 @@ name = "rust"
enabled = true
[analyzers.meta]
-msrv = "1.78.0"
+msrv = "1.80.0"
diff --git a/Cargo.lock b/Cargo.lock
index 7583fb2eeee..7e2ab6eccd2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1528,6 +1528,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+[[package]]
+name = "base64-serde"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77c6d128af408d8ebd08331f0331cf2cf20d19e6c44a7aec58791641ecc8c0b5"
+
[[package]]
name = "base64-simd"
version = "0.8.0"
@@ -2044,6 +2050,7 @@ version = "0.1.0"
dependencies = [
"async-trait",
"base64 0.22.1",
+ "base64-serde",
"blake3",
"bytes 1.7.1",
"common_enums",
@@ -6581,6 +6588,7 @@ dependencies = [
"external_services",
"futures 0.3.30",
"hex",
+ "hkdf",
"http 0.2.12",
"hyper 0.14.30",
"hyperswitch_connectors",
@@ -6629,6 +6637,7 @@ dependencies = [
"serde_with",
"serial_test",
"sha1",
+ "sha2",
"storage_impl",
"strum 0.26.3",
"tera",
diff --git a/Cargo.toml b/Cargo.toml
index dc60c64f667..94e717c5b79 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
resolver = "2"
members = ["crates/*"]
package.edition = "2021"
-package.rust-version = "1.78.0"
+package.rust-version = "1.80.0"
package.license = "Apache-2.0"
[workspace.dependencies]
diff --git a/INSTALL_dependencies.sh b/INSTALL_dependencies.sh
index e1d666b97a3..bc7d502b357 100755
--- a/INSTALL_dependencies.sh
+++ b/INSTALL_dependencies.sh
@@ -9,7 +9,7 @@ if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
-RUST_MSRV="1.78.0"
+RUST_MSRV="1.80.0"
_DB_NAME="hyperswitch_db"
_DB_USER="db_user"
_DB_PASS="db_password"
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index b315800b08c..447010178de 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -6875,6 +6875,11 @@
"type": "object",
"description": "This field contains the Paze certificates and credentials",
"nullable": true
+ },
+ "google_pay": {
+ "type": "object",
+ "description": "This field contains the Google Pay certificates and credentials",
+ "nullable": true
}
},
"additionalProperties": false
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 0aa2c898fc6..fa631eee788 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -9523,6 +9523,11 @@
"type": "object",
"description": "This field contains the Paze certificates and credentials",
"nullable": true
+ },
+ "google_pay": {
+ "type": "object",
+ "description": "This field contains the Google Pay certificates and credentials",
+ "nullable": true
}
},
"additionalProperties": false
diff --git a/config/config.example.toml b/config/config.example.toml
index b76905eb534..c113d7abd57 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -607,6 +607,9 @@ apple_pay_merchant_cert_key = "APPLE_PAY_MERCHNAT_CERTIFICATE_KEY" # Private key
paze_private_key = "PAZE_PRIVATE_KEY" # Base 64 Encoded Private Key File cakey.pem generated for Paze -> Command to create private key: openssl req -newkey rsa:2048 -x509 -keyout cakey.pem -out cacert.pem -days 365
paze_private_key_passphrase = "PAZE_PRIVATE_KEY_PASSPHRASE" # PEM Passphrase used for generating Private Key File cakey.pem
+[google_pay_decrypt_keys]
+google_pay_root_signing_keys = "GOOGLE_PAY_ROOT_SIGNING_KEYS" # Base 64 Encoded Root Signing Keys provided by Google Pay (https://developers.google.com/pay/api/web/guides/resources/payment-data-cryptography)
+
[applepay_merchant_configs]
# Run below command to get common merchant identifier for applepay in shell
#
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 8c846ff422e..4e5fa3dba44 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -34,6 +34,9 @@ apple_pay_merchant_cert_key = "APPLE_PAY_MERCHNAT_CERTIFICATE_KEY" # Private key
paze_private_key = "PAZE_PRIVATE_KEY" # Base 64 Encoded Private Key File cakey.pem generated for Paze -> Command to create private key: openssl req -newkey rsa:2048 -x509 -keyout cakey.pem -out cacert.pem -days 365
paze_private_key_passphrase = "PAZE_PRIVATE_KEY_PASSPHRASE" # PEM Passphrase used for generating Private Key File cakey.pem
+[google_pay_decrypt_keys]
+google_pay_root_signing_keys = "GOOGLE_PAY_ROOT_SIGNING_KEYS" # Base 64 Encoded Root Signing Keys provided by Google Pay (https://developers.google.com/pay/api/web/guides/resources/payment-data-cryptography)
+
[applepay_merchant_configs]
common_merchant_identifier = "APPLE_PAY_COMMON_MERCHANT_IDENTIFIER" # Refer to config.example.toml to learn how you can generate this value
merchant_cert = "APPLE_PAY_MERCHANT_CERTIFICATE" # Merchant Certificate provided by Apple Pay (https://developer.apple.com/) Certificates, Identifiers & Profiles > Apple Pay Merchant Identity Certificate
diff --git a/config/development.toml b/config/development.toml
index 8209d49565f..2b81123d873 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -671,6 +671,9 @@ apple_pay_merchant_cert_key = "APPLE_PAY_MERCHNAT_CERTIFICATE_KEY"
paze_private_key = "PAZE_PRIVATE_KEY"
paze_private_key_passphrase = "PAZE_PRIVATE_KEY_PASSPHRASE"
+[google_pay_decrypt_keys]
+google_pay_root_signing_keys = "GOOGLE_PAY_ROOT_SIGNING_KEYS" # Base 64 Encoded Root Signing Keys provided by Google Pay (https://developers.google.com/pay/api/web/guides/resources/payment-data-cryptography)
+
[generic_link]
[generic_link.payment_method_collect]
sdk_url = "http://localhost:9050/HyperLoader.js"
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 321ee5305f1..e47f7826d59 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -1468,6 +1468,10 @@ pub struct ConnectorWalletDetails {
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(value_type = Option<Object>)]
pub paze: Option<pii::SecretSerdeValue>,
+ /// This field contains the Google Pay certificates and credentials
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[schema(value_type = Option<Object>)]
+ pub google_pay: Option<pii::SecretSerdeValue>,
}
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 2c8723857a8..3a6fe000afe 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5984,6 +5984,57 @@ pub struct SessionTokenForSimplifiedApplePay {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayWalletDetails {
+ pub google_pay: GooglePayDetails,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayDetails {
+ pub provider_details: GooglePayProviderDetails,
+}
+
+// Google Pay Provider Details can of two types: GooglePayMerchantDetails or GooglePayHyperSwitchDetails
+// GooglePayHyperSwitchDetails is not implemented yet
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[serde(untagged)]
+pub enum GooglePayProviderDetails {
+ GooglePayMerchantDetails(GooglePayMerchantDetails),
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayMerchantDetails {
+ pub merchant_info: GooglePayMerchantInfo,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayMerchantInfo {
+ pub merchant_name: String,
+ pub tokenization_specification: GooglePayTokenizationSpecification,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayTokenizationSpecification {
+ #[serde(rename = "type")]
+ pub tokenization_type: GooglePayTokenizationType,
+ pub parameters: GooglePayTokenizationParameters,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum GooglePayTokenizationType {
+ PaymentGateway,
+ Direct,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayTokenizationParameters {
+ pub gateway: String,
+ pub public_key: Secret<String>,
+ pub private_key: Secret<String>,
+ pub recipient_id: Option<Secret<String>>,
+}
+
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
#[serde(tag = "wallet_name")]
#[serde(rename_all = "snake_case")]
diff --git a/crates/cards/src/lib.rs b/crates/cards/src/lib.rs
index 91cb93301a9..0c0fb9d47a1 100644
--- a/crates/cards/src/lib.rs
+++ b/crates/cards/src/lib.rs
@@ -35,7 +35,7 @@ impl<'de> Deserialize<'de> for CardSecurityCode {
}
}
-#[derive(Serialize)]
+#[derive(Clone, Debug, Serialize)]
pub struct CardExpirationMonth(StrongSecret<u8>);
impl CardExpirationMonth {
@@ -67,7 +67,7 @@ impl<'de> Deserialize<'de> for CardExpirationMonth {
}
}
-#[derive(Serialize)]
+#[derive(Clone, Debug, Serialize)]
pub struct CardExpirationYear(StrongSecret<u16>);
impl CardExpirationYear {
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index c30c9ec9f14..2f5249ded57 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -3675,3 +3675,13 @@ pub enum FeatureStatus {
NotSupported,
Supported,
}
+
+#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub enum GooglePayAuthMethod {
+ /// Contain pan data only
+ PanOnly,
+ /// Contain cryptogram data along with pan data
+ #[serde(rename = "CRYPTOGRAM_3DS")]
+ Cryptogram,
+}
diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.toml
index dcdb4c760b1..3d31c7a6a98 100644
--- a/crates/common_utils/Cargo.toml
+++ b/crates/common_utils/Cargo.toml
@@ -26,6 +26,7 @@ payment_methods_v2 = []
[dependencies]
async-trait = { version = "0.1.79", optional = true }
base64 = "0.22.0"
+base64-serde = "0.8.0"
blake3 = { version = "1.5.1", features = ["serde"] }
bytes = "1.6.0"
diesel = "2.2.3"
diff --git a/crates/common_utils/src/custom_serde.rs b/crates/common_utils/src/custom_serde.rs
index 63ef30011f7..06087f082e0 100644
--- a/crates/common_utils/src/custom_serde.rs
+++ b/crates/common_utils/src/custom_serde.rs
@@ -203,8 +203,20 @@ pub mod timestamp {
/// <https://github.com/serde-rs/serde/issues/994#issuecomment-316895860>
pub mod json_string {
- use serde::de::{self, Deserialize, DeserializeOwned, Deserializer};
- use serde_json;
+ use serde::{
+ de::{self, Deserialize, DeserializeOwned, Deserializer},
+ ser::{self, Serialize, Serializer},
+ };
+
+ /// Serialize a type to json_string format
+ pub fn serialize<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ T: Serialize,
+ S: Serializer,
+ {
+ let j = serde_json::to_string(value).map_err(ser::Error::custom)?;
+ j.serialize(serializer)
+ }
/// Deserialize a string which is in json format
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs
index 463ec3ee1b6..fd0c935035f 100644
--- a/crates/common_utils/src/lib.rs
+++ b/crates/common_utils/src/lib.rs
@@ -35,6 +35,8 @@ pub mod hashing;
#[cfg(feature = "metrics")]
pub mod metrics;
+pub use base64_serializer::Base64Serializer;
+
/// Date-time utilities.
pub mod date_time {
#[cfg(feature = "async_ext")]
@@ -296,6 +298,14 @@ pub trait DbConnectionParams {
}
}
+// Can't add doc comments for macro invocations, neither does the macro allow it.
+#[allow(missing_docs)]
+mod base64_serializer {
+ use base64_serde::base64_serde_type;
+
+ base64_serde_type!(pub Base64Serializer, crate::consts::BASE64_ENGINE);
+}
+
#[cfg(test)]
mod nanoid_tests {
#![allow(clippy::unwrap_used)]
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
index 3602f771928..b33555a7c55 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
@@ -962,6 +962,12 @@ impl TryFrom<&BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>>
PaymentMethodToken::PazeDecrypt(_) => Err(
unimplemented_payment_method!("Paze", "Bank Of America"),
)?,
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!(
+ "Google Pay",
+ "Bank Of America"
+ ))?
+ }
},
None => {
let email = item.router_data.request.get_email()?;
@@ -2279,6 +2285,10 @@ impl TryFrom<(&SetupMandateRouterData, ApplePayWalletData)> for BankOfAmericaPay
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Bank Of America"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => Err(unimplemented_payment_method!(
+ "Google Pay",
+ "Bank Of America"
+ ))?,
},
None => PaymentInformation::from(&apple_pay_data),
};
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index 5fc9cad4ffe..b14ffc9c79e 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -24,7 +24,8 @@ use hyperswitch_domain_models::{
},
router_data::{
AdditionalPaymentMethodConnectorResponse, ApplePayPredecryptData, ConnectorAuthType,
- ConnectorResponseData, ErrorResponse, PaymentMethodToken, RouterData,
+ ConnectorResponseData, ErrorResponse, GooglePayDecryptedData, PaymentMethodToken,
+ RouterData,
},
router_flow_types::{
payments::Authorize,
@@ -196,9 +197,9 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
ApplePayPaymentInformation {
tokenized_card: TokenizedCard {
number: decrypt_data.application_primary_account_number,
- cryptogram: decrypt_data
- .payment_data
- .online_payment_cryptogram,
+ cryptogram: Some(
+ decrypt_data.payment_data.online_payment_cryptogram,
+ ),
transaction_type: TransactionType::ApplePay,
expiration_year,
expiration_month,
@@ -216,6 +217,9 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Cybersource"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Cybersource"))?
+ }
},
None => (
PaymentInformation::ApplePayToken(Box::new(
@@ -233,15 +237,17 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {
),
},
WalletData::GooglePay(google_pay_data) => (
- PaymentInformation::GooglePay(Box::new(GooglePayPaymentInformation {
- fluid_data: FluidData {
- value: Secret::from(
- consts::BASE64_ENGINE
- .encode(google_pay_data.tokenization_data.token),
- ),
- descriptor: None,
+ PaymentInformation::GooglePayToken(Box::new(
+ GooglePayTokenPaymentInformation {
+ fluid_data: FluidData {
+ value: Secret::from(
+ consts::BASE64_ENGINE
+ .encode(google_pay_data.tokenization_data.token),
+ ),
+ descriptor: None,
+ },
},
- })),
+ )),
Some(PaymentSolution::GooglePay),
),
WalletData::AliPayQr(_)
@@ -448,7 +454,7 @@ pub struct TokenizedCard {
number: Secret<String>,
expiration_month: Secret<String>,
expiration_year: Secret<String>,
- cryptogram: Secret<String>,
+ cryptogram: Option<Secret<String>>,
transaction_type: TransactionType,
}
@@ -491,10 +497,16 @@ pub const FLUID_DATA_DESCRIPTOR_FOR_SAMSUNG_PAY: &str = "FID=COMMON.SAMSUNG.INAP
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
-pub struct GooglePayPaymentInformation {
+pub struct GooglePayTokenPaymentInformation {
fluid_data: FluidData,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GooglePayPaymentInformation {
+ tokenized_card: TokenizedCard,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SamsungPayTokenizedCard {
@@ -520,6 +532,7 @@ pub struct SamsungPayFluidDataValue {
#[serde(untagged)]
pub enum PaymentInformation {
Cards(Box<CardPaymentInformation>),
+ GooglePayToken(Box<GooglePayTokenPaymentInformation>),
GooglePay(Box<GooglePayPaymentInformation>),
ApplePay(Box<ApplePayPaymentInformation>),
ApplePayToken(Box<ApplePayTokenPaymentInformation>),
@@ -588,6 +601,8 @@ pub enum TransactionType {
ApplePay,
#[serde(rename = "1")]
SamsungPay,
+ #[serde(rename = "1")]
+ GooglePay,
}
impl From<PaymentSolution> for String {
@@ -1645,7 +1660,7 @@ impl
PaymentInformation::ApplePay(Box::new(ApplePayPaymentInformation {
tokenized_card: TokenizedCard {
number: apple_pay_data.application_primary_account_number,
- cryptogram: apple_pay_data.payment_data.online_payment_cryptogram,
+ cryptogram: Some(apple_pay_data.payment_data.online_payment_cryptogram),
transaction_type: TransactionType::ApplePay,
expiration_year,
expiration_month,
@@ -1707,7 +1722,7 @@ impl
let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
let payment_information =
- PaymentInformation::GooglePay(Box::new(GooglePayPaymentInformation {
+ PaymentInformation::GooglePayToken(Box::new(GooglePayTokenPaymentInformation {
fluid_data: FluidData {
value: Secret::from(
consts::BASE64_ENGINE.encode(google_pay_data.tokenization_data.token),
@@ -1736,6 +1751,92 @@ impl
}
}
+impl
+ TryFrom<(
+ &CybersourceRouterData<&PaymentsAuthorizeRouterData>,
+ Box<GooglePayDecryptedData>,
+ GooglePayWalletData,
+ )> for CybersourcePaymentsRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, google_pay_decrypted_data, google_pay_data): (
+ &CybersourceRouterData<&PaymentsAuthorizeRouterData>,
+ Box<GooglePayDecryptedData>,
+ GooglePayWalletData,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let email = item
+ .router_data
+ .get_billing_email()
+ .or(item.router_data.request.get_email())?;
+ let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
+ let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
+
+ let payment_information =
+ PaymentInformation::GooglePay(Box::new(GooglePayPaymentInformation {
+ tokenized_card: TokenizedCard {
+ number: Secret::new(
+ google_pay_decrypted_data
+ .payment_method_details
+ .pan
+ .get_card_no(),
+ ),
+ cryptogram: google_pay_decrypted_data.payment_method_details.cryptogram,
+ transaction_type: TransactionType::GooglePay,
+ expiration_year: Secret::new(
+ google_pay_decrypted_data
+ .payment_method_details
+ .expiration_year
+ .four_digits(),
+ ),
+ expiration_month: Secret::new(
+ google_pay_decrypted_data
+ .payment_method_details
+ .expiration_month
+ .two_digits(),
+ ),
+ },
+ }));
+ let processing_information = ProcessingInformation::try_from((
+ item,
+ Some(PaymentSolution::GooglePay),
+ Some(google_pay_data.info.card_network.clone()),
+ ))?;
+ let client_reference_information = ClientReferenceInformation::from(item);
+ let merchant_defined_information = item
+ .router_data
+ .request
+ .metadata
+ .clone()
+ .map(convert_metadata_to_merchant_defined_info);
+
+ let ucaf_collection_indicator =
+ match google_pay_data.info.card_network.to_lowercase().as_str() {
+ "mastercard" => Some("2".to_string()),
+ _ => None,
+ };
+
+ Ok(Self {
+ processing_information,
+ payment_information,
+ order_information,
+ client_reference_information,
+ consumer_authentication_information: Some(CybersourceConsumerAuthInformation {
+ ucaf_collection_indicator,
+ cavv: None,
+ ucaf_authentication_data: None,
+ xid: None,
+ directory_server_transaction_id: None,
+ specification_version: None,
+ pa_specification_version: None,
+ veres_enrolled: None,
+ }),
+ merchant_defined_information,
+ })
+ }
+}
+
impl
TryFrom<(
&CybersourceRouterData<&PaymentsAuthorizeRouterData>,
@@ -1850,6 +1951,9 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Cybersource"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => Err(
+ unimplemented_payment_method!("Google Pay", "Cybersource"),
+ )?,
},
None => {
let email = item
@@ -1917,7 +2021,31 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersour
}
}
WalletData::GooglePay(google_pay_data) => {
- Self::try_from((item, google_pay_data))
+ match item.router_data.payment_method_token.clone() {
+ Some(payment_method_token) => match payment_method_token {
+ PaymentMethodToken::GooglePayDecrypt(decrypt_data) => {
+ Self::try_from((item, decrypt_data, google_pay_data))
+ }
+ PaymentMethodToken::Token(_) => {
+ Err(unimplemented_payment_method!(
+ "Apple Pay",
+ "Manual",
+ "Cybersource"
+ ))?
+ }
+ PaymentMethodToken::PazeDecrypt(_) => {
+ Err(unimplemented_payment_method!("Paze", "Cybersource"))?
+ }
+ PaymentMethodToken::ApplePayDecrypt(_) => {
+ Err(unimplemented_payment_method!(
+ "Apple Pay",
+ "Simplified",
+ "Cybersource"
+ ))?
+ }
+ },
+ None => Self::try_from((item, google_pay_data)),
+ }
}
WalletData::SamsungPay(samsung_pay_data) => {
Self::try_from((item, samsung_pay_data))
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 51fc23eee41..115079c7d00 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -500,6 +500,9 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Fiuu"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Fiuu"))?
+ }
}
}
WalletData::AliPayQr(_)
diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs b/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
index d64c2ed8efd..f09d30efc9d 100644
--- a/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
@@ -437,7 +437,9 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest {
let payment_method_token = item.get_payment_method_token()?;
let customer_bank_account = match payment_method_token {
PaymentMethodToken::Token(token) => Ok(token),
- PaymentMethodToken::ApplePayDecrypt(_) | PaymentMethodToken::PazeDecrypt(_) => {
+ PaymentMethodToken::ApplePayDecrypt(_)
+ | PaymentMethodToken::PazeDecrypt(_)
+ | PaymentMethodToken::GooglePayDecrypt(_) => {
Err(errors::ConnectorError::NotImplemented(
"Setup Mandate flow for selected payment method through Gocardless".to_string(),
))
diff --git a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
index 5a641327c96..fa2cb46c7b7 100644
--- a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
@@ -175,6 +175,9 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Mollie"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Mollie"))?
+ }
}),
},
)))
diff --git a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
index 5abc93b3f88..ff3999aee64 100644
--- a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
@@ -272,6 +272,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for SquarePaymentsRequest {
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Square"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Square"))?
+ }
},
amount_money: SquarePaymentsAmountData {
amount: item.request.amount,
diff --git a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
index a675e3040e3..327785d2fc8 100644
--- a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
@@ -85,6 +85,9 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Stax"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Stax"))?
+ }
},
idempotency_id: Some(item.router_data.connector_request_reference_id.clone()),
})
@@ -105,6 +108,9 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Stax"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Stax"))?
+ }
},
idempotency_id: Some(item.router_data.connector_request_reference_id.clone()),
})
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
index 6ce9a4d7aa9..1a4d3ce8f9c 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
@@ -153,6 +153,9 @@ impl TryFrom<&SetupMandateRouterData> for WellsfargoZeroMandateRequest {
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Wellsfargo"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Wellsfargo"))?
+ }
},
None => (
PaymentInformation::ApplePayToken(Box::new(
@@ -1173,6 +1176,9 @@ impl TryFrom<&WellsfargoRouterData<&PaymentsAuthorizeRouterData>> for Wellsfargo
PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Wellsfargo"))?
}
+ PaymentMethodToken::GooglePayDecrypt(_) => Err(
+ unimplemented_payment_method!("Google Pay", "Wellsfargo"),
+ )?,
},
None => {
let email = item.router_data.request.get_email()?;
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 8e4c79a965e..322b4aa4525 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -226,6 +226,7 @@ pub struct AccessToken {
pub enum PaymentMethodToken {
Token(Secret<String>),
ApplePayDecrypt(Box<ApplePayPredecryptData>),
+ GooglePayDecrypt(Box<GooglePayDecryptedData>),
PazeDecrypt(Box<PazeDecryptedData>),
}
@@ -248,6 +249,27 @@ pub struct ApplePayCryptogramData {
pub eci_indicator: Option<String>,
}
+#[derive(Debug, Clone, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GooglePayDecryptedData {
+ pub message_expiration: String,
+ pub message_id: String,
+ #[serde(rename = "paymentMethod")]
+ pub payment_method_type: String,
+ pub payment_method_details: GooglePayPaymentMethodDetails,
+}
+
+#[derive(Debug, Clone, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GooglePayPaymentMethodDetails {
+ pub auth_method: common_enums::enums::GooglePayAuthMethod,
+ pub expiration_month: cards::CardExpirationMonth,
+ pub expiration_year: cards::CardExpirationYear,
+ pub pan: cards::CardNumber,
+ pub cryptogram: Option<Secret<String>>,
+ pub eci_indicator: Option<String>,
+}
+
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PazeDecryptedData {
diff --git a/crates/masking/src/secret.rs b/crates/masking/src/secret.rs
index 0bd28c3af92..7f7c18094a0 100644
--- a/crates/masking/src/secret.rs
+++ b/crates/masking/src/secret.rs
@@ -156,3 +156,10 @@ where
SecretValue::default().into()
}
}
+
+// Required by base64-serde to serialize Secret of Vec<u8> which contains the base64 decoded value
+impl AsRef<[u8]> for Secret<Vec<u8>> {
+ fn as_ref(&self) -> &[u8] {
+ self.peek().as_slice()
+ }
+}
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index db65482628f..7db0273d2e1 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -68,6 +68,7 @@ encoding_rs = "0.8.33"
error-stack = "0.4.1"
futures = "0.3.30"
hex = "0.4.3"
+hkdf = "0.12.4"
http = "0.2.12"
hyper = "0.14.28"
infer = "0.15.0"
@@ -104,6 +105,7 @@ serde_repr = "0.1.19"
serde_urlencoded = "0.7.1"
serde_with = "3.7.0"
sha1 = { version = "0.10.6" }
+sha2 = "0.10.8"
strum = { version = "0.26", features = ["derive"] }
tera = "1.19.1"
thiserror = "1.0.58"
diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index 7b74aca7647..f51a785eaa8 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -199,6 +199,24 @@ impl SecretsHandler for settings::PazeDecryptConfig {
}
}
+#[async_trait::async_trait]
+impl SecretsHandler for settings::GooglePayDecryptConfig {
+ async fn convert_to_raw_secret(
+ value: SecretStateContainer<Self, SecuredSecret>,
+ secret_management_client: &dyn SecretManagementInterface,
+ ) -> CustomResult<SecretStateContainer<Self, RawSecret>, SecretsManagementError> {
+ let google_pay_decrypt_keys = value.get_inner();
+
+ let google_pay_root_signing_keys = secret_management_client
+ .get_secret(google_pay_decrypt_keys.google_pay_root_signing_keys.clone())
+ .await?;
+
+ Ok(value.transition_state(|_| Self {
+ google_pay_root_signing_keys,
+ }))
+ }
+}
+
#[async_trait::async_trait]
impl SecretsHandler for settings::ApplepayMerchantConfigs {
async fn convert_to_raw_secret(
@@ -420,6 +438,20 @@ pub(crate) async fn fetch_raw_secrets(
None
};
+ #[allow(clippy::expect_used)]
+ let google_pay_decrypt_keys = if let Some(google_pay_keys) = conf.google_pay_decrypt_keys {
+ Some(
+ settings::GooglePayDecryptConfig::convert_to_raw_secret(
+ google_pay_keys,
+ secret_management_client,
+ )
+ .await
+ .expect("Failed to decrypt google pay decrypt configs"),
+ )
+ } else {
+ None
+ };
+
#[allow(clippy::expect_used)]
let applepay_merchant_configs = settings::ApplepayMerchantConfigs::convert_to_raw_secret(
conf.applepay_merchant_configs,
@@ -512,6 +544,7 @@ pub(crate) async fn fetch_raw_secrets(
payouts: conf.payouts,
applepay_decrypt_keys,
paze_decrypt_keys,
+ google_pay_decrypt_keys,
multiple_api_version_supported_connectors: conf.multiple_api_version_supported_connectors,
applepay_merchant_configs,
lock_settings: conf.lock_settings,
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index fa3d004aada..d721a4db967 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -99,6 +99,7 @@ pub struct Settings<S: SecretState> {
pub payout_method_filters: ConnectorFilters,
pub applepay_decrypt_keys: SecretStateContainer<ApplePayDecryptConfig, S>,
pub paze_decrypt_keys: Option<SecretStateContainer<PazeDecryptConfig, S>>,
+ pub google_pay_decrypt_keys: Option<SecretStateContainer<GooglePayDecryptConfig, S>>,
pub multiple_api_version_supported_connectors: MultipleApiVersionSupportedConnectors,
pub applepay_merchant_configs: SecretStateContainer<ApplepayMerchantConfigs, S>,
pub lock_settings: LockSettings,
@@ -758,6 +759,11 @@ pub struct PazeDecryptConfig {
pub paze_private_key_passphrase: Secret<String>,
}
+#[derive(Debug, Deserialize, Clone)]
+pub struct GooglePayDecryptConfig {
+ pub google_pay_root_signing_keys: Secret<String>,
+}
+
#[derive(Debug, Deserialize, Clone, Default)]
#[serde(default)]
pub struct LockerBasedRecipientConnectorList {
@@ -911,6 +917,11 @@ impl Settings<SecuredSecret> {
.map(|x| x.get_inner().validate())
.transpose()?;
+ self.google_pay_decrypt_keys
+ .as_ref()
+ .map(|x| x.get_inner().validate())
+ .transpose()?;
+
self.key_manager.get_inner().validate()?;
#[cfg(feature = "email")]
self.email
diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rs
index 7040998ccf0..11aa4e0cf51 100644
--- a/crates/router/src/configs/validations.rs
+++ b/crates/router/src/configs/validations.rs
@@ -257,6 +257,21 @@ impl super::settings::PazeDecryptConfig {
}
}
+impl super::settings::GooglePayDecryptConfig {
+ pub fn validate(&self) -> Result<(), ApplicationError> {
+ use common_utils::fp_utils::when;
+
+ when(
+ self.google_pay_root_signing_keys.is_default_or_empty(),
+ || {
+ Err(ApplicationError::InvalidConfigurationValueError(
+ "google_pay_root_signing_keys must not be empty".into(),
+ ))
+ },
+ )
+ }
+}
+
impl super::settings::KeyManagerConfig {
pub fn validate(&self) -> Result<(), ApplicationError> {
use common_utils::fp_utils::when;
diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs
index 00624ce0f9b..5dd6db5aa24 100644
--- a/crates/router/src/connector/braintree/transformers.rs
+++ b/crates/router/src/connector/braintree/transformers.rs
@@ -1598,6 +1598,9 @@ impl
types::PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Braintree"))?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Braintree"))?
+ }
},
transaction: transaction_body,
},
@@ -1699,6 +1702,9 @@ fn get_braintree_redirect_form(
types::PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Braintree"))?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Braintree"))?
+ }
},
bin: match card_details {
domain::PaymentMethodData::Card(card_details) => {
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index cd758fffb69..bb38ef74836 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -307,6 +307,9 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
types::PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Checkout"))?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Checkout"))?
+ }
},
})),
domain::WalletData::ApplePay(_) => {
@@ -336,6 +339,9 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
types::PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Checkout"))?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Checkout"))?
+ }
}
}
domain::WalletData::AliPayQr(_)
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index cd8ba814eb7..7e50f7f40e6 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -729,6 +729,9 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest {
types::PaymentMethodToken::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Payme"))?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(unimplemented_payment_method!("Google Pay", "Payme"))?
+ }
};
Ok(Self {
buyer_email,
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 48736c00e7d..60852779884 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1840,6 +1840,9 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
types::PaymentMethodToken::PazeDecrypt(_) => {
Err(crate::unimplemented_payment_method!("Paze", "Stripe"))?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(crate::unimplemented_payment_method!("Google Pay", "Stripe"))?
+ }
};
Some(StripePaymentMethodData::Wallet(
StripeWallet::ApplepayPayment(ApplepayPayment {
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index 96321d09794..b4c1c1c2c03 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -244,6 +244,60 @@ pub enum PazeDecryptionError {
CertificateParsingFailed,
}
+#[derive(Debug, thiserror::Error)]
+pub enum GooglePayDecryptionError {
+ #[error("Recipient ID not found")]
+ RecipientIdNotFound,
+ #[error("Invalid expiration time")]
+ InvalidExpirationTime,
+ #[error("Failed to base64 decode input data")]
+ Base64DecodingFailed,
+ #[error("Failed to decrypt input data")]
+ DecryptionFailed,
+ #[error("Failed to deserialize input data")]
+ DeserializationFailed,
+ #[error("Certificate parsing failed")]
+ CertificateParsingFailed,
+ #[error("Key deserialization failure")]
+ KeyDeserializationFailed,
+ #[error("Failed to derive a shared ephemeral key")]
+ DerivingSharedEphemeralKeyFailed,
+ #[error("Failed to derive a shared secret key")]
+ DerivingSharedSecretKeyFailed,
+ #[error("Failed to parse the tag")]
+ ParsingTagError,
+ #[error("HMAC verification failed")]
+ HmacVerificationFailed,
+ #[error("Failed to derive Elliptic Curve key")]
+ DerivingEcKeyFailed,
+ #[error("Failed to Derive Public key")]
+ DerivingPublicKeyFailed,
+ #[error("Failed to Derive Elliptic Curve group")]
+ DerivingEcGroupFailed,
+ #[error("Failed to allocate memory for big number")]
+ BigNumAllocationFailed,
+ #[error("Failed to get the ECDSA signature")]
+ EcdsaSignatureFailed,
+ #[error("Failed to verify the signature")]
+ SignatureVerificationFailed,
+ #[error("Invalid signature is provided")]
+ InvalidSignature,
+ #[error("Failed to parse the Signed Key")]
+ SignedKeyParsingFailure,
+ #[error("The Signed Key is expired")]
+ SignedKeyExpired,
+ #[error("Failed to parse the ECDSA signature")]
+ EcdsaSignatureParsingFailed,
+ #[error("Invalid intermediate signature is provided")]
+ InvalidIntermediateSignature,
+ #[error("Invalid protocol version")]
+ InvalidProtocolVersion,
+ #[error("Decrypted Token has expired")]
+ DecryptedTokenExpired,
+ #[error("Failed to parse the given value")]
+ ParsingFailed,
+}
+
#[cfg(feature = "detailed_errors")]
pub mod error_stack_parsing {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e9d3c013789..5b8988dace0 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3080,7 +3080,61 @@ where
paze_decrypted_data,
))))
}
- _ => Ok(None),
+ TokenizationAction::DecryptGooglePayToken(payment_processing_details) => {
+ let google_pay_data = match payment_data.get_payment_method_data() {
+ Some(domain::PaymentMethodData::Wallet(domain::WalletData::GooglePay(
+ wallet_data,
+ ))) => {
+ let decryptor = helpers::GooglePayTokenDecryptor::new(
+ payment_processing_details
+ .google_pay_root_signing_keys
+ .clone(),
+ payment_processing_details.google_pay_recipient_id.clone(),
+ payment_processing_details.google_pay_private_key.clone(),
+ )
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("failed to create google pay token decryptor")?;
+
+ // should_verify_token is set to false to disable verification of token
+ Some(
+ decryptor
+ .decrypt_token(wallet_data.tokenization_data.token.clone(), false)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("failed to decrypt google pay token")?,
+ )
+ }
+ Some(payment_method_data) => {
+ logger::info!(
+ "Invalid payment_method_data found for Google Pay Decrypt Flow: {:?}",
+ payment_method_data.get_payment_method()
+ );
+ None
+ }
+ None => {
+ logger::info!("No payment_method_data found for Google Pay Decrypt Flow");
+ None
+ }
+ };
+
+ let google_pay_predecrypt = google_pay_data
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("failed to get GooglePayDecryptedData in response")?;
+
+ Ok(Some(PaymentMethodToken::GooglePayDecrypt(Box::new(
+ google_pay_predecrypt,
+ ))))
+ }
+ TokenizationAction::ConnectorToken(_) => {
+ logger::info!("Invalid tokenization action found for decryption flow: ConnectorToken",);
+ Ok(None)
+ }
+ token_action => {
+ logger::info!(
+ "Invalid tokenization action found for decryption flow: {:?}",
+ token_action
+ );
+ Ok(None)
+ }
}
}
@@ -4052,6 +4106,64 @@ fn check_apple_pay_metadata(
})
}
+fn get_google_pay_connector_wallet_details(
+ state: &SessionState,
+ merchant_connector_account: &helpers::MerchantConnectorAccountType,
+) -> Option<GooglePayPaymentProcessingDetails> {
+ let google_pay_root_signing_keys =
+ state
+ .conf
+ .google_pay_decrypt_keys
+ .as_ref()
+ .map(|google_pay_keys| {
+ google_pay_keys
+ .get_inner()
+ .google_pay_root_signing_keys
+ .clone()
+ });
+ match (
+ google_pay_root_signing_keys,
+ merchant_connector_account.get_connector_wallets_details(),
+ ) {
+ (Some(google_pay_root_signing_keys), Some(wallet_details)) => {
+ let google_pay_wallet_details = wallet_details
+ .parse_value::<api_models::payments::GooglePayWalletDetails>(
+ "GooglePayWalletDetails",
+ )
+ .map_err(|error| {
+ logger::warn!(?error, "Failed to Parse Value to GooglePayWalletDetails")
+ });
+
+ google_pay_wallet_details
+ .ok()
+ .map(
+ |google_pay_wallet_details| {
+ match google_pay_wallet_details
+ .google_pay
+ .provider_details {
+ api_models::payments::GooglePayProviderDetails::GooglePayMerchantDetails(merchant_details) => {
+ GooglePayPaymentProcessingDetails {
+ google_pay_private_key: merchant_details
+ .merchant_info
+ .tokenization_specification
+ .parameters
+ .private_key,
+ google_pay_root_signing_keys,
+ google_pay_recipient_id: merchant_details
+ .merchant_info
+ .tokenization_specification
+ .parameters
+ .recipient_id,
+ }
+ }
+ }
+ }
+ )
+ }
+ _ => None,
+ }
+}
+
fn is_payment_method_type_allowed_for_connector(
current_pm_type: Option<storage::enums::PaymentMethodType>,
pm_type_filter: Option<PaymentMethodTypeTokenFilter>,
@@ -4066,6 +4178,7 @@ fn is_payment_method_type_allowed_for_connector(
}
}
+#[allow(clippy::too_many_arguments)]
async fn decide_payment_method_tokenize_action(
state: &SessionState,
connector_name: &str,
@@ -4074,6 +4187,7 @@ async fn decide_payment_method_tokenize_action(
is_connector_tokenization_enabled: bool,
apple_pay_flow: Option<domain::ApplePayFlow>,
payment_method_type: Option<storage_enums::PaymentMethodType>,
+ merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<TokenizationAction> {
if let Some(storage_enums::PaymentMethodType::Paze) = payment_method_type {
// Paze generates a one time use network token which should not be tokenized in the connector or router.
@@ -4090,6 +4204,20 @@ async fn decide_payment_method_tokenize_action(
None => Err(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to fetch Paze configs"),
}
+ } else if let Some(storage_enums::PaymentMethodType::GooglePay) = payment_method_type {
+ let google_pay_details =
+ get_google_pay_connector_wallet_details(state, merchant_connector_account);
+
+ match google_pay_details {
+ Some(wallet_details) => Ok(TokenizationAction::DecryptGooglePayToken(wallet_details)),
+ None => {
+ if is_connector_tokenization_enabled {
+ Ok(TokenizationAction::TokenizeInConnectorAndRouter)
+ } else {
+ Ok(TokenizationAction::TokenizeInRouter)
+ }
+ }
+ }
} else {
match pm_parent_token {
None => Ok(match (is_connector_tokenization_enabled, apple_pay_flow) {
@@ -4154,6 +4282,13 @@ pub struct PazePaymentProcessingDetails {
pub paze_private_key_passphrase: Secret<String>,
}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GooglePayPaymentProcessingDetails {
+ pub google_pay_private_key: Secret<String>,
+ pub google_pay_root_signing_keys: Secret<String>,
+ pub google_pay_recipient_id: Option<Secret<String>>,
+}
+
#[derive(Clone, Debug)]
pub enum TokenizationAction {
TokenizeInRouter,
@@ -4164,6 +4299,7 @@ pub enum TokenizationAction {
DecryptApplePayToken(payments_api::PaymentProcessingDetails),
TokenizeInConnectorAndApplepayPreDecrypt(payments_api::PaymentProcessingDetails),
DecryptPazeToken(PazePaymentProcessingDetails),
+ DecryptGooglePayToken(GooglePayPaymentProcessingDetails),
}
#[cfg(feature = "v2")]
@@ -4254,6 +4390,7 @@ where
is_connector_tokenization_enabled,
apple_pay_flow,
payment_method_type,
+ merchant_connector_account,
)
.await?;
@@ -4312,6 +4449,11 @@ where
TokenizationAction::DecryptPazeToken(paze_payment_processing_details) => {
TokenizationAction::DecryptPazeToken(paze_payment_processing_details)
}
+ TokenizationAction::DecryptGooglePayToken(
+ google_pay_payment_processing_details,
+ ) => {
+ TokenizationAction::DecryptGooglePayToken(google_pay_payment_processing_details)
+ }
};
(payment_data.to_owned(), connector_tokenization_action)
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 0d7a3b57fc1..56667b0517f 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -47,6 +47,7 @@ use openssl::{
};
#[cfg(feature = "v2")]
use redis_interface::errors::RedisError;
+use ring::hmac;
use router_env::{instrument, logger, tracing};
use uuid::Uuid;
use x509_parser::parse_x509_certificate;
@@ -5073,6 +5074,9 @@ async fn get_and_merge_apple_pay_metadata(
paze: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.paze.clone()),
+ google_pay: connector_wallets_details_optional
+ .as_ref()
+ .and_then(|d| d.google_pay.clone()),
}
}
api_models::payments::ApplepaySessionTokenMetadata::ApplePay(apple_pay_metadata) => {
@@ -5091,6 +5095,9 @@ async fn get_and_merge_apple_pay_metadata(
paze: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.paze.clone()),
+ google_pay: connector_wallets_details_optional
+ .as_ref()
+ .and_then(|d| d.google_pay.clone()),
}
}
};
@@ -5427,6 +5434,543 @@ impl ApplePayData {
}
}
+pub(crate) const SENDER_ID: &[u8] = b"Google";
+pub(crate) const PROTOCOL: &str = "ECv2";
+
+// Structs for keys and the main decryptor
+pub struct GooglePayTokenDecryptor {
+ root_signing_keys: Vec<GooglePayRootSigningKey>,
+ recipient_id: Option<masking::Secret<String>>,
+ private_key: PKey<openssl::pkey::Private>,
+}
+
+#[derive(Debug, Clone, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct EncryptedData {
+ signature: String,
+ intermediate_signing_key: IntermediateSigningKey,
+ protocol_version: GooglePayProtocolVersion,
+ #[serde(with = "common_utils::custom_serde::json_string")]
+ signed_message: GooglePaySignedMessage,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GooglePaySignedMessage {
+ #[serde(with = "common_utils::Base64Serializer")]
+ encrypted_message: masking::Secret<Vec<u8>>,
+ #[serde(with = "common_utils::Base64Serializer")]
+ ephemeral_public_key: masking::Secret<Vec<u8>>,
+ #[serde(with = "common_utils::Base64Serializer")]
+ tag: masking::Secret<Vec<u8>>,
+}
+
+#[derive(Debug, Clone, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct IntermediateSigningKey {
+ signed_key: masking::Secret<String>,
+ signatures: Vec<masking::Secret<String>>,
+}
+
+#[derive(Debug, Clone, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GooglePaySignedKey {
+ key_value: masking::Secret<String>,
+ key_expiration: String,
+}
+
+#[derive(Debug, Clone, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GooglePayRootSigningKey {
+ key_value: masking::Secret<String>,
+ key_expiration: String,
+ protocol_version: GooglePayProtocolVersion,
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)]
+pub enum GooglePayProtocolVersion {
+ #[serde(rename = "ECv2")]
+ EcProtocolVersion2,
+}
+
+// Check expiration date validity
+fn check_expiration_date_is_valid(
+ expiration: &str,
+) -> CustomResult<bool, errors::GooglePayDecryptionError> {
+ let expiration_ms = expiration
+ .parse::<i128>()
+ .change_context(errors::GooglePayDecryptionError::InvalidExpirationTime)?;
+ // convert milliseconds to nanoseconds (1 millisecond = 1_000_000 nanoseconds) to create OffsetDateTime
+ let expiration_time =
+ time::OffsetDateTime::from_unix_timestamp_nanos(expiration_ms * 1_000_000)
+ .change_context(errors::GooglePayDecryptionError::InvalidExpirationTime)?;
+ let now = time::OffsetDateTime::now_utc();
+
+ Ok(expiration_time > now)
+}
+
+// Construct little endian format of u32
+fn get_little_endian_format(number: u32) -> Vec<u8> {
+ number.to_le_bytes().to_vec()
+}
+
+// Filter and parse the root signing keys based on protocol version and expiration time
+fn filter_root_signing_keys(
+ root_signing_keys: Vec<GooglePayRootSigningKey>,
+) -> CustomResult<Vec<GooglePayRootSigningKey>, errors::GooglePayDecryptionError> {
+ let filtered_root_signing_keys = root_signing_keys
+ .iter()
+ .filter(|key| {
+ key.protocol_version == GooglePayProtocolVersion::EcProtocolVersion2
+ && matches!(
+ check_expiration_date_is_valid(&key.key_expiration).inspect_err(
+ |err| logger::warn!(
+ "Failed to check expirattion due to invalid format: {:?}",
+ err
+ )
+ ),
+ Ok(true)
+ )
+ })
+ .cloned()
+ .collect::<Vec<GooglePayRootSigningKey>>();
+
+ logger::info!(
+ "Filtered {} out of {} root signing keys",
+ filtered_root_signing_keys.len(),
+ root_signing_keys.len()
+ );
+
+ Ok(filtered_root_signing_keys)
+}
+
+impl GooglePayTokenDecryptor {
+ pub fn new(
+ root_keys: masking::Secret<String>,
+ recipient_id: Option<masking::Secret<String>>,
+ private_key: masking::Secret<String>,
+ ) -> CustomResult<Self, errors::GooglePayDecryptionError> {
+ // base64 decode the private key
+ let decoded_key = BASE64_ENGINE
+ .decode(private_key.expose())
+ .change_context(errors::GooglePayDecryptionError::Base64DecodingFailed)?;
+ // create a private key from the decoded key
+ let private_key = PKey::private_key_from_pkcs8(&decoded_key)
+ .change_context(errors::GooglePayDecryptionError::KeyDeserializationFailed)
+ .attach_printable("cannot convert private key from decode_key")?;
+
+ // parse the root signing keys
+ let root_keys_vector: Vec<GooglePayRootSigningKey> = root_keys
+ .expose()
+ .parse_struct("GooglePayRootSigningKey")
+ .change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
+
+ // parse and filter the root signing keys by protocol version
+ let filtered_root_signing_keys = filter_root_signing_keys(root_keys_vector)?;
+
+ Ok(Self {
+ root_signing_keys: filtered_root_signing_keys,
+ recipient_id,
+ private_key,
+ })
+ }
+
+ // Decrypt the Google pay token
+ pub fn decrypt_token(
+ &self,
+ data: String,
+ should_verify_signature: bool,
+ ) -> CustomResult<
+ hyperswitch_domain_models::router_data::GooglePayDecryptedData,
+ errors::GooglePayDecryptionError,
+ > {
+ // parse the encrypted data
+ let encrypted_data: EncryptedData = data
+ .parse_struct("EncryptedData")
+ .change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
+
+ // verify the signature if required
+ if should_verify_signature {
+ self.verify_signature(&encrypted_data)?;
+ }
+
+ let ephemeral_public_key = encrypted_data.signed_message.ephemeral_public_key.peek();
+ let tag = encrypted_data.signed_message.tag.peek();
+ let encrypted_message = encrypted_data.signed_message.encrypted_message.peek();
+
+ // derive the shared key
+ let shared_key = self.get_shared_key(ephemeral_public_key)?;
+
+ // derive the symmetric encryption key and MAC key
+ let derived_key = self.derive_key(ephemeral_public_key, &shared_key)?;
+ // First 32 bytes for AES-256 and Remaining bytes for HMAC
+ let (symmetric_encryption_key, mac_key) = derived_key
+ .split_at_checked(32)
+ .ok_or(errors::GooglePayDecryptionError::ParsingFailed)?;
+
+ // verify the HMAC of the message
+ self.verify_hmac(mac_key, tag, encrypted_message)?;
+
+ // decrypt the message
+ let decrypted = self.decrypt_message(symmetric_encryption_key, encrypted_message)?;
+
+ // parse the decrypted data
+ let decrypted_data: hyperswitch_domain_models::router_data::GooglePayDecryptedData =
+ decrypted
+ .parse_struct("GooglePayDecryptedData")
+ .change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
+
+ // check the expiration date of the decrypted data
+ if matches!(
+ check_expiration_date_is_valid(&decrypted_data.message_expiration),
+ Ok(true)
+ ) {
+ Ok(decrypted_data)
+ } else {
+ Err(errors::GooglePayDecryptionError::DecryptedTokenExpired.into())
+ }
+ }
+
+ // Verify the signature of the token
+ fn verify_signature(
+ &self,
+ encrypted_data: &EncryptedData,
+ ) -> CustomResult<(), errors::GooglePayDecryptionError> {
+ // check the protocol version
+ if encrypted_data.protocol_version != GooglePayProtocolVersion::EcProtocolVersion2 {
+ return Err(errors::GooglePayDecryptionError::InvalidProtocolVersion.into());
+ }
+
+ // verify the intermediate signing key
+ self.verify_intermediate_signing_key(encrypted_data)?;
+ // validate and fetch the signed key
+ let signed_key = self.validate_signed_key(&encrypted_data.intermediate_signing_key)?;
+ // verify the signature of the token
+ self.verify_message_signature(encrypted_data, &signed_key)
+ }
+
+ // Verify the intermediate signing key
+ fn verify_intermediate_signing_key(
+ &self,
+ encrypted_data: &EncryptedData,
+ ) -> CustomResult<(), errors::GooglePayDecryptionError> {
+ let mut signatrues: Vec<openssl::ecdsa::EcdsaSig> = Vec::new();
+
+ // decode and parse the signatures
+ for signature in encrypted_data.intermediate_signing_key.signatures.iter() {
+ let signature = BASE64_ENGINE
+ .decode(signature.peek())
+ .change_context(errors::GooglePayDecryptionError::Base64DecodingFailed)?;
+ let ecdsa_signature = openssl::ecdsa::EcdsaSig::from_der(&signature)
+ .change_context(errors::GooglePayDecryptionError::EcdsaSignatureParsingFailed)?;
+ signatrues.push(ecdsa_signature);
+ }
+
+ // get the sender id i.e. Google
+ let sender_id = String::from_utf8(SENDER_ID.to_vec())
+ .change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
+
+ // construct the signed data
+ let signed_data = self.construct_signed_data_for_intermediate_signing_key_verification(
+ &sender_id,
+ PROTOCOL,
+ encrypted_data.intermediate_signing_key.signed_key.peek(),
+ )?;
+
+ // check if any of the signatures are valid for any of the root signing keys
+ for key in self.root_signing_keys.iter() {
+ // decode and create public key
+ let public_key = self
+ .load_public_key(key.key_value.peek())
+ .change_context(errors::GooglePayDecryptionError::DerivingPublicKeyFailed)?;
+ // fetch the ec key from public key
+ let ec_key = public_key
+ .ec_key()
+ .change_context(errors::GooglePayDecryptionError::DerivingEcKeyFailed)?;
+
+ // hash the signed data
+ let message_hash = openssl::sha::sha256(&signed_data);
+
+ // verify if any of the signatures is valid against the given key
+ for signature in signatrues.iter() {
+ let result = signature.verify(&message_hash, &ec_key).change_context(
+ errors::GooglePayDecryptionError::SignatureVerificationFailed,
+ )?;
+
+ if result {
+ return Ok(());
+ }
+ }
+ }
+
+ Err(errors::GooglePayDecryptionError::InvalidIntermediateSignature.into())
+ }
+
+ // Construct signed data for intermediate signing key verification
+ fn construct_signed_data_for_intermediate_signing_key_verification(
+ &self,
+ sender_id: &str,
+ protocol_version: &str,
+ signed_key: &str,
+ ) -> CustomResult<Vec<u8>, errors::GooglePayDecryptionError> {
+ let length_of_sender_id = u32::try_from(sender_id.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+ let length_of_protocol_version = u32::try_from(protocol_version.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+ let length_of_signed_key = u32::try_from(signed_key.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+
+ let mut signed_data: Vec<u8> = Vec::new();
+ signed_data.append(&mut get_little_endian_format(length_of_sender_id));
+ signed_data.append(&mut sender_id.as_bytes().to_vec());
+ signed_data.append(&mut get_little_endian_format(length_of_protocol_version));
+ signed_data.append(&mut protocol_version.as_bytes().to_vec());
+ signed_data.append(&mut get_little_endian_format(length_of_signed_key));
+ signed_data.append(&mut signed_key.as_bytes().to_vec());
+
+ Ok(signed_data)
+ }
+
+ // Validate and parse signed key
+ fn validate_signed_key(
+ &self,
+ intermediate_signing_key: &IntermediateSigningKey,
+ ) -> CustomResult<GooglePaySignedKey, errors::GooglePayDecryptionError> {
+ let signed_key: GooglePaySignedKey = intermediate_signing_key
+ .signed_key
+ .clone()
+ .expose()
+ .parse_struct("GooglePaySignedKey")
+ .change_context(errors::GooglePayDecryptionError::SignedKeyParsingFailure)?;
+ if !matches!(
+ check_expiration_date_is_valid(&signed_key.key_expiration),
+ Ok(true)
+ ) {
+ return Err(errors::GooglePayDecryptionError::SignedKeyExpired)?;
+ }
+ Ok(signed_key)
+ }
+
+ // Verify the signed message
+ fn verify_message_signature(
+ &self,
+ encrypted_data: &EncryptedData,
+ signed_key: &GooglePaySignedKey,
+ ) -> CustomResult<(), errors::GooglePayDecryptionError> {
+ // create a public key from the intermediate signing key
+ let public_key = self.load_public_key(signed_key.key_value.peek())?;
+ // base64 decode the signature
+ let signature = BASE64_ENGINE
+ .decode(&encrypted_data.signature)
+ .change_context(errors::GooglePayDecryptionError::Base64DecodingFailed)?;
+
+ // parse the signature using ECDSA
+ let ecdsa_signature = openssl::ecdsa::EcdsaSig::from_der(&signature)
+ .change_context(errors::GooglePayDecryptionError::EcdsaSignatureFailed)?;
+
+ // get the EC key from the public key
+ let ec_key = public_key
+ .ec_key()
+ .change_context(errors::GooglePayDecryptionError::DerivingEcKeyFailed)?;
+
+ // get the sender id i.e. Google
+ let sender_id = String::from_utf8(SENDER_ID.to_vec())
+ .change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
+
+ // serialize the signed message to string
+ let signed_message = serde_json::to_string(&encrypted_data.signed_message)
+ .change_context(errors::GooglePayDecryptionError::SignedKeyParsingFailure)?;
+
+ // construct the signed data
+ let signed_data = self.construct_signed_data_for_signature_verification(
+ &sender_id,
+ PROTOCOL,
+ &signed_message,
+ )?;
+
+ // hash the signed data
+ let message_hash = openssl::sha::sha256(&signed_data);
+
+ // verify the signature
+ let result = ecdsa_signature
+ .verify(&message_hash, &ec_key)
+ .change_context(errors::GooglePayDecryptionError::SignatureVerificationFailed)?;
+
+ if result {
+ Ok(())
+ } else {
+ Err(errors::GooglePayDecryptionError::InvalidSignature)?
+ }
+ }
+
+ // Fetch the public key
+ fn load_public_key(
+ &self,
+ key: &str,
+ ) -> CustomResult<PKey<openssl::pkey::Public>, errors::GooglePayDecryptionError> {
+ // decode the base64 string
+ let der_data = BASE64_ENGINE
+ .decode(key)
+ .change_context(errors::GooglePayDecryptionError::Base64DecodingFailed)?;
+
+ // parse the DER-encoded data as an EC public key
+ let ec_key = openssl::ec::EcKey::public_key_from_der(&der_data)
+ .change_context(errors::GooglePayDecryptionError::DerivingEcKeyFailed)?;
+
+ // wrap the EC key in a PKey (a more general-purpose public key type in OpenSSL)
+ let public_key = PKey::from_ec_key(ec_key)
+ .change_context(errors::GooglePayDecryptionError::DerivingPublicKeyFailed)?;
+
+ Ok(public_key)
+ }
+
+ // Construct signed data for signature verification
+ fn construct_signed_data_for_signature_verification(
+ &self,
+ sender_id: &str,
+ protocol_version: &str,
+ signed_key: &str,
+ ) -> CustomResult<Vec<u8>, errors::GooglePayDecryptionError> {
+ let recipient_id = self
+ .recipient_id
+ .clone()
+ .ok_or(errors::GooglePayDecryptionError::RecipientIdNotFound)?
+ .expose();
+ let length_of_sender_id = u32::try_from(sender_id.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+ let length_of_recipient_id = u32::try_from(recipient_id.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+ let length_of_protocol_version = u32::try_from(protocol_version.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+ let length_of_signed_key = u32::try_from(signed_key.len())
+ .change_context(errors::GooglePayDecryptionError::ParsingFailed)?;
+
+ let mut signed_data: Vec<u8> = Vec::new();
+ signed_data.append(&mut get_little_endian_format(length_of_sender_id));
+ signed_data.append(&mut sender_id.as_bytes().to_vec());
+ signed_data.append(&mut get_little_endian_format(length_of_recipient_id));
+ signed_data.append(&mut recipient_id.as_bytes().to_vec());
+ signed_data.append(&mut get_little_endian_format(length_of_protocol_version));
+ signed_data.append(&mut protocol_version.as_bytes().to_vec());
+ signed_data.append(&mut get_little_endian_format(length_of_signed_key));
+ signed_data.append(&mut signed_key.as_bytes().to_vec());
+
+ Ok(signed_data)
+ }
+
+ // Derive a shared key using ECDH
+ fn get_shared_key(
+ &self,
+ ephemeral_public_key_bytes: &[u8],
+ ) -> CustomResult<Vec<u8>, errors::GooglePayDecryptionError> {
+ let group = openssl::ec::EcGroup::from_curve_name(openssl::nid::Nid::X9_62_PRIME256V1)
+ .change_context(errors::GooglePayDecryptionError::DerivingEcGroupFailed)?;
+
+ let mut big_num_context = openssl::bn::BigNumContext::new()
+ .change_context(errors::GooglePayDecryptionError::BigNumAllocationFailed)?;
+
+ let ec_key = openssl::ec::EcPoint::from_bytes(
+ &group,
+ ephemeral_public_key_bytes,
+ &mut big_num_context,
+ )
+ .change_context(errors::GooglePayDecryptionError::DerivingEcKeyFailed)?;
+
+ // create an ephemeral public key from the given bytes
+ let ephemeral_public_key = openssl::ec::EcKey::from_public_key(&group, &ec_key)
+ .change_context(errors::GooglePayDecryptionError::DerivingPublicKeyFailed)?;
+
+ // wrap the public key in a PKey
+ let ephemeral_pkey = PKey::from_ec_key(ephemeral_public_key)
+ .change_context(errors::GooglePayDecryptionError::DerivingPublicKeyFailed)?;
+
+ // perform ECDH to derive the shared key
+ let mut deriver = Deriver::new(&self.private_key)
+ .change_context(errors::GooglePayDecryptionError::DerivingSharedSecretKeyFailed)?;
+
+ deriver
+ .set_peer(&ephemeral_pkey)
+ .change_context(errors::GooglePayDecryptionError::DerivingSharedSecretKeyFailed)?;
+
+ let shared_key = deriver
+ .derive_to_vec()
+ .change_context(errors::GooglePayDecryptionError::DerivingSharedSecretKeyFailed)?;
+
+ Ok(shared_key)
+ }
+
+ // Derive symmetric key and MAC key using HKDF
+ fn derive_key(
+ &self,
+ ephemeral_public_key_bytes: &[u8],
+ shared_key: &[u8],
+ ) -> CustomResult<Vec<u8>, errors::GooglePayDecryptionError> {
+ // concatenate ephemeral public key and shared key
+ let input_key_material = [ephemeral_public_key_bytes, shared_key].concat();
+
+ // initialize HKDF with SHA-256 as the hash function
+ // Salt is not provided as per the Google Pay documentation
+ // https://developers.google.com/pay/api/android/guides/resources/payment-data-cryptography#encrypt-spec
+ let hkdf: ::hkdf::Hkdf<sha2::Sha256> = ::hkdf::Hkdf::new(None, &input_key_material);
+
+ // derive 64 bytes for the output key (symmetric encryption + MAC key)
+ let mut output_key = vec![0u8; 64];
+ hkdf.expand(SENDER_ID, &mut output_key).map_err(|err| {
+ logger::error!(
+ "Failed to derive the shared ephemeral key for Google Pay decryption flow: {:?}",
+ err
+ );
+ report!(errors::GooglePayDecryptionError::DerivingSharedEphemeralKeyFailed)
+ })?;
+
+ Ok(output_key)
+ }
+
+ // Verify the Hmac key
+ // https://developers.google.com/pay/api/android/guides/resources/payment-data-cryptography#encrypt-spec
+ fn verify_hmac(
+ &self,
+ mac_key: &[u8],
+ tag: &[u8],
+ encrypted_message: &[u8],
+ ) -> CustomResult<(), errors::GooglePayDecryptionError> {
+ let hmac_key = hmac::Key::new(hmac::HMAC_SHA256, mac_key);
+ hmac::verify(&hmac_key, encrypted_message, tag)
+ .change_context(errors::GooglePayDecryptionError::HmacVerificationFailed)
+ }
+
+ // Method to decrypt the AES-GCM encrypted message
+ fn decrypt_message(
+ &self,
+ symmetric_key: &[u8],
+ encrypted_message: &[u8],
+ ) -> CustomResult<Vec<u8>, errors::GooglePayDecryptionError> {
+ //initialization vector IV is typically used in AES-GCM (Galois/Counter Mode) encryption for randomizing the encryption process.
+ // zero iv is being passed as specified in Google Pay documentation
+ // https://developers.google.com/pay/api/android/guides/resources/payment-data-cryptography#decrypt-token
+ let iv = [0u8; 16];
+
+ // extract the tag from the end of the encrypted message
+ let tag = encrypted_message
+ .get(encrypted_message.len() - 16..)
+ .ok_or(errors::GooglePayDecryptionError::ParsingTagError)?;
+
+ // decrypt the message using AES-256-CTR
+ let cipher = Cipher::aes_256_ctr();
+ let decrypted_data = decrypt_aead(
+ cipher,
+ symmetric_key,
+ Some(&iv),
+ &[],
+ encrypted_message,
+ tag,
+ )
+ .change_context(errors::GooglePayDecryptionError::DecryptionFailed)?;
+
+ Ok(decrypted_data)
+ }
+}
+
pub fn decrypt_paze_token(
paze_wallet_data: PazeWalletData,
paze_private_key: masking::Secret<String>,
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 84f848ef0ab..ea81b8cb16f 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -139,6 +139,11 @@ where
message: "Paze Decrypt token is not supported".to_string(),
})?
}
+ types::PaymentMethodToken::GooglePayDecrypt(_) => {
+ Err(errors::ApiErrorResponse::NotSupported {
+ message: "Google Pay Decrypt token is not supported".to_string(),
+ })?
+ }
};
Some((connector_name, token))
} else {
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 5baca7bb55a..c11d54fc298 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -44,7 +44,8 @@ pub use hyperswitch_domain_models::{
router_data::{
AccessToken, AdditionalPaymentMethodConnectorResponse, ApplePayCryptogramData,
ApplePayPredecryptData, ConnectorAuthType, ConnectorResponseData, ErrorResponse,
- PaymentMethodBalance, PaymentMethodToken, RecurringMandatePaymentData, RouterData,
+ GooglePayDecryptedData, GooglePayPaymentMethodDetails, PaymentMethodBalance,
+ PaymentMethodToken, RecurringMandatePaymentData, RouterData,
},
router_data_v2::{
AccessTokenFlowData, DisputesFlowData, ExternalAuthenticationFlowData, FilesFlowData,
|
feat
|
google pay decrypt flow (#6991)
|
d5710a372f8c0108f0a73cf601e4bb4c1431ef0d
|
2024-12-19 19:42:15
|
github-actions
|
chore(version): 2024.12.19.1
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48f61fc3f50..cf6a551700f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,28 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.12.19.1
+
+### Features
+
+- **core:** Added customer phone_number and email to session token response for click to pay ([#6863](https://github.com/juspay/hyperswitch/pull/6863)) ([`092c79e`](https://github.com/juspay/hyperswitch/commit/092c79ec40c6af47a5d6654129411300e42eac56))
+- **klarna:** Klarna Kustom Checkout Integration ([#6839](https://github.com/juspay/hyperswitch/pull/6839)) ([`c525c9f`](https://github.com/juspay/hyperswitch/commit/c525c9f4c9d23802989bc594a4acd26c7d7cd27d))
+- **payment_methods:** Add support to pass apple pay recurring details to obtain apple pay merchant token ([#6770](https://github.com/juspay/hyperswitch/pull/6770)) ([`6074249`](https://github.com/juspay/hyperswitch/commit/607424992af4196f5a3e01477f64d794b3594a47))
+- **payments:** [Payment links] Add config for changing button text for payment links ([#6860](https://github.com/juspay/hyperswitch/pull/6860)) ([`46aad50`](https://github.com/juspay/hyperswitch/commit/46aad503b04efe60c54bbf4d5d5122696d9b1157))
+- **users:** Handle email url for users in different tenancies ([#6809](https://github.com/juspay/hyperswitch/pull/6809)) ([`839e69d`](https://github.com/juspay/hyperswitch/commit/839e69df241cf0eb2495f0ad3fc19cf32632c741))
+
+### Bug Fixes
+
+- **connector:** [UNIFIED_AUTHENTICATION_SERVICE] change url path to `pre_authentication_processing` in pre-auth flow ([#6885](https://github.com/juspay/hyperswitch/pull/6885)) ([`f219b74`](https://github.com/juspay/hyperswitch/commit/f219b74cb6a100e07084afe6d9242a88f7127971))
+
+### Refactors
+
+- **users:** Move roles schema to global interface ([#6862](https://github.com/juspay/hyperswitch/pull/6862)) ([`2d8af88`](https://github.com/juspay/hyperswitch/commit/2d8af882046bbfe309c5dbb5be9bfbd43e0c3831))
+
+**Full Changelog:** [`2024.12.19.0...2024.12.19.1`](https://github.com/juspay/hyperswitch/compare/2024.12.19.0...2024.12.19.1)
+
+- - -
+
## 2024.12.19.0
### Refactors
|
chore
|
2024.12.19.1
|
b1ae981f82697f788d64bed146fd989a6eca16fe
|
2023-07-11 10:01:13
|
Sanchith Hegde
|
fix(middleware): inlcude `x-request-id` header in `access-control-expose-headers` header value (#1673)
| false
|
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 34550a3a52f..c41898b5ca2 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -222,7 +222,7 @@ pub fn get_application_builder(
errors::error_handlers::custom_error_handlers,
))
.wrap(middleware::default_response_headers())
- .wrap(cors::cors())
.wrap(middleware::RequestId)
+ .wrap(cors::cors())
.wrap(router_env::tracing_actix_web::TracingLogger::default())
}
|
fix
|
inlcude `x-request-id` header in `access-control-expose-headers` header value (#1673)
|
aefe6184ec3e3156877c72988ca0f92454a47e7d
|
2023-12-26 17:37:27
|
Mani Chandra
|
feat(customers): Add JWT Authentication for `/customers` APIs (#3179)
| false
|
diff --git a/crates/api_models/src/user_role.rs b/crates/api_models/src/user_role.rs
index 735cd240b6e..72fca2b2f08 100644
--- a/crates/api_models/src/user_role.rs
+++ b/crates/api_models/src/user_role.rs
@@ -32,6 +32,8 @@ pub enum Permission {
DisputeWrite,
MandateRead,
MandateWrite,
+ CustomerRead,
+ CustomerWrite,
FileRead,
FileWrite,
Analytics,
@@ -53,6 +55,7 @@ pub enum PermissionModule {
Routing,
Analytics,
Mandates,
+ Customer,
Disputes,
Files,
ThreeDsDecisionManager,
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index cfc37cbdbb2..2592d8837d5 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -4,7 +4,7 @@ use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, customers::*},
- services::{api, authentication as auth},
+ services::{api, authentication as auth, authorization::permissions::Permission},
types::api::customers,
};
@@ -36,7 +36,11 @@ pub async fn customers_create(
&req,
json_payload.into_inner(),
|state, auth, req| create_customer(state, auth.merchant_account, auth.key_store, req),
- &auth::ApiKeyAuth,
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::CustomerWrite),
+ req.headers(),
+ ),
api_locking::LockAction::NotApplicable,
))
.await
@@ -68,11 +72,14 @@ pub async fn customers_retrieve(
})
.into_inner();
- let auth =
+ let auth = if auth::is_jwt_auth(req.headers()) {
+ Box::new(auth::JWTAuth(Permission::CustomerRead))
+ } else {
match auth::is_ephemeral_auth(req.headers(), &*state.store, &payload.customer_id).await {
Ok(auth) => auth,
Err(err) => return api::log_and_return_error_response(err),
- };
+ }
+ };
api::server_wrap(
flow,
@@ -110,7 +117,11 @@ pub async fn customers_list(state: web::Data<AppState>, req: HttpRequest) -> Htt
&req,
(),
|state, auth, _| list_customers(state, auth.merchant_account.merchant_id, auth.key_store),
- &auth::ApiKeyAuth,
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::CustomerRead),
+ req.headers(),
+ ),
api_locking::LockAction::NotApplicable,
)
.await
@@ -148,7 +159,11 @@ pub async fn customers_update(
&req,
json_payload.into_inner(),
|state, auth, req| update_customer(state, auth.merchant_account, req, auth.key_store),
- &auth::ApiKeyAuth,
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::CustomerWrite),
+ req.headers(),
+ ),
api_locking::LockAction::NotApplicable,
))
.await
@@ -185,7 +200,11 @@ pub async fn customers_delete(
&req,
payload,
|state, auth, req| delete_customer(state, auth.merchant_account, req, auth.key_store),
- &auth::ApiKeyAuth,
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::CustomerWrite),
+ req.headers(),
+ ),
api_locking::LockAction::NotApplicable,
))
.await
@@ -209,7 +228,11 @@ pub async fn get_customer_mandates(
|state, auth, req| {
crate::core::mandate::get_customer_mandates(state, auth.merchant_account, req)
},
- &auth::ApiKeyAuth,
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::MandateRead),
+ req.headers(),
+ ),
api_locking::LockAction::NotApplicable,
)
.await
diff --git a/crates/router/src/services/authorization/info.rs b/crates/router/src/services/authorization/info.rs
index c6b649f3de5..cef93f82739 100644
--- a/crates/router/src/services/authorization/info.rs
+++ b/crates/router/src/services/authorization/info.rs
@@ -38,6 +38,7 @@ pub enum PermissionModule {
Routing,
Analytics,
Mandates,
+ Customer,
Disputes,
Files,
ThreeDsDecisionManager,
@@ -55,6 +56,7 @@ impl PermissionModule {
Self::Forex => "Forex module permissions allow the user to view and query the forex rates",
Self::Analytics => "Permission to view and analyse the data relating to payments, refunds, sdk etc.",
Self::Mandates => "Everything related to mandates - like creating and viewing mandate related information are within this module",
+ Self::Customer => "Everything related to customers - like creating and viewing customer related information are within this module",
Self::Disputes => "Everything related to disputes - like creating and viewing dispute related information are within this module",
Self::Files => "Permissions for uploading, deleting and viewing files for disputes",
Self::ThreeDsDecisionManager => "View and configure 3DS decision rules configured for a merchant",
@@ -133,6 +135,14 @@ impl ModuleInfo {
Permission::MandateWrite,
]),
},
+ PermissionModule::Customer => Self {
+ module: module_name,
+ description,
+ permissions: PermissionInfo::new(&[
+ Permission::CustomerRead,
+ Permission::CustomerWrite,
+ ]),
+ },
PermissionModule::Disputes => Self {
module: module_name,
description,
diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rs
index 708da97e1e3..426b048e88b 100644
--- a/crates/router/src/services/authorization/permissions.rs
+++ b/crates/router/src/services/authorization/permissions.rs
@@ -19,6 +19,8 @@ pub enum Permission {
DisputeWrite,
MandateRead,
MandateWrite,
+ CustomerRead,
+ CustomerWrite,
FileRead,
FileWrite,
Analytics,
@@ -55,6 +57,8 @@ impl Permission {
Self::DisputeWrite => Some("Create and update disputes"),
Self::MandateRead => Some("View mandates"),
Self::MandateWrite => Some("Create and update mandates"),
+ Self::CustomerRead => Some("View customers"),
+ Self::CustomerWrite => Some("Create, update and delete customers"),
Self::FileRead => Some("View files"),
Self::FileWrite => Some("Create, update and delete files"),
Self::Analytics => Some("Access to analytics module"),
diff --git a/crates/router/src/services/authorization/predefined_permissions.rs b/crates/router/src/services/authorization/predefined_permissions.rs
index a9f2b864d0a..c489f1fc963 100644
--- a/crates/router/src/services/authorization/predefined_permissions.rs
+++ b/crates/router/src/services/authorization/predefined_permissions.rs
@@ -52,6 +52,8 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::DisputeWrite,
Permission::MandateRead,
Permission::MandateWrite,
+ Permission::CustomerRead,
+ Permission::CustomerWrite,
Permission::FileRead,
Permission::FileWrite,
Permission::Analytics,
@@ -79,6 +81,7 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::Analytics,
Permission::DisputeRead,
Permission::MandateRead,
+ Permission::CustomerRead,
Permission::FileRead,
Permission::UsersRead,
],
@@ -112,6 +115,8 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::DisputeWrite,
Permission::MandateRead,
Permission::MandateWrite,
+ Permission::CustomerRead,
+ Permission::CustomerWrite,
Permission::FileRead,
Permission::FileWrite,
Permission::Analytics,
@@ -150,6 +155,8 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::DisputeWrite,
Permission::MandateRead,
Permission::MandateWrite,
+ Permission::CustomerRead,
+ Permission::CustomerWrite,
Permission::FileRead,
Permission::FileWrite,
Permission::Analytics,
@@ -175,6 +182,7 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::SurchargeDecisionManagerRead,
Permission::DisputeRead,
Permission::MandateRead,
+ Permission::CustomerRead,
Permission::FileRead,
Permission::Analytics,
Permission::UsersRead,
@@ -198,6 +206,7 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::SurchargeDecisionManagerRead,
Permission::DisputeRead,
Permission::MandateRead,
+ Permission::CustomerRead,
Permission::FileRead,
Permission::Analytics,
Permission::UsersRead,
@@ -223,6 +232,7 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::SurchargeDecisionManagerRead,
Permission::DisputeRead,
Permission::MandateRead,
+ Permission::CustomerRead,
Permission::FileRead,
Permission::Analytics,
Permission::UsersRead,
@@ -252,6 +262,7 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::SurchargeDecisionManagerWrite,
Permission::DisputeRead,
Permission::MandateRead,
+ Permission::CustomerRead,
Permission::FileRead,
Permission::Analytics,
Permission::UsersRead,
@@ -273,6 +284,7 @@ pub static PREDEFINED_PERMISSIONS: Lazy<HashMap<&'static str, RoleInfo>> = Lazy:
Permission::MerchantAccountRead,
Permission::MerchantConnectorAccountRead,
Permission::MandateRead,
+ Permission::CustomerRead,
Permission::FileRead,
Permission::FileWrite,
Permission::Analytics,
diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs
index a595afa4a27..ce8350bd9eb 100644
--- a/crates/router/src/types/domain/user.rs
+++ b/crates/router/src/types/domain/user.rs
@@ -788,6 +788,7 @@ impl From<info::PermissionModule> for user_role_api::PermissionModule {
info::PermissionModule::Routing => Self::Routing,
info::PermissionModule::Analytics => Self::Analytics,
info::PermissionModule::Mandates => Self::Mandates,
+ info::PermissionModule::Customer => Self::Customer,
info::PermissionModule::Disputes => Self::Disputes,
info::PermissionModule::Files => Self::Files,
info::PermissionModule::ThreeDsDecisionManager => Self::ThreeDsDecisionManager,
diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs
index 0026984fdb9..4449338402f 100644
--- a/crates/router/src/utils/user_role.rs
+++ b/crates/router/src/utils/user_role.rs
@@ -74,6 +74,8 @@ impl TryFrom<&Permission> for user_role_api::Permission {
Permission::DisputeWrite => Ok(Self::DisputeWrite),
Permission::MandateRead => Ok(Self::MandateRead),
Permission::MandateWrite => Ok(Self::MandateWrite),
+ Permission::CustomerRead => Ok(Self::CustomerRead),
+ Permission::CustomerWrite => Ok(Self::CustomerWrite),
Permission::FileRead => Ok(Self::FileRead),
Permission::FileWrite => Ok(Self::FileWrite),
Permission::Analytics => Ok(Self::Analytics),
|
feat
|
Add JWT Authentication for `/customers` APIs (#3179)
|
be78dfc04eff671fb0b4e6037c84aee8ab367e70
|
2024-07-22 22:33:57
|
Shankar Singh C
|
fix(router): store `network_transaction_id` in stripe `authorize` flow (#5399)
| false
|
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 786f4a060b7..90ddc9f0b90 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -2389,7 +2389,18 @@ impl<F, T>
//Note: we might have to call retrieve_setup_intent to get the network_transaction_id in case its not sent in PaymentIntentResponse
// Or we identify the mandate txns before hand and always call SetupIntent in case of mandate payment call
- let network_txn_id = Option::foreign_from(item.response.latest_attempt);
+ let network_txn_id = match item.response.latest_charge.as_ref() {
+ Some(StripeChargeEnum::ChargeObject(charge_object)) => charge_object
+ .payment_method_details
+ .as_ref()
+ .and_then(|payment_method_details| match payment_method_details {
+ StripePaymentMethodDetailsResponse::Card { card } => {
+ card.network_transaction_id.clone()
+ }
+ _ => None,
+ }),
+ _ => None,
+ };
let connector_metadata =
get_connector_metadata(item.response.next_action.as_ref(), item.response.amount)?;
|
fix
|
store `network_transaction_id` in stripe `authorize` flow (#5399)
|
c702535e91cb6c489d8c24d1ab0e6be3025d015a
|
2025-03-17 19:59:18
|
Kashif
|
feat: scheme error code and messages in payments api response (#7528)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 53af0100c4f..263d27aa461 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7634,6 +7634,7 @@
"globepay",
"gocardless",
"gpayments",
+ "hipay",
"helcim",
"inespay",
"iatapay",
@@ -8721,6 +8722,14 @@
}
],
"nullable": true
+ },
+ "network_tokenization": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/NetworkTokenResponse"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -11590,6 +11599,14 @@
"type": "object",
"description": "Metadata is useful for storing additional, unstructured information about the merchant account.",
"nullable": true
+ },
+ "product_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/api_enums.MerchantProductType"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -11724,6 +11741,14 @@
},
"recon_status": {
"$ref": "#/components/schemas/ReconStatus"
+ },
+ "product_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/api_enums.MerchantProductType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -15357,6 +15382,14 @@
},
"description": "The connector token details if available",
"nullable": true
+ },
+ "network_token": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/NetworkTokenResponse"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -15890,7 +15923,8 @@
"active_attempt_payment_connector_id",
"billing_connector_payment_details",
"payment_method_type",
- "payment_method_subtype"
+ "payment_method_subtype",
+ "connector"
],
"properties": {
"total_retry_count": {
@@ -15921,6 +15955,9 @@
},
"payment_method_subtype": {
"$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "connector": {
+ "$ref": "#/components/schemas/Connector"
}
}
},
@@ -20308,6 +20345,7 @@
"globalpay",
"globepay",
"gocardless",
+ "hipay",
"helcim",
"iatapay",
"inespay",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index cc1207d4779..4d4dc65d9b7 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -9733,6 +9733,7 @@
"globepay",
"gocardless",
"gpayments",
+ "hipay",
"helcim",
"inespay",
"iatapay",
@@ -13928,6 +13929,14 @@
}
],
"nullable": true
+ },
+ "product_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/api_enums.MerchantProductType"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -14161,6 +14170,14 @@
}
],
"nullable": true
+ },
+ "product_type": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/api_enums.MerchantProductType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -19591,6 +19608,16 @@
}
],
"nullable": true
+ },
+ "issuer_error_code": {
+ "type": "string",
+ "description": "Error code received from the issuer in case of failed payments",
+ "nullable": true
+ },
+ "issuer_error_message": {
+ "type": "string",
+ "description": "Error message received from the issuer in case of failed payments",
+ "nullable": true
}
}
},
@@ -20859,6 +20886,16 @@
}
],
"nullable": true
+ },
+ "issuer_error_code": {
+ "type": "string",
+ "description": "Error code received from the issuer in case of failed payments",
+ "nullable": true
+ },
+ "issuer_error_message": {
+ "type": "string",
+ "description": "Error message received from the issuer in case of failed payments",
+ "nullable": true
}
}
},
@@ -24138,6 +24175,16 @@
}
],
"nullable": true
+ },
+ "issuer_error_code": {
+ "type": "string",
+ "description": "Error code received from the issuer in case of failed refunds",
+ "nullable": true
+ },
+ "issuer_error_message": {
+ "type": "string",
+ "description": "Error message received from the issuer in case of failed refunds",
+ "nullable": true
}
}
},
@@ -24794,6 +24841,7 @@
"globalpay",
"globepay",
"gocardless",
+ "hipay",
"helcim",
"iatapay",
"inespay",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 651b0096566..2e21de61083 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5036,6 +5036,12 @@ pub struct PaymentsResponse {
/// Method through which card was discovered
#[schema(value_type = Option<CardDiscovery>, example = "manual")]
pub card_discovery: Option<enums::CardDiscovery>,
+
+ /// Error code received from the issuer in case of failed payments
+ pub issuer_error_code: Option<String>,
+
+ /// Error message received from the issuer in case of failed payments
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v2")]
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index ad09c333ea7..ece1edb72bd 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -210,6 +210,10 @@ pub struct RefundResponse {
/// Charge specific fields for controlling the revert of funds from either platform or connected account
#[schema(value_type = Option<SplitRefund>,)]
pub split_refunds: Option<common_types::refunds::SplitRefund>,
+ /// Error code received from the issuer in case of failed refunds
+ pub issuer_error_code: Option<String>,
+ /// Error message received from the issuer in case of failed refunds
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 7409b722653..8fb4afeb8ed 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -187,6 +187,8 @@ pub struct PaymentAttempt {
pub processor_transaction_data: Option<String>,
pub card_discovery: Option<storage_enums::CardDiscovery>,
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
@@ -547,6 +549,8 @@ pub enum PaymentAttemptUpdate {
connector_transaction_id: Option<String>,
payment_method_data: Option<serde_json::Value>,
authentication_type: Option<storage_enums::AuthenticationType>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
},
CaptureUpdate {
amount_to_capture: Option<MinorUnit>,
@@ -898,6 +902,8 @@ pub struct PaymentAttemptUpdateInternal {
pub processor_transaction_data: Option<String>,
pub card_discovery: Option<common_enums::CardDiscovery>,
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
@@ -1082,6 +1088,8 @@ impl PaymentAttemptUpdate {
connector_mandate_detail,
card_discovery,
charges,
+ issuer_error_code,
+ issuer_error_message,
} = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source);
PaymentAttempt {
amount: amount.unwrap_or(source.amount),
@@ -1141,6 +1149,8 @@ impl PaymentAttemptUpdate {
connector_mandate_detail: connector_mandate_detail.or(source.connector_mandate_detail),
card_discovery: card_discovery.or(source.card_discovery),
charges: charges.or(source.charges),
+ issuer_error_code: issuer_error_code.or(source.issuer_error_code),
+ issuer_error_message: issuer_error_message.or(source.issuer_error_message),
..source
}
}
@@ -2194,6 +2204,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::AuthenticationTypeUpdate {
authentication_type,
@@ -2251,6 +2263,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ConfirmUpdate {
amount,
@@ -2340,6 +2354,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail,
card_discovery,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::VoidUpdate {
status,
@@ -2398,6 +2414,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::RejectUpdate {
status,
@@ -2457,6 +2475,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::BlocklistUpdate {
status,
@@ -2516,6 +2536,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ConnectorMandateDetailUpdate {
connector_mandate_detail,
@@ -2573,6 +2595,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::PaymentMethodDetailsUpdate {
payment_method_id,
@@ -2630,6 +2654,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ResponseUpdate {
status,
@@ -2712,6 +2738,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
shipping_cost: None,
order_tax_amount: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::ErrorUpdate {
@@ -2727,6 +2755,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_id,
payment_method_data,
authentication_type,
+ issuer_error_code,
+ issuer_error_message,
} => {
let (connector_transaction_id, processor_transaction_data) =
connector_transaction_id
@@ -2748,6 +2778,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
payment_method_data,
authentication_type,
processor_transaction_data,
+ issuer_error_code,
+ issuer_error_message,
amount: None,
net_amount: None,
currency: None,
@@ -2841,6 +2873,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::UpdateTrackers {
payment_token,
@@ -2904,6 +2938,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::UnresolvedResponseUpdate {
status,
@@ -2974,6 +3010,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::PreprocessingUpdate {
@@ -3043,6 +3081,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::CaptureUpdate {
@@ -3102,6 +3142,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::AmountToCaptureUpdate {
status,
@@ -3160,6 +3202,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ConnectorResponse {
authentication_data,
@@ -3227,6 +3271,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate {
@@ -3285,6 +3331,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::AuthenticationUpdate {
status,
@@ -3345,6 +3393,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
PaymentAttemptUpdate::ManualUpdate {
status,
@@ -3414,6 +3464,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
PaymentAttemptUpdate::PostSessionTokensUpdate {
@@ -3472,6 +3524,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_mandate_detail: None,
card_discovery: None,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
}
}
diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs
index f19c3252c60..ee598bebd2f 100644
--- a/crates/diesel_models/src/refund.rs
+++ b/crates/diesel_models/src/refund.rs
@@ -60,6 +60,8 @@ pub struct Refund {
pub unified_message: Option<String>,
pub processor_refund_data: Option<String>,
pub processor_transaction_data: Option<String>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[derive(
@@ -140,6 +142,8 @@ pub enum RefundUpdate {
processor_refund_data: Option<String>,
unified_code: Option<String>,
unified_message: Option<String>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
},
ManualUpdate {
refund_status: Option<storage_enums::RefundStatus>,
@@ -165,6 +169,8 @@ pub struct RefundUpdateInternal {
processor_refund_data: Option<String>,
unified_code: Option<String>,
unified_message: Option<String>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
}
impl RefundUpdateInternal {
@@ -213,6 +219,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
modified_at: common_utils::date_time::now(),
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
RefundUpdate::MetadataAndReasonUpdate {
metadata,
@@ -232,6 +240,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
RefundUpdate::StatusUpdate {
connector_refund_id,
@@ -253,6 +263,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
modified_at: common_utils::date_time::now(),
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
RefundUpdate::ErrorUpdate {
refund_status,
@@ -263,6 +275,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
updated_by,
connector_refund_id,
processor_refund_data,
+ issuer_error_code,
+ issuer_error_message,
} => Self {
refund_status,
refund_error_message,
@@ -277,6 +291,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
modified_at: common_utils::date_time::now(),
unified_code,
unified_message,
+ issuer_error_code,
+ issuer_error_message,
},
RefundUpdate::ManualUpdate {
refund_status,
@@ -297,6 +313,8 @@ impl From<RefundUpdate> for RefundUpdateInternal {
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
}
}
@@ -318,6 +336,8 @@ impl RefundUpdate {
processor_refund_data,
unified_code,
unified_message,
+ issuer_error_code,
+ issuer_error_message,
} = self.into();
Refund {
connector_refund_id: connector_refund_id.or(source.connector_refund_id),
@@ -333,6 +353,8 @@ impl RefundUpdate {
processor_refund_data: processor_refund_data.or(source.processor_refund_data),
unified_code: unified_code.or(source.unified_code),
unified_message: unified_message.or(source.unified_message),
+ issuer_error_code: issuer_error_code.or(source.issuer_error_code),
+ issuer_error_message: issuer_error_message.or(source.issuer_error_message),
..source
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index ae01a54bd43..4e2ba4811b1 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -922,6 +922,9 @@ diesel::table! {
processor_transaction_data -> Nullable<Text>,
card_discovery -> Nullable<CardDiscovery>,
charges -> Nullable<Jsonb>,
+ #[max_length = 64]
+ issuer_error_code -> Nullable<Varchar>,
+ issuer_error_message -> Nullable<Text>,
}
}
@@ -1276,6 +1279,9 @@ diesel::table! {
unified_message -> Nullable<Varchar>,
processor_refund_data -> Nullable<Text>,
processor_transaction_data -> Nullable<Text>,
+ #[max_length = 64]
+ issuer_error_code -> Nullable<Varchar>,
+ issuer_error_message -> Nullable<Text>,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/aci.rs b/crates/hyperswitch_connectors/src/connectors/aci.rs
index f4fce668ee0..8219105ed2f 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci.rs
@@ -121,6 +121,8 @@ impl ConnectorCommon for Aci {
}),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs
index 1e57cbbcf65..8e0694336b5 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Adyen {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: response.psp_reference,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -988,6 +990,8 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
status_code: res.status_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(response.psp_reference),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 13a29f16a0d..793a33e1fc1 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -144,6 +144,8 @@ pub struct AdditionalData {
#[cfg(feature = "payouts")]
payout_eligible: Option<PayoutEligibility>,
funds_availability: Option<String>,
+ refusal_reason_raw: Option<String>,
+ refusal_code_raw: Option<String>,
}
#[serde_with::skip_serializing_none]
@@ -444,6 +446,10 @@ pub struct AdyenWebhookResponse {
refusal_reason: Option<String>,
refusal_reason_code: Option<String>,
event_code: WebhookEventCode,
+ // Raw acquirer refusal code
+ refusal_code_raw: Option<String>,
+ // Raw acquirer refusal reason
+ refusal_reason_raw: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -453,6 +459,7 @@ pub struct RedirectionErrorResponse {
refusal_reason: Option<String>,
psp_reference: Option<String>,
merchant_reference: Option<String>,
+ additional_data: Option<AdditionalData>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -466,6 +473,7 @@ pub struct RedirectionResponse {
merchant_reference: Option<String>,
store: Option<String>,
splits: Option<Vec<AdyenSplitData>>,
+ additional_data: Option<AdditionalData>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -3461,6 +3469,14 @@ pub fn get_adyen_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.psp_reference.clone()),
+ issuer_error_code: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_code_raw.clone()),
+ issuer_error_message: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_reason_raw.clone()),
})
} else {
None
@@ -3533,6 +3549,8 @@ pub fn get_webhook_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.transaction_id.clone()),
+ issuer_error_code: response.refusal_code_raw.clone(),
+ issuer_error_message: response.refusal_reason_raw.clone(),
})
} else {
None
@@ -3598,6 +3616,14 @@ pub fn get_redirection_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_code_raw.clone()),
+ issuer_error_message: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_reason_raw.clone()),
})
} else {
None
@@ -3674,6 +3700,8 @@ pub fn get_present_to_shopper_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -3739,6 +3767,8 @@ pub fn get_qr_code_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -3796,6 +3826,14 @@ pub fn get_redirection_error_response(
status_code,
attempt_status: None,
connector_transaction_id: response.psp_reference.clone(),
+ issuer_error_code: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_code_raw.clone()),
+ issuer_error_message: response
+ .additional_data
+ .as_ref()
+ .and_then(|data| data.refusal_reason_raw.clone()),
});
// We don't get connector transaction id for redirections in Adyen.
let payments_response_data = PaymentsResponseData::TransactionResponse {
@@ -4307,6 +4345,10 @@ pub struct AdyenAdditionalDataWH {
#[serde(rename = "recurring.recurringDetailReference")]
pub recurring_detail_reference: Option<Secret<String>>,
pub network_tx_reference: Option<Secret<String>>,
+ /// [only for cards] Enable raw acquirer from Adyen dashboard to receive this (https://docs.adyen.com/development-resources/raw-acquirer-responses/#search-modal)
+ pub refusal_reason_raw: Option<String>,
+ /// [only for cards] This is only available for Visa and Mastercard
+ pub refusal_code_raw: Option<String>,
}
#[derive(Debug, Deserialize)]
@@ -4592,6 +4634,8 @@ impl From<AdyenNotificationRequestItemWH> for AdyenWebhookResponse {
refusal_reason,
refusal_reason_code,
event_code: notif.event_code,
+ refusal_code_raw: notif.additional_data.refusal_code_raw,
+ refusal_reason_raw: notif.additional_data.refusal_reason_raw,
}
}
}
@@ -5307,6 +5351,8 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for AcceptDisputeRouterData {
)?,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -5345,6 +5391,8 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for SubmitEvidenceRouterData
)?,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -5385,6 +5433,8 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for DefendDisputeRouterData {
)?,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
index f37bef83026..c7482236264 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
@@ -122,6 +122,8 @@ impl ConnectorCommon for Airwallex {
reason: response.source,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
index f8959541574..d383bb59b74 100644
--- a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
@@ -145,6 +145,8 @@ impl ConnectorCommon for Amazonpay {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
index 3bd39fd38b5..de72dbe2aeb 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
@@ -1000,6 +1000,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
})
.unwrap_or_else(|| ErrorResponse {
@@ -1009,6 +1011,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})),
Some(authorizedotnet::TransactionResponse::AuthorizedotnetTransactionResponseError(_))
| None => {
@@ -1025,6 +1029,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
index 3ba9e76cc7d..2d329ec82fd 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
@@ -551,6 +551,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
response,
@@ -1219,6 +1221,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(transaction_response.transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
});
let metadata = transaction_response
@@ -1310,6 +1314,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, AuthorizedotnetVoidResponse, T, Payment
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(transaction_response.transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
});
let metadata = transaction_response
@@ -1458,6 +1464,8 @@ impl<F> TryFrom<RefundsResponseRouterData<F, AuthorizedotnetRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(transaction_response.transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
});
@@ -1736,6 +1744,8 @@ fn get_err_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rs
index c4a9edea65c..1bf524392d7 100644
--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Bambora {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
index f7453495077..fb9c0799124 100644
--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
@@ -163,6 +163,8 @@ impl ConnectorCommon for Bamboraapac {
reason: response_data.declined_message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
index 5996ba05834..525b0456cec 100644
--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
@@ -346,6 +346,8 @@ impl<F>
reason: Some(declined_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -501,6 +503,8 @@ impl<F>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -663,6 +667,8 @@ impl<F>
reason: Some(declined_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -944,6 +950,8 @@ impl<F>
reason: Some(declined_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
index 36d12fe3fc5..c1cc1b644a7 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
@@ -276,6 +276,8 @@ impl ConnectorCommon for Bankofamerica {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
transformers::BankOfAmericaErrorResponse::AuthenticationError(response) => {
@@ -286,6 +288,8 @@ impl ConnectorCommon for Bankofamerica {
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -434,6 +438,8 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -556,6 +562,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -746,6 +754,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -867,6 +877,8 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Ba
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
index 9804f6c4e6c..4b40e36a7a6 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
@@ -1445,6 +1445,8 @@ fn map_error_response<F, T>(
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
});
match transaction_status {
@@ -1486,10 +1488,10 @@ fn get_payment_response(
enums::AttemptStatus,
u16,
),
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let error_response = get_error_response_if_failure((info_response, status, http_code));
match error_response {
- Some(error) => Err(error),
+ Some(error) => Err(Box::new(error)),
None => {
let mandate_reference =
info_response
@@ -1549,7 +1551,8 @@ impl<F>
info_response.status.clone(),
item.data.request.is_auto_capture()?,
));
- let response = get_payment_response((&info_response, status, item.http_code));
+ let response = get_payment_response((&info_response, status, item.http_code))
+ .map_err(|err| *err);
let connector_response = match item.data.payment_method {
common_enums::PaymentMethod::Card => info_response
.processor_information
@@ -1648,7 +1651,8 @@ impl<F>
match item.response {
BankOfAmericaPaymentsResponse::ClientReferenceInformation(info_response) => {
let status = map_boa_attempt_status((info_response.status.clone(), true));
- let response = get_payment_response((&info_response, status, item.http_code));
+ let response = get_payment_response((&info_response, status, item.http_code))
+ .map_err(|err| *err);
Ok(Self {
status,
response,
@@ -1684,7 +1688,8 @@ impl<F>
match item.response {
BankOfAmericaPaymentsResponse::ClientReferenceInformation(info_response) => {
let status = map_boa_attempt_status((info_response.status.clone(), false));
- let response = get_payment_response((&info_response, status, item.http_code));
+ let response = get_payment_response((&info_response, status, item.http_code))
+ .map_err(|err| *err);
Ok(Self {
status,
response,
@@ -2244,6 +2249,8 @@ fn get_error_response(
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
@@ -2521,6 +2528,8 @@ fn convert_to_error_response_from_error_info(
status_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
index b5ddef00358..34bf83a7bd5 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Billwerk {
reason: Some(response.error),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
index 9fe00bac046..e6499306d0f 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
@@ -279,6 +279,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BillwerkPaymentsResponse, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.handle.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
index 4de2f422b94..992196c61d3 100644
--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
@@ -153,6 +153,8 @@ impl ConnectorCommon for Bitpay {
reason: response.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
index 29b0611c979..23720360294 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
@@ -168,6 +168,8 @@ impl ConnectorCommon for Bluesnap {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
bluesnap::BluesnapErrors::Auth(error_res) => ErrorResponse {
@@ -177,6 +179,8 @@ impl ConnectorCommon for Bluesnap {
reason: Some(error_res.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
bluesnap::BluesnapErrors::General(error_response) => {
let (error_res, attempt_status) = if res.status_code == 403
@@ -199,6 +203,8 @@ impl ConnectorCommon for Bluesnap {
reason: Some(error_res),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
};
diff --git a/crates/hyperswitch_connectors/src/connectors/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rs
index 68195979874..330e7b5ab45 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku.rs
@@ -163,6 +163,8 @@ impl ConnectorCommon for Boku {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(_) => get_xml_deserialized(res, event_builder),
@@ -705,6 +707,8 @@ fn get_xml_deserialized(
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/braintree.rs b/crates/hyperswitch_connectors/src/connectors/braintree.rs
index e965e964293..67c54759152 100644
--- a/crates/hyperswitch_connectors/src/connectors/braintree.rs
+++ b/crates/hyperswitch_connectors/src/connectors/braintree.rs
@@ -169,6 +169,8 @@ impl ConnectorCommon for Braintree {
reason: Some(response.api_error_response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(braintree::ErrorResponses::BraintreeErrorResponse(response)) => {
@@ -182,6 +184,8 @@ impl ConnectorCommon for Braintree {
reason: Some(response.errors),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
index 2a5fabb7788..dfde2e0a26d 100644
--- a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
@@ -447,7 +447,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeAuthResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeAuthResponse::AuthResponse(auth_response) => {
@@ -461,6 +462,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -513,7 +516,7 @@ impl<F>
fn build_error_response<T>(
response: &[ErrorDetails],
http_code: u16,
-) -> Result<T, hyperswitch_domain_models::router_data::ErrorResponse> {
+) -> Result<T, Box<hyperswitch_domain_models::router_data::ErrorResponse>> {
let error_messages = response
.iter()
.map(|error| error.message.to_string())
@@ -542,15 +545,19 @@ fn get_error_response<T>(
error_msg: Option<String>,
error_reason: Option<String>,
http_code: u16,
-) -> Result<T, hyperswitch_domain_models::router_data::ErrorResponse> {
- Err(hyperswitch_domain_models::router_data::ErrorResponse {
- code: error_code.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
- message: error_msg.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
- reason: error_reason,
- status_code: http_code,
- attempt_status: None,
- connector_transaction_id: None,
- })
+) -> Result<T, Box<hyperswitch_domain_models::router_data::ErrorResponse>> {
+ Err(Box::new(
+ hyperswitch_domain_models::router_data::ErrorResponse {
+ code: error_code.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
+ message: error_msg.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
+ reason: error_reason,
+ status_code: http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
+ },
+ ))
}
#[derive(Debug, Clone, Deserialize, Serialize, strum::Display)]
@@ -624,7 +631,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreePaymentsResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors.clone(), item.http_code),
+ response: build_error_response(&error_response.errors.clone(), item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreePaymentsResponse::PaymentsResponse(payment_response) => {
@@ -638,6 +646,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -708,7 +718,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeCompleteChargeResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors.clone(), item.http_code),
+ response: build_error_response(&error_response.errors.clone(), item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeCompleteChargeResponse::PaymentsResponse(payment_response) => {
@@ -722,6 +733,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -773,7 +786,8 @@ impl<F>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeCompleteAuthResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeCompleteAuthResponse::AuthResponse(auth_response) => {
@@ -787,6 +801,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -962,7 +978,7 @@ impl TryFrom<RefundsResponseRouterData<Execute, BraintreeRefundResponse>>
Ok(Self {
response: match item.response {
BraintreeRefundResponse::ErrorResponse(error_response) => {
- build_error_response(&error_response.errors, item.http_code)
+ build_error_response(&error_response.errors, item.http_code).map_err(|err| *err)
}
BraintreeRefundResponse::SuccessResponse(refund_data) => {
let refund_data = refund_data.data.refund_transaction.refund;
@@ -975,6 +991,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, BraintreeRefundResponse>>
attempt_status: None,
connector_transaction_id: Some(refund_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -1079,7 +1097,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, BraintreeRSyncResponse>>
) -> Result<Self, Self::Error> {
match item.response {
BraintreeRSyncResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeRSyncResponse::RSyncResponse(rsync_response) => {
@@ -1241,6 +1260,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeTokenResponse, T, PaymentsResp
response: match item.response {
BraintreeTokenResponse::ErrorResponse(error_response) => {
build_error_response(error_response.errors.as_ref(), item.http_code)
+ .map_err(|err| *err)
}
BraintreeTokenResponse::TokenResponse(token_response) => {
@@ -1332,6 +1352,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<BraintreeCaptureResponse>>
attempt_status: None,
connector_transaction_id: Some(transaction_data.id),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -1352,7 +1374,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<BraintreeCaptureResponse>>
})
}
BraintreeCaptureResponse::ErrorResponse(error_data) => Ok(Self {
- response: build_error_response(&error_data.errors, item.http_code),
+ response: build_error_response(&error_data.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
}
@@ -1417,6 +1440,7 @@ impl<F>
response: match item.response {
BraintreeRevokeMandateResponse::ErrorResponse(error_response) => {
build_error_response(error_response.errors.as_ref(), item.http_code)
+ .map_err(|err| *err)
}
BraintreeRevokeMandateResponse::RevokeMandateResponse(..) => {
Ok(MandateRevokeResponseData {
@@ -1515,7 +1539,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeCancelResponse, T, PaymentsRes
) -> Result<Self, Self::Error> {
match item.response {
BraintreeCancelResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreeCancelResponse::CancelResponse(void_response) => {
@@ -1529,6 +1554,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeCancelResponse, T, PaymentsRes
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -1611,7 +1638,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreePSyncResponse, T, PaymentsResp
) -> Result<Self, Self::Error> {
match item.response {
BraintreePSyncResponse::ErrorResponse(error_response) => Ok(Self {
- response: build_error_response(&error_response.errors, item.http_code),
+ response: build_error_response(&error_response.errors, item.http_code)
+ .map_err(|err| *err),
..item.data
}),
BraintreePSyncResponse::SuccessResponse(psync_response) => {
@@ -1631,6 +1659,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreePSyncResponse, T, PaymentsResp
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
index a2a8cf9df65..edd6e54e0ce 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
@@ -146,6 +146,8 @@ impl ConnectorCommon for Cashtocode {
reason: Some(response.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
index 209092c6b6f..684099deb05 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
@@ -253,6 +253,8 @@ impl<F>
reason: Some(error_data.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
CashtocodePaymentsResponse::CashtoCodeData(response_data) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index 73eeabe4356..bde9a165b21 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Chargebee {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout.rs b/crates/hyperswitch_connectors/src/connectors/checkout.rs
index 61977098476..4d151c12159 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout.rs
@@ -179,6 +179,8 @@ impl ConnectorCommon for Checkout {
.or(response.error_type),
attempt_status: None,
connector_transaction_id: response.request_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
index 4630f00b1d5..d364e327504 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
@@ -705,6 +705,8 @@ impl TryFrom<PaymentsResponseRouterData<PaymentsResponse>> for PaymentsAuthorize
reason: item.response.response_summary,
attempt_status: None,
connector_transaction_id: Some(item.response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -757,6 +759,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<PaymentsResponse>> for PaymentsSyncR
reason: item.response.response_summary,
attempt_status: None,
connector_transaction_id: Some(item.response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
index cfdac514847..9e998abebbc 100644
--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Coinbase {
reason: response.error.code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/coingate.rs b/crates/hyperswitch_connectors/src/connectors/coingate.rs
index 81bb9116950..e426dcb2384 100644
--- a/crates/hyperswitch_connectors/src/connectors/coingate.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coingate.rs
@@ -142,6 +142,8 @@ impl ConnectorCommon for Coingate {
reason: Some(response.reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
index 2650d8f1e91..4c24018fcbc 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
@@ -193,6 +193,8 @@ impl ConnectorCommon for Cryptopay {
reason: response.error.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
index 98d3dd76cdd..67a67c8878d 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
@@ -175,6 +175,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(payment_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let redirection_data = item
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
index 812d0391dec..8b5e748906f 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
@@ -239,6 +239,8 @@ impl ConnectorCommon for Cybersource {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::CybersourceErrorResponse::AuthenticationError(response)) => {
@@ -251,6 +253,8 @@ impl ConnectorCommon for Cybersource {
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::CybersourceErrorResponse::NotAvailableError(response)) => {
@@ -275,6 +279,8 @@ impl ConnectorCommon for Cybersource {
reason: Some(error_response),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
@@ -506,6 +512,8 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -586,6 +594,8 @@ impl ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevoke
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -823,6 +833,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1058,6 +1070,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1172,6 +1186,8 @@ impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for Cyber
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1294,6 +1310,8 @@ impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResp
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1415,6 +1433,8 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Cy
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index ea5d9b25f84..2a0ebdc9f79 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -2679,10 +2679,10 @@ fn get_error_response_if_failure(
fn get_payment_response(
(info_response, status, http_code): (&CybersourcePaymentsResponse, enums::AttemptStatus, u16),
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let error_response = get_error_response_if_failure((info_response, status, http_code));
match error_response {
- Some(error) => Err(error),
+ Some(error) => Err(Box::new(error)),
None => {
let incremental_authorization_allowed =
Some(status == enums::AttemptStatus::Authorized);
@@ -2747,7 +2747,8 @@ impl
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
item.data.request.is_auto_capture()?,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
let connector_response = item
.response
.processor_information
@@ -2845,6 +2846,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
status: enums::AttemptStatus::AuthenticationFailed,
..item.data
@@ -3255,6 +3258,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(error_response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
response,
@@ -3292,7 +3297,8 @@ impl<F>
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
item.data.request.is_auto_capture()?,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
let connector_response = item
.response
.processor_information
@@ -3348,7 +3354,8 @@ impl<F>
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
true,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -3383,7 +3390,8 @@ impl<F>
.unwrap_or(CybersourcePaymentStatus::StatusNotReceived),
false,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -4131,6 +4139,8 @@ pub fn get_error_response(
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans.rs b/crates/hyperswitch_connectors/src/connectors/datatrans.rs
index f06d7be8693..0f82ae28d8f 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans.rs
@@ -153,6 +153,8 @@ impl ConnectorCommon for Datatrans {
reason: Some(response),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let response: datatrans::DatatransErrorResponse = res
@@ -168,6 +170,8 @@ impl ConnectorCommon for Datatrans {
reason: Some(response.error.message.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
index 9297f783d3e..8299b0387ae 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
@@ -560,6 +560,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
DatatransResponse::TransactionResponse(response) => {
Ok(PaymentsResponseData::TransactionResponse {
@@ -629,6 +631,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
DatatransResponse::TransactionResponse(response) => {
Ok(PaymentsResponseData::TransactionResponse {
@@ -704,6 +708,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, DatatransRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -733,6 +739,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, DatatransSyncResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
DatatransSyncResponse::Response(response) => Ok(RefundsResponseData {
connector_refund_id: response.transaction_id.to_string(),
@@ -762,6 +770,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
response,
@@ -785,6 +795,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let mandate_reference = sync_response
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
index b481c3e808d..0972eb63b9e 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
@@ -174,6 +174,8 @@ impl ConnectorCommon for Deutschebank {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -304,6 +306,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
deutschebank::DeutschebankError::AccessTokenErrorResponse(response) => {
Ok(ErrorResponse {
@@ -313,6 +317,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
index bf8a7fc9528..bee5d8662e1 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
@@ -444,7 +444,8 @@ impl
reason: Some("METHOD_REQUIRED Flow is not currently supported for deutschebank 3ds payments".to_owned()),
status_code: item.http_code,
attempt_status: None,
- connector_transaction_id: None,
+ connector_transaction_id: None,issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -514,6 +515,8 @@ fn get_error_response(error_code: String, error_reason: String, status_code: u16
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
index a58a086f5e7..55294d6a588 100644
--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
@@ -161,6 +161,8 @@ impl ConnectorCommon for Digitalvirgo {
reason: response.description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
index 60813a4ea08..965575bbe17 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
@@ -152,6 +152,8 @@ impl ConnectorCommon for Dlocal {
reason: response.param,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
index a11c608d69f..861ff22e60f 100644
--- a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
@@ -214,6 +214,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
ElavonPaymentsResponse::Success(response) => {
if status == enums::AttemptStatus::Failure {
@@ -224,6 +226,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(response.ssl_txn_id.clone()),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -428,6 +432,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
ElavonPaymentsResponse::Success(response) => {
if status == enums::AttemptStatus::Failure {
@@ -438,6 +444,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -478,6 +486,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
ElavonPaymentsResponse::Success(response) => {
if status == enums::RefundStatus::Failure {
@@ -488,6 +498,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, ElavonPaymentsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
index 50eebb99518..14374a8e18a 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiserv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
@@ -178,6 +178,8 @@ impl ConnectorCommon for Fiserv {
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
})
.unwrap_or(ErrorResponse {
@@ -187,6 +189,8 @@ impl ConnectorCommon for Fiserv {
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}))
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
index b124949c078..d129ed69554 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
@@ -236,6 +236,8 @@ impl ConnectorCommon for Fiservemea {
},
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
None => Ok(ErrorResponse {
@@ -248,6 +250,8 @@ impl ConnectorCommon for Fiservemea {
reason: response.response_type,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs
index 7e9bb8c120c..4069d6af8f9 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs
@@ -235,6 +235,8 @@ impl ConnectorCommon for Fiuu {
reason: Some(response.error_desc.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index 8b1296a0159..181574b54bb 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -828,6 +828,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -898,6 +900,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(data.txn_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -944,6 +948,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: recurring_response.tran_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -1077,6 +1083,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, FiuuRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -1101,6 +1109,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, FiuuRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(refund_data.refund_id.to_string()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -1240,6 +1250,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
reason: response.error_desc,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(txn_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1305,6 +1317,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
reason: response.error_desc.clone(),
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(txn_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1474,6 +1488,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<PaymentCaptureResponse>>
),
attempt_status: None,
connector_transaction_id: Some(item.response.tran_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1587,6 +1603,8 @@ impl TryFrom<PaymentsCancelResponseRouterData<FiuuPaymentCancelResponse>>
),
attempt_status: None,
connector_transaction_id: Some(item.response.tran_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1682,6 +1700,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, FiuuRefundSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rs
index 1068922faa7..2356fae53c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/forte.rs
+++ b/crates/hyperswitch_connectors/src/connectors/forte.rs
@@ -165,6 +165,8 @@ impl ConnectorCommon for Forte {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs
index 263b1ad5b46..180a1b683dc 100644
--- a/crates/hyperswitch_connectors/src/connectors/getnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs
@@ -155,6 +155,8 @@ impl ConnectorCommon for Getnet {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay.rs b/crates/hyperswitch_connectors/src/connectors/globalpay.rs
index 6d233bcfc33..641e9fd5f3d 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay.rs
@@ -148,6 +148,8 @@ impl ConnectorCommon for Globalpay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -376,6 +378,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
index 27ff359a7ad..57cf5d0f287 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
@@ -268,7 +268,7 @@ fn get_payment_response(
status: common_enums::AttemptStatus,
response: GlobalpayPaymentsResponse,
redirection_data: Option<RedirectForm>,
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let mandate_reference = response.payment_method.as_ref().and_then(|pm| {
pm.card
.as_ref()
@@ -281,13 +281,13 @@ fn get_payment_response(
})
});
match status {
- common_enums::AttemptStatus::Failure => Err(ErrorResponse {
+ common_enums::AttemptStatus::Failure => Err(Box::new(ErrorResponse {
message: response
.payment_method
.and_then(|pm| pm.message)
.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
..Default::default()
- }),
+ })),
_ => Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(response.id),
redirection_data: Box::new(redirection_data),
@@ -327,7 +327,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, GlobalpayPaymentsResponse, T, PaymentsR
let redirection_data = redirect_url.map(|url| RedirectForm::from((url, Method::Get)));
Ok(Self {
status,
- response: get_payment_response(status, item.response, redirection_data),
+ response: get_payment_response(status, item.response, redirection_data)
+ .map_err(|err| *err),
..item.data
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay.rs b/crates/hyperswitch_connectors/src/connectors/globepay.rs
index f11b7b5977f..cca5e99bccd 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Globepay {
reason: Some(response.return_msg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
index a3c027cb5a2..89686f199ad 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
@@ -325,6 +325,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rs
index a953e01dce0..a36ffdd9e34 100644
--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs
@@ -158,6 +158,8 @@ impl ConnectorCommon for Gocardless {
reason: Some(error_reason.join("; ")),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rs
index 79b950063c3..65927bb0f35 100644
--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs
+++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs
@@ -181,6 +181,8 @@ impl ConnectorCommon for Helcim {
reason: Some(error_string),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hipay.rs b/crates/hyperswitch_connectors/src/connectors/hipay.rs
index 1575e361a5b..be1a829efb3 100644
--- a/crates/hyperswitch_connectors/src/connectors/hipay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hipay.rs
@@ -244,6 +244,8 @@ impl ConnectorCommon for Hipay {
reason: response.description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
index cefa332bc8f..b121b0698cd 100644
--- a/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
@@ -582,6 +582,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<HipaySyncResponse>> for PaymentsSync
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
Ok(Self {
status: enums::AttemptStatus::Failure,
@@ -606,6 +608,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<HipaySyncResponse>> for PaymentsSync
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay.rs b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
index f9ab2f3159f..b5ea844fb2e 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
@@ -155,6 +155,8 @@ impl ConnectorCommon for Iatapay {
reason: Some(CONNECTOR_UNAUTHORIZED_ERROR.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
} else {
let response: iatapay::IatapayErrorResponse = res
@@ -171,6 +173,8 @@ impl ConnectorCommon for Iatapay {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
};
Ok(response_error_message)
@@ -288,6 +292,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
index e41057fb8e6..0c5c9fc6786 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
@@ -343,6 +343,8 @@ fn get_iatpay_response(
status_code,
attempt_status: Some(status),
connector_transaction_id: response.iata_payment_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -527,6 +529,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRout
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.iata_refund_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -563,6 +567,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouter
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.iata_refund_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rs
index 41ae798ade3..e0bd27d47b1 100644
--- a/crates/hyperswitch_connectors/src/connectors/inespay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs
@@ -151,6 +151,8 @@ impl ConnectorCommon for Inespay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
index 3922929892e..508e91438ef 100644
--- a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
@@ -142,6 +142,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPaymentsResponse, T, PaymentsRes
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
};
@@ -267,6 +269,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPSyncResponse, T, PaymentsRespon
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -359,6 +363,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, InespayRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -403,6 +409,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, InespayRSyncResponse>> for Refunds
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank.rs b/crates/hyperswitch_connectors/src/connectors/itaubank.rs
index 34956ace644..e31f86b0385 100644
--- a/crates/hyperswitch_connectors/src/connectors/itaubank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/itaubank.rs
@@ -176,6 +176,8 @@ impl ConnectorCommon for Itaubank {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -296,6 +298,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: response.detail.or(response.user_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
index 9d6037877f2..68529f725a8 100644
--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
@@ -167,6 +167,8 @@ impl ConnectorCommon for Jpmorgan {
reason: Some(response_message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
index cbe7881c536..6dd867421a9 100644
--- a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
+++ b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
@@ -187,6 +187,8 @@ impl ConnectorCommon for Juspaythreedsserver {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs
index 86ad19d7dc2..50a830fdba2 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs
@@ -126,6 +126,8 @@ impl ConnectorCommon for Klarna {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/mifinity.rs b/crates/hyperswitch_connectors/src/connectors/mifinity.rs
index 3b597597e38..eaaa94b4290 100644
--- a/crates/hyperswitch_connectors/src/connectors/mifinity.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mifinity.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Mifinity {
reason: Some(CONNECTOR_UNAUTHORIZED_ERROR.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let response: Result<
@@ -189,6 +191,8 @@ impl ConnectorCommon for Mifinity {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/mollie.rs b/crates/hyperswitch_connectors/src/connectors/mollie.rs
index 325c031c33f..b043dbdd8cc 100644
--- a/crates/hyperswitch_connectors/src/connectors/mollie.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mollie.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Mollie {
reason: response.field,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/moneris.rs b/crates/hyperswitch_connectors/src/connectors/moneris.rs
index c8f542c1bad..3562a2e838e 100644
--- a/crates/hyperswitch_connectors/src/connectors/moneris.rs
+++ b/crates/hyperswitch_connectors/src/connectors/moneris.rs
@@ -174,6 +174,8 @@ impl ConnectorCommon for Moneris {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -298,6 +300,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: response.error_description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 3e632e048a2..e11ac59e75f 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -1045,6 +1045,8 @@ pub fn populate_error_reason(
status_code: http_code,
attempt_status,
connector_transaction_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
// REFUND :
@@ -1150,6 +1152,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, MultisafepayRefundResponse>>
status_code: item.http_code,
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs
index f93eef65724..69a8543286d 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs
@@ -162,6 +162,8 @@ impl ConnectorCommon for Nexinets {
reason: Some(connector_reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
index 8a9c804cbf2..264bca6b5a9 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
@@ -203,6 +203,8 @@ impl ConnectorCommon for Nexixpay {
reason: concatenated_descriptions,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rs
index a6a5b0357e1..075b955be49 100644
--- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs
@@ -285,6 +285,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(None, None, Some(nomupay_inner_error), _, _) => {
match (
@@ -298,6 +300,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(_, Some(validation_errors)) => Ok(ErrorResponse {
status_code: res.status_code,
@@ -314,6 +318,8 @@ impl ConnectorCommon for Nomupay {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(None, None) => Ok(ErrorResponse {
status_code: res.status_code,
@@ -322,6 +328,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
@@ -335,6 +343,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
_ => Ok(ErrorResponse {
status_code: res.status_code,
@@ -343,6 +353,8 @@ impl ConnectorCommon for Nomupay {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rs
index c4f2eef275d..3f3de600063 100644
--- a/crates/hyperswitch_connectors/src/connectors/noon.rs
+++ b/crates/hyperswitch_connectors/src/connectors/noon.rs
@@ -178,6 +178,8 @@ impl ConnectorCommon for Noon {
reason: Some(noon_error_response.message),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_message) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
index b2128b990c1..81dc0186356 100644
--- a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
@@ -596,6 +596,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, NoonPaymentsResponse, T, PaymentsRespon
status_code: item.http_code,
attempt_status: Some(status),
connector_transaction_id: Some(order.id.to_string()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
_ => {
let connector_response_reference_id =
@@ -826,6 +828,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRout
reason: Some(response.message.clone()),
attempt_status: None,
connector_transaction_id: Some(response.result.transaction.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -892,6 +896,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundSyncResponse>> for RefundsRo
reason: Some(response.message.clone()),
attempt_status: None,
connector_transaction_id: Some(noon_transaction.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
index 0a47c8ccfba..a6f2e2fc643 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -153,6 +153,8 @@ impl ConnectorCommon for Novalnet {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 44f84bf475d..607acb37fb0 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -589,6 +589,8 @@ pub fn get_error_response(result: ResultData, status_code: u16) -> ErrorResponse
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 0bfd3af7e99..cbc4a244d8c 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1543,17 +1543,14 @@ fn build_error_response<T>(
http_code: u16,
) -> Option<Result<T, ErrorResponse>> {
match response.status {
- NuveiPaymentStatus::Error => Some(get_error_response(
- response.err_code,
- &response.reason,
- http_code,
- )),
+ NuveiPaymentStatus::Error => Some(
+ get_error_response(response.err_code, &response.reason, http_code).map_err(|err| *err),
+ ),
_ => {
- let err = Some(get_error_response(
- response.gw_error_code,
- &response.gw_error_reason,
- http_code,
- ));
+ let err = Some(
+ get_error_response(response.gw_error_code, &response.gw_error_reason, http_code)
+ .map_err(|err| *err),
+ );
match response.transaction_status {
Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err,
_ => match response
@@ -1709,7 +1706,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, NuveiPaymentsResponse>>
item.response
.transaction_id
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
- ),
+ )
+ .map_err(|err| *err),
..item.data
})
}
@@ -1729,7 +1727,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, NuveiPaymentsResponse>>
item.response
.transaction_id
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
- ),
+ )
+ .map_err(|err| *err),
..item.data
})
}
@@ -1783,7 +1782,7 @@ fn get_refund_response(
response: NuveiPaymentsResponse,
http_code: u16,
txn_id: String,
-) -> Result<RefundsResponseData, ErrorResponse> {
+) -> Result<RefundsResponseData, Box<ErrorResponse>> {
let refund_status = response
.transaction_status
.clone()
@@ -1809,8 +1808,8 @@ fn get_error_response<T>(
error_code: Option<i64>,
error_msg: &Option<String>,
http_code: u16,
-) -> Result<T, ErrorResponse> {
- Err(ErrorResponse {
+) -> Result<T, Box<ErrorResponse>> {
+ Err(Box::new(ErrorResponse {
code: error_code
.map(|c| c.to_string())
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
@@ -1821,7 +1820,9 @@ fn get_error_response<T>(
status_code: http_code,
attempt_status: None,
connector_transaction_id: None,
- })
+ issuer_error_code: None,
+ issuer_error_message: None,
+ }))
}
#[derive(Debug, Default, Serialize, Deserialize)]
diff --git a/crates/hyperswitch_connectors/src/connectors/opayo.rs b/crates/hyperswitch_connectors/src/connectors/opayo.rs
index b2aadda37f7..eef0da72a2c 100644
--- a/crates/hyperswitch_connectors/src/connectors/opayo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/opayo.rs
@@ -139,6 +139,8 @@ impl ConnectorCommon for Opayo {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/opennode.rs b/crates/hyperswitch_connectors/src/connectors/opennode.rs
index fefd2f77768..56e30ac3426 100644
--- a/crates/hyperswitch_connectors/src/connectors/opennode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/opennode.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Opennode {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rs
index 395fc73808c..0c8577a29d4 100644
--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs
@@ -156,6 +156,8 @@ impl ConnectorCommon for Paybox {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
index ef4e308d968..7da6b6e95ea 100644
--- a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
@@ -715,6 +715,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayboxCaptureResponse, T, PaymentsRespo
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -773,6 +775,8 @@ impl<F> TryFrom<ResponseRouterData<F, PayboxResponse, PaymentsAuthorizeData, Pay
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -802,6 +806,8 @@ impl<F> TryFrom<ResponseRouterData<F, PayboxResponse, PaymentsAuthorizeData, Pay
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -845,6 +851,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayboxSyncResponse, T, PaymentsResponse
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -933,6 +941,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, PayboxSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -964,6 +974,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, TransactionResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -1033,6 +1045,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(response.transaction_number),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rs
index 5621b9d1230..b6266d30d21 100644
--- a/crates/hyperswitch_connectors/src/connectors/payeezy.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs
@@ -149,6 +149,8 @@ impl ConnectorCommon for Payeezy {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/payme.rs b/crates/hyperswitch_connectors/src/connectors/payme.rs
index 9c1a94ad3c0..80dd60c172b 100644
--- a/crates/hyperswitch_connectors/src/connectors/payme.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payme.rs
@@ -149,6 +149,8 @@ impl ConnectorCommon for Payme {
)),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
index 8dd83d1ebd7..180d22b2a75 100644
--- a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
@@ -232,6 +232,8 @@ fn get_pay_sale_error_response(
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(pay_sale_response.payme_sale_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
@@ -314,6 +316,8 @@ fn get_sale_query_error_response(
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(sale_query_response.sale_payme_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
@@ -1033,6 +1037,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, PaymeRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: payme_response.payme_transaction_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
@@ -1104,6 +1110,8 @@ impl TryFrom<PaymentsCancelResponseRouterData<PaymeVoidResponse>> for PaymentsCa
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: payme_response.payme_transaction_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
// Since we are not receiving payme_sale_id, we are not populating the transaction response
@@ -1158,6 +1166,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaymeQueryTransactionResponse, T, Refun
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(pay_sale_response.payme_transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rs
index 1859deeaad1..76283fad3a2 100644
--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs
@@ -178,6 +178,8 @@ impl Paypal {
reason: error_reason.or(Some(response.message)),
attempt_status: None,
connector_transaction_id: response.debug_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -350,6 +352,8 @@ impl ConnectorCommon for Paypal {
reason,
attempt_status: None,
connector_transaction_id: response.debug_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -488,6 +492,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.error_description),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1235,6 +1241,8 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp
.unwrap_or(paypal::AuthenticationStatus::Null),
)),
status_code: res.status_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack.rs b/crates/hyperswitch_connectors/src/connectors/paystack.rs
index 6d6ce2ff83a..2f15b1541a5 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack.rs
@@ -143,6 +143,8 @@ impl ConnectorCommon for Paystack {
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
index 2ced7d44d54..4117f689cb6 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
@@ -144,6 +144,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaystackPaymentsResponse, T, PaymentsRe
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
)
}
@@ -251,6 +253,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaystackPSyncResponse, T, PaymentsRespo
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -348,6 +352,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, PaystackRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -388,6 +394,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, PaystackRefundsResponse>>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rs
index cd8c99b6151..6d09c85d917 100644
--- a/crates/hyperswitch_connectors/src/connectors/payu.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payu.rs
@@ -139,6 +139,8 @@ impl ConnectorCommon for Payu {
reason: response.status.code_literal,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -339,6 +341,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay.rs b/crates/hyperswitch_connectors/src/connectors/placetopay.rs
index 6e593c53e16..54d8ffadf34 100644
--- a/crates/hyperswitch_connectors/src/connectors/placetopay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/placetopay.rs
@@ -134,6 +134,8 @@ impl ConnectorCommon for Placetopay {
reason: Some(response.status.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz.rs b/crates/hyperswitch_connectors/src/connectors/powertranz.rs
index 6d88ac368a0..52db1eb49d2 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz.rs
@@ -147,6 +147,8 @@ impl ConnectorCommon for Powertranz {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
index 03eaa27281c..04df8ee5e54 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
@@ -459,6 +459,8 @@ fn build_error_response(item: &PowertranzBaseResponse, status_code: u16) -> Opti
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
})
} else if !ISO_SUCCESS_CODES.contains(&item.iso_response_code.as_str()) {
@@ -470,6 +472,8 @@ fn build_error_response(item: &PowertranzBaseResponse, status_code: u16) -> Opti
reason: Some(item.response_message.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
index 245eaf73e75..2518f08c69b 100644
--- a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
@@ -141,6 +141,8 @@ impl ConnectorCommon for Prophetpay {
reason: Some(response.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
index cb93caded2c..28f0e4981be 100644
--- a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
@@ -425,6 +425,8 @@ impl<F>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -473,6 +475,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ProphetpaySyncResponse, T, PaymentsResp
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -521,6 +525,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ProphetpayVoidResponse, T, PaymentsResp
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -629,6 +635,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, ProphetpayRefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -669,6 +677,8 @@ impl<T> TryFrom<RefundsResponseRouterData<T, ProphetpayRefundSyncResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
index d5473b260f9..b777aff4d9d 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
@@ -140,6 +140,8 @@ impl ConnectorCommon for Rapyd {
reason: response_data.status.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
index 7d4517e00bd..236d9e55b5a 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
@@ -451,6 +451,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsRespo
reason: data.failure_message.to_owned(),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
_ => {
@@ -495,6 +497,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsRespo
reason: item.response.status.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
),
};
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay.rs b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
index 435ff983c8b..fc7cdeb69ab 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
@@ -160,6 +160,8 @@ impl ConnectorCommon for Razorpay {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
razorpay::ErrorResponse::RazorpayStringError(error_string) => {
@@ -170,6 +172,8 @@ impl ConnectorCommon for Razorpay {
reason: Some(error_string.clone()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
index af9e67f8dbe..214102e42f3 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
@@ -817,6 +817,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, RazorpayPaymentsResponse, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -1273,6 +1275,8 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.refund.unique_request_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index edf5141a11d..450a5ed3097 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -163,6 +163,8 @@ impl ConnectorCommon for Recurly {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rs
index 501182dec07..97f4b4c4b4b 100644
--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Redsys {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs
index 0bf8c4094b1..b85c2472e58 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs
@@ -140,6 +140,8 @@ impl ConnectorCommon for Shift4 {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs
index 9615d4afdd7..6ac3420219d 100644
--- a/crates/hyperswitch_connectors/src/connectors/square.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square.rs
@@ -158,6 +158,8 @@ impl ConnectorCommon for Square {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/stax.rs b/crates/hyperswitch_connectors/src/connectors/stax.rs
index 27be4d309dc..57b8ce1a282 100644
--- a/crates/hyperswitch_connectors/src/connectors/stax.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stax.rs
@@ -135,6 +135,8 @@ impl ConnectorCommon for Stax {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
index e05fb8b8e33..f3d63ed9ea4 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -141,6 +141,8 @@ impl ConnectorCommon for Stripebilling {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
index 30b92d9ceb8..4420384e87f 100644
--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs
+++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Taxjar {
reason: Some(response.detail),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rs
index b26c0e67fec..3e2e2fec33c 100644
--- a/crates/hyperswitch_connectors/src/connectors/thunes.rs
+++ b/crates/hyperswitch_connectors/src/connectors/thunes.rs
@@ -144,6 +144,8 @@ impl ConnectorCommon for Thunes {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
index b3f2c1f9c3e..fed5c109460 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
@@ -177,6 +177,8 @@ impl ConnectorCommon for Trustpay {
.or(response_data.payment_description),
attempt_status: None,
connector_transaction_id: response_data.instance_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
@@ -333,6 +335,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: response.result_info.additional_info,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
index e8da94fae34..0b94b816196 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
@@ -732,6 +732,8 @@ fn handle_cards_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.instance_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -797,6 +799,8 @@ fn handle_bank_redirects_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
let payment_response_data = PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::NoResponseId,
@@ -849,6 +853,8 @@ fn handle_bank_redirects_sync_response(
.payment_request_id
.clone(),
),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -903,6 +909,8 @@ pub fn handle_webhook_response(
status_code,
attempt_status: None,
connector_transaction_id: payment_information.references.payment_request_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1011,6 +1019,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, TrustpayAuthUpdateResponse, T, AccessTo
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
}),
@@ -1482,6 +1492,8 @@ fn handle_cards_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1515,6 +1527,8 @@ fn handle_webhooks_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: response.references.payment_request_id.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1543,6 +1557,8 @@ fn handle_bank_redirects_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1579,6 +1595,8 @@ fn handle_bank_redirects_refund_sync_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1602,6 +1620,8 @@ fn handle_bank_redirects_refund_sync_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
});
//unreachable case as we are sending error as Some()
let refund_response_data = RefundsResponseData {
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
index c2c99c88439..a0e014fd159 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
@@ -238,6 +238,8 @@ fn get_error_response(
status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
index ac634d58aea..61e29203979 100644
--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
@@ -149,6 +149,8 @@ impl ConnectorCommon for UnifiedAuthenticationService {
reason: Some(response.error),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/volt.rs b/crates/hyperswitch_connectors/src/connectors/volt.rs
index cec1194f281..ae3699bcc20 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt.rs
@@ -171,6 +171,8 @@ impl ConnectorCommon for Volt {
reason: Some(reason),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -275,6 +277,8 @@ impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
index 3841b7e33b4..33d174d5db8 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
@@ -354,6 +354,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(payment_response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -395,6 +397,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(webhook_response.payment.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
index 8566ec70341..e58b9d4439a 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
@@ -222,6 +222,8 @@ impl ConnectorCommon for Wellsfargo {
reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::WellsfargoErrorResponse::AuthenticationError(response)) => {
@@ -234,6 +236,8 @@ impl ConnectorCommon for Wellsfargo {
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Ok(transformers::WellsfargoErrorResponse::NotAvailableError(response)) => {
@@ -258,6 +262,8 @@ impl ConnectorCommon for Wellsfargo {
reason: Some(error_response),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(error_msg) => {
@@ -482,6 +488,8 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -562,6 +570,8 @@ impl ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevoke
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..data.clone()
})
@@ -696,6 +706,8 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -890,6 +902,8 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1011,6 +1025,8 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for We
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
index 10c381fa857..b346d396866 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
@@ -1708,10 +1708,10 @@ fn get_error_response_if_failure(
fn get_payment_response(
(info_response, status, http_code): (&WellsfargoPaymentsResponse, enums::AttemptStatus, u16),
-) -> Result<PaymentsResponseData, ErrorResponse> {
+) -> Result<PaymentsResponseData, Box<ErrorResponse>> {
let error_response = get_error_response_if_failure((info_response, status, http_code));
match error_response {
- Some(error) => Err(error),
+ Some(error) => Err(Box::new(error)),
None => {
let incremental_authorization_allowed =
Some(status == enums::AttemptStatus::Authorized);
@@ -1776,7 +1776,8 @@ impl
.unwrap_or(WellsfargoPaymentStatus::StatusNotReceived),
item.data.request.is_auto_capture()?,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
let connector_response = item
.response
.processor_information
@@ -1832,7 +1833,8 @@ impl<F>
.unwrap_or(WellsfargoPaymentStatus::StatusNotReceived),
true,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -1862,7 +1864,8 @@ impl<F>
.unwrap_or(WellsfargoPaymentStatus::StatusNotReceived),
false,
);
- let response = get_payment_response((&item.response, status, item.http_code));
+ let response =
+ get_payment_response((&item.response, status, item.http_code)).map_err(|err| *err);
Ok(Self {
status,
response,
@@ -2376,6 +2379,8 @@ pub fn get_error_response(
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
pub fn get_error_reason(
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
index 41b2207b175..b261343c5b1 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
@@ -156,6 +156,8 @@ impl ConnectorCommon for Worldpay {
reason: response.validation_errors.map(|e| e.to_string()),
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -483,6 +485,8 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
reason: response.validation_errors.map(|e| e.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index 65c884601de..61621b3cc93 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -786,6 +786,8 @@ impl<F, T>
status_code: router_data.http_code,
attempt_status: Some(status),
connector_transaction_id: optional_correlation_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
(_, Some((code, message))) => Err(ErrorResponse {
code,
@@ -794,6 +796,8 @@ impl<F, T>
status_code: router_data.http_code,
attempt_status: Some(status),
connector_transaction_id: optional_correlation_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs
index f1872e31ae7..cd65b25fda4 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs
@@ -154,6 +154,8 @@ impl ConnectorCommon for Xendit {
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
index 47936d43065..30b023e6dc4 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
@@ -330,6 +330,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: Some(item.response.id.clone()),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
let charges = match item.data.request.split_payments.as_ref() {
@@ -439,6 +441,8 @@ impl<F>
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
@@ -572,6 +576,8 @@ impl TryFrom<PaymentsSyncResponseRouterData<XenditResponse>> for PaymentsSyncRou
attempt_status: None,
connector_transaction_id: Some(payment_response.id.clone()),
status_code: item.http_code,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rs
index 70703b31643..71ca8c7758d 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen.rs
@@ -146,6 +146,8 @@ impl ConnectorCommon for Zen {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 305c8518c8e..bec1f6be0a4 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -939,6 +939,8 @@ fn get_zen_response(
status_code,
attempt_status: Some(status),
connector_transaction_id: Some(response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -1085,6 +1087,8 @@ fn get_zen_refund_response(
status_code,
attempt_status: None,
connector_transaction_id: Some(response.id.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rs
index d7c0152b7a6..7ed2a660822 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs
@@ -123,6 +123,8 @@ impl ConnectorCommon for Zsl {
reason: Some(error_reason),
attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
index 8a39901e5de..66bd3eda1d1 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
@@ -349,6 +349,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ZslPaymentsResponse, T, PaymentsRespons
status_code: item.http_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(item.response.mer_ref.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -365,6 +367,8 @@ impl<F, T> TryFrom<ResponseRouterData<F, ZslPaymentsResponse, T, PaymentsRespons
status_code: item.http_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(item.response.mer_ref.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
@@ -443,6 +447,8 @@ impl<F> TryFrom<ResponseRouterData<F, ZslWebhookResponse, PaymentsSyncData, Paym
status_code: item.http_code,
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: Some(item.response.mer_ref.clone()),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index a13f98ed788..fe21b2b72d0 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -336,6 +336,8 @@ pub(crate) fn handle_json_response_deserialization_failure(
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
index fd8e144f4f2..733c6a73c93 100644
--- a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
+++ b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs
@@ -702,6 +702,8 @@ impl From<ApiErrorResponse> for router_data::ErrorResponse {
},
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 70926056957..2dc4eec15f1 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -846,6 +846,8 @@ pub struct PaymentAttempt {
pub capture_before: Option<PrimitiveDateTime>,
pub card_discovery: Option<common_enums::CardDiscovery>,
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
#[cfg(feature = "v1")]
@@ -1239,6 +1241,8 @@ pub enum PaymentAttemptUpdate {
connector_transaction_id: Option<String>,
payment_method_data: Option<serde_json::Value>,
authentication_type: Option<storage_enums::AuthenticationType>,
+ issuer_error_code: Option<String>,
+ issuer_error_message: Option<String>,
},
CaptureUpdate {
amount_to_capture: Option<MinorUnit>,
@@ -1542,6 +1546,8 @@ impl PaymentAttemptUpdate {
connector_transaction_id,
payment_method_data,
authentication_type,
+ issuer_error_code,
+ issuer_error_message,
} => DieselPaymentAttemptUpdate::ErrorUpdate {
connector,
status,
@@ -1555,6 +1561,8 @@ impl PaymentAttemptUpdate {
connector_transaction_id,
payment_method_data,
authentication_type,
+ issuer_error_code,
+ issuer_error_message,
},
Self::CaptureUpdate {
multiple_capture_count,
@@ -1824,6 +1832,8 @@ impl behaviour::Conversion for PaymentAttempt {
processor_transaction_data,
card_discovery: self.card_discovery,
charges: self.charges,
+ issuer_error_code: self.issuer_error_code,
+ issuer_error_message: self.issuer_error_message,
// Below fields are deprecated. Please add any new fields above this line.
connector_transaction_data: None,
})
@@ -1912,6 +1922,8 @@ impl behaviour::Conversion for PaymentAttempt {
capture_before: storage_model.capture_before,
card_discovery: storage_model.card_discovery,
charges: storage_model.charges,
+ issuer_error_code: storage_model.issuer_error_code,
+ issuer_error_message: storage_model.issuer_error_message,
})
}
.await
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 7f1278414ea..6618d2fbc80 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -399,6 +399,8 @@ pub struct ErrorResponse {
pub status_code: u16,
pub attempt_status: Option<common_enums::enums::AttemptStatus>,
pub connector_transaction_id: Option<String>,
+ pub issuer_error_code: Option<String>,
+ pub issuer_error_message: Option<String>,
}
impl Default for ErrorResponse {
@@ -410,6 +412,8 @@ impl Default for ErrorResponse {
status_code: http::StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
@@ -423,6 +427,8 @@ impl ErrorResponse {
status_code: http::StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
@@ -601,6 +607,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(self.status);
@@ -798,6 +806,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(self.status);
@@ -1013,6 +1023,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(common_enums::AttemptStatus::Failure);
@@ -1256,6 +1268,8 @@ impl
status_code: _,
attempt_status,
connector_transaction_id,
+ issuer_error_code: _,
+ issuer_error_message: _,
} = error_response.clone();
let attempt_status = attempt_status.unwrap_or(self.status);
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index cf9b2ff9764..ddc22aa4a52 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -203,6 +203,8 @@ pub trait ConnectorIntegration<T, Req, Resp>:
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
@@ -291,6 +293,8 @@ pub trait ConnectorCommon {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
index bc18f5c6639..e0974f5d04d 100644
--- a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
+++ b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs
@@ -158,6 +158,8 @@ pub trait ConnectorIntegrationV2<Flow, ResourceCommonData, Req, Resp>:
status_code: res.status_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
diff --git a/crates/router/src/connector/adyenplatform.rs b/crates/router/src/connector/adyenplatform.rs
index f95e9cd4d64..5ff89721cb4 100644
--- a/crates/router/src/connector/adyenplatform.rs
+++ b/crates/router/src/connector/adyenplatform.rs
@@ -99,6 +99,8 @@ impl ConnectorCommon for Adyenplatform {
reason: response.detail,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rs
index 226067cef96..f2058c17f6c 100644
--- a/crates/router/src/connector/dummyconnector.rs
+++ b/crates/router/src/connector/dummyconnector.rs
@@ -125,6 +125,8 @@ impl<const T: u8> ConnectorCommon for DummyConnector<T> {
reason: response.error.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/ebanx.rs b/crates/router/src/connector/ebanx.rs
index 01db54c1f67..b38297ed5c7 100644
--- a/crates/router/src/connector/ebanx.rs
+++ b/crates/router/src/connector/ebanx.rs
@@ -124,6 +124,8 @@ impl ConnectorCommon for Ebanx {
reason: response.message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/gpayments.rs b/crates/router/src/connector/gpayments.rs
index 1febbfa7885..2d3b1c37d58 100644
--- a/crates/router/src/connector/gpayments.rs
+++ b/crates/router/src/connector/gpayments.rs
@@ -123,6 +123,8 @@ impl ConnectorCommon for Gpayments {
reason: response.error_detail,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/netcetera.rs b/crates/router/src/connector/netcetera.rs
index 459ac93e068..f1fc94bd482 100644
--- a/crates/router/src/connector/netcetera.rs
+++ b/crates/router/src/connector/netcetera.rs
@@ -111,6 +111,8 @@ impl ConnectorCommon for Netcetera {
reason: response.error_details.error_detail,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/netcetera/transformers.rs b/crates/router/src/connector/netcetera/transformers.rs
index 886dbc18ad4..1169f29563e 100644
--- a/crates/router/src/connector/netcetera/transformers.rs
+++ b/crates/router/src/connector/netcetera/transformers.rs
@@ -110,6 +110,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
};
@@ -179,6 +181,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
};
Ok(Self {
diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rs
index 73aaec55e57..d0cc0f156d7 100644
--- a/crates/router/src/connector/nmi.rs
+++ b/crates/router/src/connector/nmi.rs
@@ -103,6 +103,8 @@ impl ConnectorCommon for Nmi {
code: response.response_code,
attempt_status: None,
connector_transaction_id: Some(response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index d6f1cb1962f..da2649cc444 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -224,6 +224,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
enums::AttemptStatus::Failure,
),
@@ -401,6 +403,8 @@ impl ForeignFrom<(NmiCompleteResponse, u16)> for types::ErrorResponse {
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
@@ -905,6 +909,8 @@ impl ForeignFrom<(StandardResponse, u16)> for types::ErrorResponse {
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(response.transactionid),
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
diff --git a/crates/router/src/connector/payone.rs b/crates/router/src/connector/payone.rs
index 58b179e5799..2e7656f08cf 100644
--- a/crates/router/src/connector/payone.rs
+++ b/crates/router/src/connector/payone.rs
@@ -210,6 +210,8 @@ impl ConnectorCommon for Payone {
),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
None => Ok(ErrorResponse {
status_code: res.status_code,
@@ -218,6 +220,8 @@ impl ConnectorCommon for Payone {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
diff --git a/crates/router/src/connector/plaid.rs b/crates/router/src/connector/plaid.rs
index f24d7bd8d6d..b5428fba4d3 100644
--- a/crates/router/src/connector/plaid.rs
+++ b/crates/router/src/connector/plaid.rs
@@ -133,6 +133,8 @@ impl ConnectorCommon for Plaid {
reason: response.display_message,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/plaid/transformers.rs b/crates/router/src/connector/plaid/transformers.rs
index 4e4fb1863ee..ebab8c185af 100644
--- a/crates/router/src/connector/plaid/transformers.rs
+++ b/crates/router/src/connector/plaid/transformers.rs
@@ -302,6 +302,8 @@ impl<F, T>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionResponse {
@@ -388,6 +390,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, PlaidSyncResponse, T, types::Pay
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionResponse {
diff --git a/crates/router/src/connector/riskified.rs b/crates/router/src/connector/riskified.rs
index 1268e041603..a9585e5d3fd 100644
--- a/crates/router/src/connector/riskified.rs
+++ b/crates/router/src/connector/riskified.rs
@@ -147,6 +147,8 @@ impl ConnectorCommon for Riskified {
message: response.error.message.clone(),
reason: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/signifyd.rs b/crates/router/src/connector/signifyd.rs
index 21452819c39..857dce8c2e3 100644
--- a/crates/router/src/connector/signifyd.rs
+++ b/crates/router/src/connector/signifyd.rs
@@ -108,6 +108,8 @@ impl ConnectorCommon for Signifyd {
reason: Some(response.errors.to_string()),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index a971bd96741..3971ecc7db8 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -129,6 +129,8 @@ impl ConnectorCommon for Stripe {
reason: response.error.message,
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -331,6 +333,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -463,6 +467,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -591,6 +597,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -744,6 +752,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -914,6 +924,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1164,6 +1176,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1291,6 +1305,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1451,6 +1467,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1620,6 +1638,8 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1754,6 +1774,8 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -1908,6 +1930,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -2021,6 +2045,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -2152,6 +2178,8 @@ impl
}),
attempt_status: None,
connector_transaction_id: response.error.payment_intent.map(|pi| pi.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 41fb23e7e9e..39d43bd2e06 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -3158,6 +3158,8 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::RefundsResponseData {
@@ -3193,6 +3195,8 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::RefundsResponseData {
@@ -3549,6 +3553,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, ChargesResponse, T, types::Payme
status_code: item.http_code,
attempt_status: Some(status),
connector_transaction_id: Some(item.response.id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionResponse {
@@ -4169,6 +4175,8 @@ impl ForeignTryFrom<(&Option<ErrorDetails>, u16, String)> for types::PaymentsRes
status_code: http_code,
attempt_status: None,
connector_transaction_id: Some(response_id),
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/threedsecureio.rs b/crates/router/src/connector/threedsecureio.rs
index aec8f780451..09d232c7471 100644
--- a/crates/router/src/connector/threedsecureio.rs
+++ b/crates/router/src/connector/threedsecureio.rs
@@ -122,6 +122,8 @@ impl ConnectorCommon for Threedsecureio {
reason: response.error_description,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
Err(err) => {
diff --git a/crates/router/src/connector/threedsecureio/transformers.rs b/crates/router/src/connector/threedsecureio/transformers.rs
index dc1a90f36e7..faf72a2951b 100644
--- a/crates/router/src/connector/threedsecureio/transformers.rs
+++ b/crates/router/src/connector/threedsecureio/transformers.rs
@@ -124,6 +124,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
};
@@ -205,6 +207,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
ThreedsecureioErrorResponseWrapper::ErrorString(error) => {
@@ -215,6 +219,8 @@ impl
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
},
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 8a186e0291a..5009eaf4daa 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2621,6 +2621,8 @@ impl
status_code: http_code,
attempt_status,
connector_transaction_id,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
}
diff --git a/crates/router/src/connector/wellsfargopayout.rs b/crates/router/src/connector/wellsfargopayout.rs
index 33111ee7be0..5caf3c689b2 100644
--- a/crates/router/src/connector/wellsfargopayout.rs
+++ b/crates/router/src/connector/wellsfargopayout.rs
@@ -132,6 +132,8 @@ impl ConnectorCommon for Wellsfargopayout {
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/connector/wise.rs b/crates/router/src/connector/wise.rs
index e4493f5016f..a1d75f18b2a 100644
--- a/crates/router/src/connector/wise.rs
+++ b/crates/router/src/connector/wise.rs
@@ -113,6 +113,8 @@ impl ConnectorCommon for Wise {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
Ok(types::ErrorResponse {
@@ -122,6 +124,8 @@ impl ConnectorCommon for Wise {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
@@ -132,6 +136,8 @@ impl ConnectorCommon for Wise {
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
}
}
@@ -338,6 +344,8 @@ impl services::ConnectorIntegration<api::PoCancel, types::PayoutsData, types::Pa
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rs
index 7d56c2ccb91..22f1b593f13 100644
--- a/crates/router/src/core/payments/access_token.rs
+++ b/crates/router/src/core/payments/access_token.rs
@@ -233,6 +233,8 @@ pub async fn refresh_connector_auth(
status_code: 504,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
Ok(Err(error_response))
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index bcf0d624ff9..409fccf5e63 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1436,6 +1436,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
connector_transaction_id: err.connector_transaction_id,
payment_method_data: additional_payment_method_data,
authentication_type: auth_update,
+ issuer_error_code: err.issuer_error_code,
+ issuer_error_message: err.issuer_error_message,
}),
)
}
@@ -1473,6 +1475,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
connector_transaction_id,
payment_method_data: None,
authentication_type: auth_update,
+ issuer_error_code: None,
+ issuer_error_message: None,
}),
)
}
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 5fdf14dbf5a..24a3ac2ec86 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -537,6 +537,8 @@ where
connector_transaction_id: error_response.connector_transaction_id.clone(),
payment_method_data: additional_payment_method_data,
authentication_type: auth_update,
+ issuer_error_code: error_response.issuer_error_code.clone(),
+ issuer_error_message: error_response.issuer_error_message.clone(),
};
#[cfg(feature = "v1")]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index d528a320e6d..91afa38b157 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2570,6 +2570,8 @@ where
capture_before: payment_attempt.capture_before,
extended_authorization_applied: payment_attempt.extended_authorization_applied,
card_discovery: payment_attempt.card_discovery,
+ issuer_error_code: payment_attempt.issuer_error_code,
+ issuer_error_message: payment_attempt.issuer_error_message,
};
services::ApplicationResponse::JsonWithHeaders((payments_response, headers))
@@ -2828,7 +2830,9 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
order_tax_amount: None,
connector_mandate_id:None,
shipping_cost: None,
- card_discovery: pa.card_discovery
+ card_discovery: pa.card_discovery,
+ issuer_error_code: pa.issuer_error_code,
+ issuer_error_message: pa.issuer_error_message,
}
}
}
diff --git a/crates/router/src/core/payouts/access_token.rs b/crates/router/src/core/payouts/access_token.rs
index e5e9b47e4ff..52c31e8fa94 100644
--- a/crates/router/src/core/payouts/access_token.rs
+++ b/crates/router/src/core/payouts/access_token.rs
@@ -172,6 +172,8 @@ pub async fn refresh_connector_auth(
status_code: 504,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
Ok(Err(error_response))
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index b850420dfd7..7d663a48a1a 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -238,6 +238,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
errors::ConnectorError::NotSupported { message, connector } => {
@@ -252,6 +254,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
_ => None,
@@ -335,6 +339,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data: None,
unified_code: Some(unified_code),
unified_message: Some(unified_message),
+ issuer_error_code: err.issuer_error_code,
+ issuer_error_message: err.issuer_error_message,
}
}
Ok(response) => {
@@ -366,6 +372,8 @@ pub async fn trigger_refund_to_gateway(
processor_refund_data,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
Ok(()) => {
@@ -680,6 +688,8 @@ pub async fn sync_refund_with_gateway(
processor_refund_data: None,
unified_code: None,
unified_message: None,
+ issuer_error_code: error_message.issuer_error_code,
+ issuer_error_message: error_message.issuer_error_message,
}
}
Ok(response) => match router_data_res.integrity_check.clone() {
@@ -710,6 +720,8 @@ pub async fn sync_refund_with_gateway(
processor_refund_data,
unified_code: None,
unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
}
}
Ok(()) => {
@@ -1265,6 +1277,8 @@ impl ForeignFrom<storage::Refund> for api::RefundResponse {
split_refunds: refund.split_refunds,
unified_code: refund.unified_code,
unified_message: refund.unified_message,
+ issuer_error_code: refund.issuer_error_code,
+ issuer_error_message: refund.issuer_error_message,
}
}
}
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index 07bdfa3f77d..1f54eeb5fdc 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -439,6 +439,8 @@ mod storage {
unified_message: None,
processor_refund_data: new.processor_refund_data.clone(),
processor_transaction_data: new.processor_transaction_data.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
// Below fields are deprecated. Please add any new fields above this line.
connector_refund_data: None,
connector_transaction_data: None,
@@ -939,6 +941,8 @@ impl RefundInterface for MockDb {
unified_message: None,
processor_refund_data: new.processor_refund_data.clone(),
processor_transaction_data: new.processor_transaction_data.clone(),
+ issuer_error_code: None,
+ issuer_error_message: None,
// Below fields are deprecated. Please add any new fields above this line.
connector_refund_data: None,
connector_transaction_data: None,
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index df33e803ab8..e8af5b3b773 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -170,6 +170,8 @@ where
reason: None,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
} else {
None
@@ -359,6 +361,8 @@ where
status_code: 504,
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
router_data.response = Err(error_response);
router_data.connector_http_status_code = Some(504);
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index f9ef4880924..59ee4e4fb38 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -699,6 +699,8 @@ pub fn handle_json_response_deserialization_failure(
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
})
}
}
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index 64c4853d14b..dac001bac9d 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -154,6 +154,8 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
connector_transaction_id: None,
payment_method_data: None,
authentication_type: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
payment_data.payment_attempt = db
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 94dcba750af..0e57540e0ea 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -454,6 +454,8 @@ async fn payments_create_core() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
@@ -721,6 +723,8 @@ async fn payments_create_core_adyen_no_redirect() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
vec![],
));
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 66cd41dbc74..19281b45019 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -215,6 +215,8 @@ async fn payments_create_core() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
let expected_response =
@@ -491,6 +493,8 @@ async fn payments_create_core_adyen_no_redirect() {
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
},
vec![],
));
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 1e4efb2b350..2a637a77e23 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -229,6 +229,8 @@ impl PaymentAttemptInterface for MockDb {
capture_before: payment_attempt.capture_before,
card_discovery: payment_attempt.card_discovery,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
payment_attempts.push(payment_attempt.clone());
Ok(payment_attempt)
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 076b120c2d0..aaa709e7fa7 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -647,6 +647,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
capture_before: payment_attempt.capture_before,
card_discovery: payment_attempt.card_discovery,
charges: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
};
let field = format!("pa_{}", created_attempt.attempt_id);
@@ -1648,6 +1650,8 @@ impl DataModelExt for PaymentAttempt {
processor_transaction_data,
card_discovery: self.card_discovery,
charges: self.charges,
+ issuer_error_code: self.issuer_error_code,
+ issuer_error_message: self.issuer_error_message,
// Below fields are deprecated. Please add any new fields above this line.
connector_transaction_data: None,
}
@@ -1731,6 +1735,8 @@ impl DataModelExt for PaymentAttempt {
capture_before: storage_model.capture_before,
card_discovery: storage_model.card_discovery,
charges: storage_model.charges,
+ issuer_error_code: storage_model.issuer_error_code,
+ issuer_error_message: storage_model.issuer_error_message,
}
}
}
diff --git a/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/down.sql b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/down.sql
new file mode 100644
index 00000000000..06abb6aefbd
--- /dev/null
+++ b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/down.sql
@@ -0,0 +1,7 @@
+ALTER TABLE payment_attempt
+DROP COLUMN IF EXISTS issuer_error_code,
+DROP COLUMN IF EXISTS issuer_error_message;
+
+ALTER TABLE refund
+DROP COLUMN IF EXISTS issuer_error_code,
+DROP COLUMN IF EXISTS issuer_error_message;
\ No newline at end of file
diff --git a/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/up.sql b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/up.sql
new file mode 100644
index 00000000000..80c1bc3742e
--- /dev/null
+++ b/migrations/2025-03-10-060950_add_issuer_code_and_message_in_payment_attempt/up.sql
@@ -0,0 +1,7 @@
+ALTER TABLE payment_attempt
+ADD COLUMN IF NOT EXISTS issuer_error_code VARCHAR(64) DEFAULT NULL,
+ADD COLUMN IF NOT EXISTS issuer_error_message TEXT DEFAULT NULL;
+
+ALTER TABLE refund
+ADD COLUMN IF NOT EXISTS issuer_error_code VARCHAR(64) DEFAULT NULL,
+ADD COLUMN IF NOT EXISTS issuer_error_message TEXT DEFAULT NULL;
\ No newline at end of file
diff --git a/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql
index b0a3f007eee..cbb2b264d45 100644
--- a/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql
+++ b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql
@@ -89,7 +89,9 @@ ALTER TABLE payment_attempt DROP COLUMN attempt_id,
DROP COLUMN authentication_data,
DROP COLUMN payment_method_billing_address_id,
DROP COLUMN connector_mandate_detail,
- DROP COLUMN charge_id;
+ DROP COLUMN charge_id,
+ DROP COLUMN issuer_error_code,
+ DROP COLUMN issuer_error_message;
ALTER TABLE payment_methods
@@ -113,7 +115,9 @@ DROP TYPE IF EXISTS "PaymentMethodIssuerCode";
-- Run below queries only when V1 is deprecated
ALTER TABLE refund DROP COLUMN connector_refund_data,
- DROP COLUMN connector_transaction_data;
+ DROP COLUMN connector_transaction_data,
+ DROP COLUMN issuer_error_code,
+ DROP COLUMN issuer_error_message;
-- Run below queries only when V1 is deprecated
ALTER TABLE captures DROP COLUMN connector_capture_data;
|
feat
|
scheme error code and messages in payments api response (#7528)
|
2351116692a9ee7a799315506f3c47259b396dbc
|
2023-04-11 13:07:28
|
Jagan
|
feat(connector): [Worldpay] add support for webhook (#820)
| false
|
diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rs
index f2975e0166c..aab6bf6a831 100644
--- a/crates/router/src/connector/nuvei.rs
+++ b/crates/router/src/connector/nuvei.rs
@@ -862,10 +862,9 @@ impl api::IncomingWebhook for Nuvei {
_merchant_id: &str,
secret: &[u8],
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
- let body: nuvei::NuveiWebhookDetails = request
- .query_params_json
- .parse_struct("NuveiWebhookDetails")
- .switch()?;
+ let body = serde_urlencoded::from_str::<nuvei::NuveiWebhookDetails>(&request.query_params)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let secret_str = std::str::from_utf8(secret)
.into_report()
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
@@ -887,10 +886,10 @@ impl api::IncomingWebhook for Nuvei {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- let body: nuvei::NuveiWebhookTransactionId = request
- .query_params_json
- .parse_struct("NuveiWebhookTransactionId")
- .switch()?;
+ let body =
+ serde_urlencoded::from_str::<nuvei::NuveiWebhookTransactionId>(&request.query_params)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
types::api::PaymentIdType::ConnectorTransactionId(body.ppp_transaction_id),
))
@@ -900,10 +899,10 @@ impl api::IncomingWebhook for Nuvei {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- let body: nuvei::NuveiWebhookDataStatus = request
- .query_params_json
- .parse_struct("NuveiWebhookDataStatus")
- .switch()?;
+ let body =
+ serde_urlencoded::from_str::<nuvei::NuveiWebhookDataStatus>(&request.query_params)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
match body.status {
nuvei::NuveiWebhookStatus::Approved => {
Ok(api::IncomingWebhookEvent::PaymentIntentSuccess)
@@ -919,10 +918,9 @@ impl api::IncomingWebhook for Nuvei {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<serde_json::Value, errors::ConnectorError> {
- let body: nuvei::NuveiWebhookDetails = request
- .query_params_json
- .parse_struct("NuveiWebhookDetails")
- .switch()?;
+ let body = serde_urlencoded::from_str::<nuvei::NuveiWebhookDetails>(&request.query_params)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let payment_response = nuvei::NuveiPaymentsResponse::from(body);
Encode::<nuvei::NuveiPaymentsResponse>::encode_to_value(&payment_response).switch()
}
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index cd694ca894c..209e4ac2c8e 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -486,15 +486,6 @@ impl common_utils::errors::ErrorSwitch<errors::ConnectorError> for errors::Parsi
}
}
-pub fn to_string<T>(data: &T) -> Result<String, Error>
-where
- T: serde::Serialize,
-{
- serde_json::to_string(data)
- .into_report()
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
-}
-
pub fn base64_decode(data: String) -> Result<Vec<u8>, Error> {
consts::BASE64_ENGINE
.decode(data)
diff --git a/crates/router/src/connector/worldpay.rs b/crates/router/src/connector/worldpay.rs
index c682954b77c..d01987acb12 100644
--- a/crates/router/src/connector/worldpay.rs
+++ b/crates/router/src/connector/worldpay.rs
@@ -4,15 +4,17 @@ mod transformers;
use std::fmt::Debug;
+use common_utils::{crypto, ext_traits::ByteSliceExt};
use error_stack::{IntoReport, ResultExt};
use storage_models::enums;
use transformers as worldpay;
use self::{requests::*, response::*};
-use super::utils::RefundsRequestData;
+use super::utils::{self, RefundsRequestData};
use crate::{
configs::settings,
core::errors::{self, CustomResult},
+ db::StorageInterface,
headers,
services::{self, ConnectorIntegration},
types::{
@@ -20,7 +22,7 @@ use crate::{
api::{self, ConnectorCommon, ConnectorCommonExt},
ErrorResponse, Response,
},
- utils::{self, BytesExt},
+ utils::{self as ext_traits, BytesExt},
};
#[derive(Debug, Clone)]
@@ -384,7 +386,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
) -> CustomResult<Option<String>, errors::ConnectorError> {
let connector_req = WorldpayPaymentsRequest::try_from(req)?;
let worldpay_req =
- utils::Encode::<WorldpayPaymentsRequest>::encode_to_string_of_json(&connector_req)
+ ext_traits::Encode::<WorldpayPaymentsRequest>::encode_to_string_of_json(&connector_req)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(worldpay_req))
}
@@ -458,8 +460,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
req: &types::RefundExecuteRouterData,
) -> CustomResult<Option<String>, errors::ConnectorError> {
let connector_req = WorldpayRefundRequest::try_from(req)?;
- let req = utils::Encode::<WorldpayRefundRequest>::encode_to_string_of_json(&connector_req)
- .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ let req =
+ ext_traits::Encode::<WorldpayRefundRequest>::encode_to_string_of_json(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(req))
}
@@ -593,24 +596,109 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
#[async_trait::async_trait]
impl api::IncomingWebhook for Worldpay {
- fn get_webhook_object_reference_id(
+ fn get_webhook_source_verification_algorithm(
&self,
_request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
+ Ok(Box::new(crypto::Sha256))
+ }
+
+ fn get_webhook_source_verification_signature(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let event_signature =
+ utils::get_header_key_value("Event-Signature", request.headers)?.split(',');
+ let sign_header = event_signature
+ .last()
+ .ok_or_else(|| errors::ConnectorError::WebhookSignatureNotFound)?;
+ let signature = sign_header
+ .split('/')
+ .last()
+ .ok_or_else(|| errors::ConnectorError::WebhookSignatureNotFound)?;
+ hex::decode(signature)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookResponseEncodingFailed)
+ }
+
+ async fn get_webhook_source_verification_merchant_secret(
+ &self,
+ db: &dyn StorageInterface,
+ merchant_id: &str,
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let key = format!("wh_mer_sec_verification_{}_{}", self.id(), merchant_id);
+ let secret = db
+ .get_key(&key)
+ .await
+ .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
+ Ok(secret)
+ }
+
+ fn get_webhook_source_verification_message(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &str,
+ secret: &[u8],
+ ) -> CustomResult<Vec<u8>, errors::ConnectorError> {
+ let secret_str = std::str::from_utf8(secret)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ let to_sign = format!(
+ "{}{}",
+ secret_str,
+ std::str::from_utf8(request.body)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?
+ );
+ Ok(to_sign.into_bytes())
+ }
+
+ fn get_webhook_object_reference_id(
+ &self,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
- Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ let body: WorldpayWebhookTransactionId = request
+ .body
+ .parse_struct("WorldpayWebhookTransactionId")
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
+ types::api::PaymentIdType::ConnectorTransactionId(
+ body.event_details.transaction_reference,
+ ),
+ ))
}
fn get_webhook_event_type(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
- Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ let body: WorldpayWebhookEventType = request
+ .body
+ .parse_struct("WorldpayWebhookEventType")
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ match body.event_details.event_type {
+ EventType::SentForSettlement | EventType::Charged => {
+ Ok(api::IncomingWebhookEvent::PaymentIntentSuccess)
+ }
+ EventType::Error | EventType::Expired => {
+ Ok(api::IncomingWebhookEvent::PaymentIntentFailure)
+ }
+ _ => Err(errors::ConnectorError::WebhookEventTypeNotFound.into()),
+ }
}
fn get_webhook_resource_object(
&self,
- _request: &api::IncomingWebhookRequestDetails<'_>,
+ request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<serde_json::Value, errors::ConnectorError> {
- Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ let body: WorldpayWebhookEventType = request
+ .body
+ .parse_struct("WorldpayWebhookEventType")
+ .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
+ let psync_body = WorldpayEventResponse::try_from(body)?;
+ let res_json = serde_json::to_value(psync_body)
+ .into_report()
+ .change_context(errors::ConnectorError::WebhookResponseEncodingFailed)?;
+ Ok(res_json)
}
}
diff --git a/crates/router/src/connector/worldpay/response.rs b/crates/router/src/connector/worldpay/response.rs
index 9a2facf0e38..8f19ed2a020 100644
--- a/crates/router/src/connector/worldpay/response.rs
+++ b/crates/router/src/connector/worldpay/response.rs
@@ -48,6 +48,8 @@ pub enum EventType {
Refused,
Refunded,
Error,
+ SentForSettlement,
+ Expired,
CaptureFailed,
}
@@ -305,3 +307,39 @@ pub struct WorldpayErrorResponse {
pub message: String,
pub validation_errors: Option<serde_json::Value>,
}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorldpayWebhookTransactionId {
+ pub event_details: EventDetails,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct EventDetails {
+ pub transaction_reference: String,
+ #[serde(rename = "type")]
+ pub event_type: EventType,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorldpayWebhookEventType {
+ pub event_id: String,
+ pub event_timestamp: String,
+ pub event_details: EventDetails,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub enum WorldpayWebhookStatus {
+ SentForSettlement,
+ Authorized,
+ SentForAuthorization,
+ Cancelled,
+ Error,
+ Expired,
+ Refused,
+ SentForRefund,
+ RefundFailed,
+}
diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs
index 37ef7b2b68a..a80af7574ac 100644
--- a/crates/router/src/connector/worldpay/transformers.rs
+++ b/crates/router/src/connector/worldpay/transformers.rs
@@ -122,7 +122,7 @@ impl From<EventType> for enums::AttemptStatus {
EventType::Authorized => Self::Authorized,
EventType::CaptureFailed => Self::CaptureFailed,
EventType::Refused => Self::Failure,
- EventType::Charged => Self::Charged,
+ EventType::Charged | EventType::SentForSettlement => Self::Charged,
_ => Self::Pending,
}
}
@@ -176,3 +176,13 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for WorldpayRefundRequest {
})
}
}
+
+impl TryFrom<WorldpayWebhookEventType> for WorldpayEventResponse {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(event: WorldpayWebhookEventType) -> Result<Self, Self::Error> {
+ Ok(Self {
+ last_event: event.event_details.event_type,
+ links: None,
+ })
+ }
+}
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index 38ec9374e1c..359937bde33 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -1,8 +1,6 @@
pub mod transformers;
pub mod utils;
-use std::collections::HashMap;
-
use error_stack::{IntoReport, ResultExt};
use masking::ExposeInterface;
use router_env::{instrument, tracing};
@@ -488,20 +486,10 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>(
.attach_printable("Failed construction of ConnectorData")?;
let connector = connector.connector;
- let query_params = Some(req.query_string().to_string());
- let qp: HashMap<String, String> =
- url::form_urlencoded::parse(query_params.unwrap_or_default().as_bytes())
- .into_owned()
- .collect();
- let json = Encode::<HashMap<String, String>>::encode_to_string_of_json(&qp)
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("There was an error in parsing the query params")?;
-
let mut request_details = api::IncomingWebhookRequestDetails {
method: req.method().clone(),
headers: req.headers(),
query_params: req.query_string().to_string(),
- query_params_json: json.as_bytes(),
body: &body,
};
diff --git a/crates/router/src/types/api/webhooks.rs b/crates/router/src/types/api/webhooks.rs
index 9374d77de5e..3fc8df5e170 100644
--- a/crates/router/src/types/api/webhooks.rs
+++ b/crates/router/src/types/api/webhooks.rs
@@ -17,7 +17,6 @@ pub struct IncomingWebhookRequestDetails<'a> {
pub headers: &'a actix_web::http::header::HeaderMap,
pub body: &'a [u8],
pub query_params: String,
- pub query_params_json: &'a [u8],
}
#[async_trait::async_trait]
|
feat
|
[Worldpay] add support for webhook (#820)
|
a0fcef3f04cab75cf05154ef16fd26ab5a3783b9
|
2024-02-05 17:51:00
|
Prasunna Soppa
|
fix(connector): [NMI] Handle empty response in psync and error response in complete authorize (#3548)
| false
|
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 5b486aae600..9dce4960f3a 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -2,7 +2,7 @@ use api_models::webhooks;
use cards::CardNumber;
use common_utils::{errors::CustomResult, ext_traits::XmlExt};
use error_stack::{IntoReport, Report, ResultExt};
-use masking::{ExposeInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
@@ -141,7 +141,7 @@ fn get_card_details(
pub struct NmiVaultResponse {
pub response: Response,
pub responsetext: String,
- pub customer_vault_id: Option<String>,
+ pub customer_vault_id: Option<Secret<String>>,
pub response_code: String,
pub transactionid: String,
}
@@ -191,11 +191,14 @@ impl
)?
.to_string(),
currency: currency_data,
- customer_vault_id: item.response.customer_vault_id.ok_or(
- errors::ConnectorError::MissingRequiredField {
+ customer_vault_id: item
+ .response
+ .customer_vault_id
+ .ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "customer_vault_id",
- },
- )?,
+ })?
+ .peek()
+ .to_string(),
public_key: auth_type.public_key.ok_or(
errors::ConnectorError::InvalidConnectorConfig {
config: "public_key",
@@ -237,40 +240,27 @@ pub struct NmiCompleteRequest {
#[serde(rename = "type")]
transaction_type: TransactionType,
security_key: Secret<String>,
- orderid: String,
+ orderid: Option<String>,
ccnumber: CardNumber,
ccexp: Secret<String>,
- cardholder_auth: CardHolderAuthType,
- cavv: String,
- xid: String,
- three_ds_version: Option<ThreeDsVersion>,
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "lowercase")]
-pub enum CardHolderAuthType {
- Verified,
- Attempted,
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub enum ThreeDsVersion {
- #[serde(rename = "2.0.0")]
- VersionTwo,
- #[serde(rename = "2.1.0")]
- VersionTwoPointOne,
- #[serde(rename = "2.2.0")]
- VersionTwoPointTwo,
+ cardholder_auth: Option<String>,
+ cavv: Option<String>,
+ xid: Option<String>,
+ eci: Option<String>,
+ three_ds_version: Option<String>,
+ directory_server_id: Option<String>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NmiRedirectResponseData {
- cavv: String,
- xid: String,
- card_holder_auth: CardHolderAuthType,
- three_ds_version: Option<ThreeDsVersion>,
- order_id: String,
+ cavv: Option<String>,
+ xid: Option<String>,
+ eci: Option<String>,
+ card_holder_auth: Option<String>,
+ three_ds_version: Option<String>,
+ order_id: Option<String>,
+ directory_server_id: Option<String>,
}
impl TryFrom<&NmiRouterData<&types::PaymentsCompleteAuthorizeRouterData>> for NmiCompleteRequest {
@@ -308,7 +298,9 @@ impl TryFrom<&NmiRouterData<&types::PaymentsCompleteAuthorizeRouterData>> for Nm
cardholder_auth: three_ds_data.card_holder_auth,
cavv: three_ds_data.cavv,
xid: three_ds_data.xid,
+ eci: three_ds_data.eci,
three_ds_version: three_ds_data.three_ds_version,
+ directory_server_id: three_ds_data.directory_server_id,
})
}
}
@@ -881,21 +873,22 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<types::Response>>
item: types::PaymentsSyncResponseRouterData<types::Response>,
) -> Result<Self, Self::Error> {
let response = SyncResponse::try_from(item.response.response.to_vec())?;
- Ok(Self {
- status: enums::AttemptStatus::from(NmiStatus::from(response.transaction.condition)),
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- response.transaction.transaction_id,
- ),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
+ match response.transaction {
+ Some(trn) => Ok(Self {
+ status: enums::AttemptStatus::from(NmiStatus::from(trn.condition)),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(trn.transaction_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
}),
- ..item.data
- })
+ None => Ok(Self { ..item.data }), //when there is empty connector response i.e. response we get in psync when payment status is in authentication_pending
+ }
}
}
@@ -1081,7 +1074,7 @@ pub struct SyncTransactionResponse {
#[derive(Debug, Deserialize, Serialize)]
pub struct SyncResponse {
- pub transaction: SyncTransactionResponse,
+ pub transaction: Option<SyncTransactionResponse>,
}
#[derive(Debug, Deserialize)]
@@ -1199,10 +1192,10 @@ pub struct NmiWebhookObject {
impl TryFrom<&NmiWebhookBody> for SyncResponse {
type Error = Error;
fn try_from(item: &NmiWebhookBody) -> Result<Self, Self::Error> {
- let transaction = SyncTransactionResponse {
+ let transaction = Some(SyncTransactionResponse {
transaction_id: item.event_body.transaction_id.to_owned(),
condition: item.event_body.condition.to_owned(),
- };
+ });
Ok(Self { transaction })
}
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index aec0b9bde9e..13f57cafc67 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -1715,6 +1715,18 @@ pub fn build_redirection_form(
item2.value=e.xid;
responseForm.appendChild(item2);
+ var item6=document.createElement('input');
+ item6.type='hidden';
+ item6.name='eci';
+ item6.value=e.eci;
+ responseForm.appendChild(item6);
+
+ var item7=document.createElement('input');
+ item7.type='hidden';
+ item7.name='directoryServerId';
+ item7.value=e.directoryServerId;
+ responseForm.appendChild(item7);
+
var item3=document.createElement('input');
item3.type='hidden';
item3.name='cardHolderAuth';
|
fix
|
[NMI] Handle empty response in psync and error response in complete authorize (#3548)
|
23458bc42776e6440e76d324d37f36b65c393451
|
2023-06-02 15:35:52
|
Shankar Singh C
|
fix(locker): remove unnecessary assertions for locker_id on BasiliskLocker when saving cards (#1337)
| false
|
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index cba6aef7302..499056aa4e5 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -262,12 +262,6 @@ pub async fn add_card_hs(
let db = &*state.store;
let merchant_id = &merchant_account.merchant_id;
- let _ = merchant_account
- .locker_id
- .to_owned()
- .get_required_value("locker_id")
- .change_context(errors::VaultError::SaveCardFailed)?;
-
let request =
payment_methods::mk_add_card_request_hs(jwekey, locker, &card, &customer_id, merchant_id)
.await?;
|
fix
|
remove unnecessary assertions for locker_id on BasiliskLocker when saving cards (#1337)
|
d7affab455adf1eeccaca3005797a81e51c902ac
|
2023-09-25 20:03:33
|
github-actions
|
test(postman): update postman collection files
| false
|
diff --git a/postman/collection-json/aci.postman_collection.json b/postman/collection-json/aci.postman_collection.json
index 233e1afe35d..9d58d212f97 100644
--- a/postman/collection-json/aci.postman_collection.json
+++ b/postman/collection-json/aci.postman_collection.json
@@ -302,7 +302,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/adyen_uk.postman_collection.json b/postman/collection-json/adyen_uk.postman_collection.json
index bdb3f2e55de..7f033755351 100644
--- a/postman/collection-json/adyen_uk.postman_collection.json
+++ b/postman/collection-json/adyen_uk.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/airwallex.postman_collection.json b/postman/collection-json/airwallex.postman_collection.json
index 3ddbfcce073..7a0d9164e92 100644
--- a/postman/collection-json/airwallex.postman_collection.json
+++ b/postman/collection-json/airwallex.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/authorizedotnet.postman_collection.json b/postman/collection-json/authorizedotnet.postman_collection.json
index f195fa2ecf2..3f497d56f3c 100644
--- a/postman/collection-json/authorizedotnet.postman_collection.json
+++ b/postman/collection-json/authorizedotnet.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/bambora.postman_collection.json b/postman/collection-json/bambora.postman_collection.json
index c97bc777956..d9161f7929c 100644
--- a/postman/collection-json/bambora.postman_collection.json
+++ b/postman/collection-json/bambora.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/bambora_3ds.postman_collection.json b/postman/collection-json/bambora_3ds.postman_collection.json
index 2d55bd69b19..ca4999c9dfd 100644
--- a/postman/collection-json/bambora_3ds.postman_collection.json
+++ b/postman/collection-json/bambora_3ds.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/bluesnap.postman_collection.json b/postman/collection-json/bluesnap.postman_collection.json
index 0ccda08a172..d2073774a70 100644
--- a/postman/collection-json/bluesnap.postman_collection.json
+++ b/postman/collection-json/bluesnap.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/braintree.postman_collection.json b/postman/collection-json/braintree.postman_collection.json
index 73332af2d2a..dce605f85c7 100644
--- a/postman/collection-json/braintree.postman_collection.json
+++ b/postman/collection-json/braintree.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/checkout.postman_collection.json b/postman/collection-json/checkout.postman_collection.json
index 827b4ba18d6..c4d3ac5f089 100644
--- a/postman/collection-json/checkout.postman_collection.json
+++ b/postman/collection-json/checkout.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/forte.postman_collection.json b/postman/collection-json/forte.postman_collection.json
index 049493d5af3..cdf381f9f2d 100644
--- a/postman/collection-json/forte.postman_collection.json
+++ b/postman/collection-json/forte.postman_collection.json
@@ -294,7 +294,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/globalpay.postman_collection.json b/postman/collection-json/globalpay.postman_collection.json
index 386ab0ed558..2a2d27a87ca 100644
--- a/postman/collection-json/globalpay.postman_collection.json
+++ b/postman/collection-json/globalpay.postman_collection.json
@@ -294,7 +294,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/hyperswitch.postman_collection.json b/postman/collection-json/hyperswitch.postman_collection.json
index 9e29a17a252..ab710ca4316 100644
--- a/postman/collection-json/hyperswitch.postman_collection.json
+++ b/postman/collection-json/hyperswitch.postman_collection.json
@@ -522,7 +522,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
@@ -1803,7 +1803,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
@@ -4686,7 +4686,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/mollie.postman_collection.json b/postman/collection-json/mollie.postman_collection.json
index 214990c8b3d..f956058b5ca 100644
--- a/postman/collection-json/mollie.postman_collection.json
+++ b/postman/collection-json/mollie.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/multisafepay.postman_collection.json b/postman/collection-json/multisafepay.postman_collection.json
index 3e2f0000491..8ba70b7c654 100644
--- a/postman/collection-json/multisafepay.postman_collection.json
+++ b/postman/collection-json/multisafepay.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/nexinets.postman_collection.json b/postman/collection-json/nexinets.postman_collection.json
index 0e899cd3d98..cb74918d194 100644
--- a/postman/collection-json/nexinets.postman_collection.json
+++ b/postman/collection-json/nexinets.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/nmi.postman_collection.json b/postman/collection-json/nmi.postman_collection.json
index 5e825518018..f09c6bfc1b9 100644
--- a/postman/collection-json/nmi.postman_collection.json
+++ b/postman/collection-json/nmi.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/payme.postman_collection.json b/postman/collection-json/payme.postman_collection.json
index 6446832e17b..4bca668a6af 100644
--- a/postman/collection-json/payme.postman_collection.json
+++ b/postman/collection-json/payme.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/paypal.postman_collection.json b/postman/collection-json/paypal.postman_collection.json
index 46cc8dc53a8..de2fa2a3a53 100644
--- a/postman/collection-json/paypal.postman_collection.json
+++ b/postman/collection-json/paypal.postman_collection.json
@@ -294,7 +294,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/powertranz.postman_collection.json b/postman/collection-json/powertranz.postman_collection.json
index ac39b8d4709..ad81a38c1f0 100644
--- a/postman/collection-json/powertranz.postman_collection.json
+++ b/postman/collection-json/powertranz.postman_collection.json
@@ -294,7 +294,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/rapyd.postman_collection.json b/postman/collection-json/rapyd.postman_collection.json
index b80c2786f80..b3d6a9416f8 100644
--- a/postman/collection-json/rapyd.postman_collection.json
+++ b/postman/collection-json/rapyd.postman_collection.json
@@ -294,7 +294,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/shift4.postman_collection.json b/postman/collection-json/shift4.postman_collection.json
index 37e19d7feaa..13b4f25c3c6 100644
--- a/postman/collection-json/shift4.postman_collection.json
+++ b/postman/collection-json/shift4.postman_collection.json
@@ -294,7 +294,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 6434d25f2f4..85017bf2764 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -531,7 +531,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
@@ -1812,7 +1812,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
@@ -4896,7 +4896,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/trustpay.postman_collection.json b/postman/collection-json/trustpay.postman_collection.json
index 058c09dda89..792ec761001 100644
--- a/postman/collection-json/trustpay.postman_collection.json
+++ b/postman/collection-json/trustpay.postman_collection.json
@@ -300,7 +300,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/worldline.postman_collection.json b/postman/collection-json/worldline.postman_collection.json
index 6641a4cef98..7b1a9d027ba 100644
--- a/postman/collection-json/worldline.postman_collection.json
+++ b/postman/collection-json/worldline.postman_collection.json
@@ -303,7 +303,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
diff --git a/postman/collection-json/zen.postman_collection.json b/postman/collection-json/zen.postman_collection.json
index 5ac7216aff2..6e7f7a3ef6b 100644
--- a/postman/collection-json/zen.postman_collection.json
+++ b/postman/collection-json/zen.postman_collection.json
@@ -306,7 +306,7 @@
],
"body": {
"mode": "raw",
- "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2023-09-23T01:02:03.000Z\"}"
+ "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}"
},
"url": {
"raw": "{{baseUrl}}/api_keys/:merchant_id",
|
test
|
update postman collection files
|
b96652507a6ab37f3c75aeb0cf715fd6454b9f32
|
2023-06-05 13:04:09
|
Pa1NarK
|
fix(Connector): [Adyen] Address Internal Server Error when calling PSync without redirection (#1311)
| false
|
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 380a96c6b57..149beb97c65 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -310,12 +310,19 @@ impl
&self,
req: &types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,
) -> CustomResult<Option<String>, errors::ConnectorError> {
+ // Adyen doesn't support PSync flow. We use PSync flow to fetch payment details,
+ // specifically the redirect URL that takes the user to their Payment page. In non-redirection flows,
+ // we rely on webhooks to obtain the payment status since there is no encoded data available.
+ // encoded_data only includes the redirect URL and is only relevant in redirection flows.
let encoded_data = req
.request
.encoded_data
.clone()
.get_required_value("encoded_data")
- .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ .change_context(errors::ConnectorError::FlowNotSupported {
+ flow: String::from("PSync"),
+ connector: self.id().to_string(),
+ })?;
let adyen_redirection_type = serde_urlencoded::from_str::<
transformers::AdyenRedirectRequestTypes,
|
fix
|
[Adyen] Address Internal Server Error when calling PSync without redirection (#1311)
|
366596f14d6c874a8e2d418a99beb90046c5b040
|
2024-05-09 18:36:38
|
DEEPANSHU BANSAL
|
fix(connector): [BAMBORA] Audit Fixes for Bambora (#4604)
| false
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 61d74863422..d9e7ec58f75 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -398,26 +398,9 @@ merchant_secret="Source verification key"
payment_method_type = "CartesBancaires"
[[bambora.debit]]
payment_method_type = "UnionPay"
-[[bambora.wallet]]
- payment_method_type = "apple_pay"
-[[bambora.wallet]]
- payment_method_type = "paypal"
[bambora.connector_auth.BodyKey]
api_key="Passcode"
key1="Merchant Id"
-[bambora.connector_webhook_details]
-merchant_secret="Source verification key"
-[bambora.metadata.apple_pay.session_token_data]
-certificate="Merchant Certificate (Base64 Encoded)"
-certificate_keys="Merchant PrivateKey (Base64 Encoded)"
-merchant_identifier="Apple Merchant Identifier"
-display_name="Display Name"
-initiative="Domain"
-initiative_context="Domain Name"
-[bambora.metadata.apple_pay.payment_request_data]
-supported_networks=["visa","masterCard","amex","discover"]
-merchant_capabilities=["supports3DS"]
-label="apple"
[bankofamerica]
[[bankofamerica.credit]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 10cd9d6f7cf..202bce64c1f 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -416,27 +416,9 @@ merchant_config_currency="Currency"
payment_method_type = "CartesBancaires"
[[bambora.debit]]
payment_method_type = "UnionPay"
-[[bambora.wallet]]
- payment_method_type = "apple_pay"
-[[bambora.wallet]]
- payment_method_type = "paypal"
[bambora.connector_auth.BodyKey]
api_key="Passcode"
key1="Merchant Id"
-[bambora.connector_webhook_details]
-merchant_secret="Source verification key"
-
-[bambora.metadata.apple_pay.session_token_data]
-certificate="Merchant Certificate (Base64 Encoded)"
-certificate_keys="Merchant PrivateKey (Base64 Encoded)"
-merchant_identifier="Apple Merchant Identifier"
-display_name="Display Name"
-initiative="Domain"
-initiative_context="Domain Name"
-[bambora.metadata.apple_pay.payment_request_data]
-supported_networks=["visa","masterCard","amex","discover"]
-merchant_capabilities=["supports3DS"]
-label="apple"
[bankofamerica]
[[bankofamerica.credit]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 7f4935d4887..450e14d1080 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -398,26 +398,9 @@ merchant_secret="Source verification key"
payment_method_type = "CartesBancaires"
[[bambora.debit]]
payment_method_type = "UnionPay"
-[[bambora.wallet]]
- payment_method_type = "apple_pay"
-[[bambora.wallet]]
- payment_method_type = "paypal"
[bambora.connector_auth.BodyKey]
api_key="Passcode"
key1="Merchant Id"
-[bambora.connector_webhook_details]
-merchant_secret="Source verification key"
-[bambora.metadata.apple_pay.session_token_data]
-certificate="Merchant Certificate (Base64 Encoded)"
-certificate_keys="Merchant PrivateKey (Base64 Encoded)"
-merchant_identifier="Apple Merchant Identifier"
-display_name="Display Name"
-initiative="Domain"
-initiative_context="Domain Name"
-[bambora.metadata.apple_pay.payment_request_data]
-supported_networks=["visa","masterCard","amex","discover"]
-merchant_capabilities=["supports3DS"]
-label="apple"
[bankofamerica]
[[bankofamerica.credit]]
diff --git a/crates/router/src/connector/bambora.rs b/crates/router/src/connector/bambora.rs
index 7ff352416cd..684c5ddc1ce 100644
--- a/crates/router/src/connector/bambora.rs
+++ b/crates/router/src/connector/bambora.rs
@@ -10,10 +10,7 @@ use transformers as bambora;
use super::utils::RefundsRequestData;
use crate::{
configs::settings,
- connector::{
- utils as connector_utils,
- utils::{to_connector_meta, PaymentsAuthorizeRequestData, PaymentsSyncRequestData},
- },
+ connector::{utils as connector_utils, utils::to_connector_meta},
core::{
errors::{self, CustomResult},
payments,
@@ -36,6 +33,20 @@ use crate::{
#[derive(Debug, Clone)]
pub struct Bambora;
+impl api::Payment for Bambora {}
+impl api::PaymentToken for Bambora {}
+impl api::PaymentAuthorize for Bambora {}
+impl api::PaymentVoid for Bambora {}
+impl api::MandateSetup for Bambora {}
+impl api::ConnectorAccessToken for Bambora {}
+impl api::PaymentSync for Bambora {}
+impl api::PaymentCapture for Bambora {}
+impl api::PaymentSession for Bambora {}
+impl api::Refund for Bambora {}
+impl api::RefundExecute for Bambora {}
+impl api::RefundSync for Bambora {}
+impl api::PaymentsCompleteAuthorize for Bambora {}
+
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Bambora
where
Self: ConnectorIntegration<Flow, Request, Response>,
@@ -102,8 +113,9 @@ impl ConnectorCommon for Bambora {
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code.to_string(),
- message: response.message,
- reason: Some(serde_json::to_string(&response.details).unwrap_or_default()),
+ message: serde_json::to_string(&response.details)
+ .unwrap_or(crate::consts::NO_ERROR_MESSAGE.to_string()),
+ reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
})
@@ -126,10 +138,6 @@ impl ConnectorValidation for Bambora {
}
}
-impl api::Payment for Bambora {}
-
-impl api::PaymentToken for Bambora {}
-
impl
ConnectorIntegration<
api::PaymentMethodToken,
@@ -140,7 +148,17 @@ impl
// Not Implemented (R)
}
-impl api::MandateSetup for Bambora {}
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for Bambora
+{
+}
+
+impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
+ for Bambora
+{
+ //TODO: implement sessions flow
+}
+
impl
ConnectorIntegration<
api::SetupMandate,
@@ -164,14 +182,12 @@ impl
}
}
-impl api::PaymentVoid for Bambora {}
-
-impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
+impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
for Bambora
{
fn get_headers(
&self,
- req: &types::PaymentsCancelRouterData,
+ req: &types::PaymentsAuthorizeRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
@@ -183,82 +199,68 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
fn get_url(
&self,
- req: &types::PaymentsCancelRouterData,
+ _req: &types::PaymentsAuthorizeRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let connector_payment_id = req.request.connector_transaction_id.clone();
- Ok(format!(
- "{}/v1/payments/{}{}",
- self.base_url(connectors),
- connector_payment_id,
- "/void"
- ))
+ Ok(format!("{}{}", self.base_url(connectors), "/v1/payments"))
}
fn get_request_body(
&self,
- req: &types::PaymentsCancelRouterData,
+ req: &types::PaymentsAuthorizeRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_router_data = bambora::BamboraRouterData::try_from((
&self.get_currency_unit(),
- req.request
- .currency
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "Currency",
- })?,
- req.request
- .amount
- .ok_or(errors::ConnectorError::MissingRequiredField {
- field_name: "Amount",
- })?,
+ req.request.currency,
+ req.request.amount,
req,
))?;
- let connector_req = bambora::BamboraVoidRequest::try_from(connector_router_data)?;
-
+ let connector_req = bambora::BamboraPaymentsRequest::try_from(connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
- req: &types::PaymentsCancelRouterData,
+ req: &types::PaymentsAuthorizeRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
- .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
.attach_default_headers()
- .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
- .set_body(self.get_request_body(req, connectors)?)
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
.build(),
))
}
fn handle_response(
&self,
- data: &types::PaymentsCancelRouterData,
+ data: &types::PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
- ) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {
+ ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: bambora::BamboraResponse = res
.response
- .parse_struct("bambora PaymentsResponse")
+ .parse_struct("PaymentIntentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
event_builder.map(|i| 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,
- },
- bambora::PaymentFlow::Void,
- ))
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
}
fn get_error_response(
@@ -270,14 +272,99 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
}
}
-impl api::ConnectorAccessToken for Bambora {}
-
-impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
- for Bambora
+impl
+ ConnectorIntegration<
+ api::CompleteAuthorize,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ > for Bambora
{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ let meta: bambora::BamboraMeta = to_connector_meta(req.request.connector_meta.clone())?;
+ Ok(format!(
+ "{}/v1/payments/{}{}",
+ self.base_url(connectors),
+ meta.three_d_session_data,
+ "/continue"
+ ))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = bambora::BamboraThreedsContinueRequest::try_from(&req.request)?;
+
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ let request = services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsCompleteAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .headers(types::PaymentsCompleteAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsCompleteAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
+ let response: bambora::BamboraPaymentsResponse = res
+ .response
+ .parse_struct("BamboraPaymentsResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| 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,
+ })
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
}
-impl api::PaymentSync for Bambora {}
impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
for Bambora
{
@@ -304,10 +391,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
.get_connector_transaction_id()
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
Ok(format!(
- "{}{}{}",
+ "{}/v1/payments/{connector_payment_id}",
self.base_url(connectors),
- "/v1/payments/",
- connector_payment_id
))
}
@@ -340,7 +425,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
- let response: bambora::BamboraResponse = res
+ let response: bambora::BamboraPaymentsResponse = res
.response
.parse_struct("bambora PaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -348,19 +433,15 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
event_builder.map(|i| 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,
- },
- get_payment_flow(data.request.is_auto_capture()?),
- ))
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
}
-impl api::PaymentCapture for Bambora {}
impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
for Bambora
{
@@ -382,11 +463,9 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
- "{}{}{}{}",
+ "{}/v1/payments/{}/completions",
self.base_url(connectors),
- "/v1/payments/",
req.request.connector_transaction_id,
- "/completions"
))
}
@@ -431,7 +510,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
- let response: bambora::BamboraResponse = res
+ let response: bambora::BamboraPaymentsResponse = res
.response
.parse_struct("Bambora PaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@@ -439,14 +518,11 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
event_builder.map(|i| 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,
- },
- bambora::PaymentFlow::Capture,
- ))
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
@@ -459,22 +535,12 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
}
}
-impl api::PaymentSession for Bambora {}
-
-impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
- for Bambora
-{
- //TODO: implement sessions flow
-}
-
-impl api::PaymentAuthorize for Bambora {}
-
-impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
+impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
for Bambora
{
fn get_headers(
&self,
- req: &types::PaymentsAuthorizeRouterData,
+ req: &types::PaymentsCancelRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
@@ -486,72 +552,77 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn get_url(
&self,
- _req: &types::PaymentsAuthorizeRouterData,
+ req: &types::PaymentsCancelRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Ok(format!("{}{}", self.base_url(connectors), "/v1/payments"))
+ let connector_payment_id = req.request.connector_transaction_id.clone();
+ Ok(format!(
+ "{}/v1/payments/{}/void",
+ self.base_url(connectors),
+ connector_payment_id,
+ ))
}
fn get_request_body(
&self,
- req: &types::PaymentsAuthorizeRouterData,
+ req: &types::PaymentsCancelRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_router_data = bambora::BamboraRouterData::try_from((
&self.get_currency_unit(),
- req.request.currency,
- req.request.amount,
+ req.request
+ .currency
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "Currency",
+ })?,
+ req.request
+ .amount
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "Amount",
+ })?,
req,
))?;
- let connector_req = bambora::BamboraPaymentsRequest::try_from(connector_router_data)?;
+ let connector_req = bambora::BamboraVoidRequest::try_from(connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
- req: &types::PaymentsAuthorizeRouterData,
+ req: &types::PaymentsCancelRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
- .url(&types::PaymentsAuthorizeType::get_url(
- self, req, connectors,
- )?)
+ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
- .headers(types::PaymentsAuthorizeType::get_headers(
- self, req, connectors,
- )?)
- .set_body(types::PaymentsAuthorizeType::get_request_body(
- self, req, connectors,
- )?)
+ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+ .set_body(self.get_request_body(req, connectors)?)
.build(),
))
}
fn handle_response(
&self,
- data: &types::PaymentsAuthorizeRouterData,
+ data: &types::PaymentsCancelRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
- ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: bambora::BamboraResponse = res
+ ) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {
+ let response: bambora::BamboraPaymentsResponse = res
.response
- .parse_struct("PaymentIntentResponse")
+ .parse_struct("bambora PaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| 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,
- },
- get_payment_flow(data.request.is_auto_capture()?),
- ))
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
@@ -564,9 +635,22 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
}
}
-impl api::Refund for Bambora {}
-impl api::RefundExecute for Bambora {}
-impl api::RefundSync for Bambora {}
+impl services::ConnectorRedirectResponse for Bambora {
+ fn get_flow_type(
+ &self,
+ _query_params: &str,
+ _json_payload: Option<serde_json::Value>,
+ action: services::PaymentAction,
+ ) -> CustomResult<payments::CallConnectorAction, errors::ConnectorError> {
+ match action {
+ services::PaymentAction::PSync
+ | services::PaymentAction::CompleteAuthorize
+ | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => {
+ Ok(payments::CallConnectorAction::Trigger)
+ }
+ }
+ }
+}
impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData>
for Bambora
@@ -590,11 +674,9 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
) -> CustomResult<String, errors::ConnectorError> {
let connector_payment_id = req.request.connector_transaction_id.clone();
Ok(format!(
- "{}{}{}{}",
+ "{}/v1/payments/{}/returns",
self.base_url(connectors),
- "/v1/payments/",
connector_payment_id,
- "/returns"
))
}
@@ -684,9 +766,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
let _connector_payment_id = req.request.connector_transaction_id.clone();
let connector_refund_id = req.request.get_connector_refund_id()?;
Ok(format!(
- "{}{}{}",
+ "{}/v1/payments/{}",
self.base_url(connectors),
- "/v1/payments/",
connector_refund_id
))
}
@@ -760,126 +841,3 @@ impl api::IncomingWebhook for Bambora {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
}
-
-pub fn get_payment_flow(is_auto_capture: bool) -> bambora::PaymentFlow {
- if is_auto_capture {
- bambora::PaymentFlow::Capture
- } else {
- bambora::PaymentFlow::Authorize
- }
-}
-
-impl services::ConnectorRedirectResponse for Bambora {
- fn get_flow_type(
- &self,
- _query_params: &str,
- _json_payload: Option<serde_json::Value>,
- action: services::PaymentAction,
- ) -> CustomResult<payments::CallConnectorAction, errors::ConnectorError> {
- match action {
- services::PaymentAction::PSync
- | services::PaymentAction::CompleteAuthorize
- | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => {
- Ok(payments::CallConnectorAction::Trigger)
- }
- }
- }
-}
-
-impl api::PaymentsCompleteAuthorize for Bambora {}
-
-impl
- ConnectorIntegration<
- api::CompleteAuthorize,
- types::CompleteAuthorizeData,
- types::PaymentsResponseData,
- > for Bambora
-{
- fn get_headers(
- &self,
- req: &types::PaymentsCompleteAuthorizeRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- self.build_headers(req, connectors)
- }
-
- fn get_content_type(&self) -> &'static str {
- self.common_get_content_type()
- }
-
- fn get_url(
- &self,
- req: &types::PaymentsCompleteAuthorizeRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<String, errors::ConnectorError> {
- let meta: bambora::BamboraMeta = to_connector_meta(req.request.connector_meta.clone())?;
- Ok(format!(
- "{}/v1/payments/{}{}",
- self.base_url(connectors),
- meta.three_d_session_data,
- "/continue"
- ))
- }
-
- fn get_request_body(
- &self,
- req: &types::PaymentsCompleteAuthorizeRouterData,
- _connectors: &settings::Connectors,
- ) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_req = bambora::BamboraThreedsContinueRequest::try_from(&req.request)?;
-
- Ok(RequestContent::Json(Box::new(connector_req)))
- }
-
- fn build_request(
- &self,
- req: &types::PaymentsCompleteAuthorizeRouterData,
- connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
- let request = services::RequestBuilder::new()
- .method(services::Method::Post)
- .url(&types::PaymentsCompleteAuthorizeType::get_url(
- self, req, connectors,
- )?)
- .headers(types::PaymentsCompleteAuthorizeType::get_headers(
- self, req, connectors,
- )?)
- .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
- self, req, connectors,
- )?)
- .build();
- Ok(Some(request))
- }
-
- fn handle_response(
- &self,
- data: &types::PaymentsCompleteAuthorizeRouterData,
- event_builder: Option<&mut ConnectorEvent>,
- res: Response,
- ) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
- let response: bambora::BamboraResponse = res
- .response
- .parse_struct("Bambora PaymentsResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- event_builder.map(|i| 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,
- },
- bambora::PaymentFlow::Capture,
- ))
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
- }
-
- fn get_error_response(
- &self,
- res: Response,
- event_builder: Option<&mut ConnectorEvent>,
- ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- self.build_error_response(res, event_builder)
- }
-}
diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rs
index 77c91af709d..61ed8bd1ee4 100644
--- a/crates/router/src/connector/bambora/transformers.rs
+++ b/crates/router/src/connector/bambora/transformers.rs
@@ -7,7 +7,8 @@ use serde::{Deserialize, Deserializer, Serialize};
use crate::{
connector::utils::{
AddressDetailsData, BrowserInformationData, CardData as OtherCardData,
- PaymentsAuthorizeRequestData, RouterData,
+ PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData,
+ PaymentsSyncRequestData, RouterData,
},
consts,
core::errors,
@@ -135,16 +136,24 @@ impl TryFrom<BamboraRouterData<&types::PaymentsAuthorizeRouterData>> for Bambora
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
domain::PaymentMethodData::Card(req_card) => {
- let three_ds = match item.router_data.auth_type {
- enums::AuthenticationType::ThreeDs => Some(ThreeDSecure {
- enabled: true,
- browser: get_browser_info(item.router_data)?,
- version: Some(2),
- auth_required: Some(true),
- }),
- enums::AuthenticationType::NoThreeDs => None,
+ let (three_ds, customer_ip) = match item.router_data.auth_type {
+ enums::AuthenticationType::ThreeDs => (
+ Some(ThreeDSecure {
+ enabled: true,
+ browser: get_browser_info(item.router_data)?,
+ version: Some(2),
+ auth_required: Some(true),
+ }),
+ Some(
+ item.router_data
+ .request
+ .get_browser_info()?
+ .get_ip_address()?,
+ ),
+ ),
+ enums::AuthenticationType::NoThreeDs => (None, None),
};
- let bambora_card = BamboraCard {
+ let card = BamboraCard {
name: item.router_data.get_billing_address()?.get_full_name()?,
expiry_year: req_card.get_card_expiry_year_2_digit()?,
number: req_card.card_number,
@@ -153,19 +162,31 @@ impl TryFrom<BamboraRouterData<&types::PaymentsAuthorizeRouterData>> for Bambora
three_d_secure: three_ds,
complete: item.router_data.request.is_auto_capture()?,
};
- let browser_info = item.router_data.request.get_browser_info()?;
+
Ok(Self {
order_number: item.router_data.connector_request_reference_id.clone(),
amount: item.amount,
payment_method: PaymentMethod::Card,
- card: bambora_card,
- customer_ip: browser_info
- .ip_address
- .map(|ip_address| Secret::new(format!("{ip_address}"))),
+ card,
+ customer_ip,
term_url: item.router_data.request.complete_authorize_url.clone(),
})
}
- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+ domain::PaymentMethodData::CardRedirect(_)
+ | domain::PaymentMethodData::Wallet(_)
+ | domain::PaymentMethodData::PayLater(_)
+ | domain::PaymentMethodData::BankRedirect(_)
+ | domain::PaymentMethodData::BankDebit(_)
+ | domain::PaymentMethodData::BankTransfer(_)
+ | 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("Payment methods".to_string()).into())
+ }
}
}
}
@@ -200,87 +221,6 @@ impl TryFrom<&types::ConnectorAuthType> for BamboraAuthType {
}
}
-pub enum PaymentFlow {
- Authorize,
- Capture,
- Void,
-}
-
-// PaymentsResponse
-impl<F, T>
- TryFrom<(
- types::ResponseRouterData<F, BamboraResponse, T, types::PaymentsResponseData>,
- PaymentFlow,
- )> for types::RouterData<F, T, types::PaymentsResponseData>
-{
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(
- data: (
- types::ResponseRouterData<F, BamboraResponse, T, types::PaymentsResponseData>,
- PaymentFlow,
- ),
- ) -> Result<Self, Self::Error> {
- let flow = data.1;
- let item = data.0;
- match item.response {
- BamboraResponse::NormalTransaction(pg_response) => Ok(Self {
- status: match pg_response.approved.as_str() {
- "0" => match flow {
- PaymentFlow::Authorize => enums::AttemptStatus::AuthorizationFailed,
- PaymentFlow::Capture => enums::AttemptStatus::Failure,
- PaymentFlow::Void => enums::AttemptStatus::VoidFailed,
- },
- "1" => match flow {
- PaymentFlow::Authorize => enums::AttemptStatus::Authorized,
- PaymentFlow::Capture => enums::AttemptStatus::Charged,
- PaymentFlow::Void => enums::AttemptStatus::Voided,
- },
- &_ => Err(errors::ConnectorError::ResponseDeserializationFailed)?,
- },
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- pg_response.id.to_string(),
- ),
- redirection_data: None,
- mandate_reference: None,
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: Some(pg_response.order_number.to_string()),
- incremental_authorization_allowed: None,
- }),
- ..item.data
- }),
-
- BamboraResponse::ThreeDsResponse(response) => {
- let value = url::form_urlencoded::parse(response.contents.as_bytes())
- .map(|(key, val)| [key, val].concat())
- .collect();
- let redirection_data = Some(services::RedirectForm::Html { html_data: value });
- Ok(Self {
- status: enums::AttemptStatus::AuthenticationPending,
- response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::NoResponseId,
- redirection_data,
- mandate_reference: None,
- connector_metadata: Some(
- serde_json::to_value(BamboraMeta {
- three_d_session_data: response.three_d_session_data.expose(),
- })
- .change_context(errors::ConnectorError::ResponseHandlingFailed)?,
- ),
- network_txn_id: None,
- connector_response_reference_id: Some(
- item.data.connector_request_reference_id.to_string(),
- ),
- incremental_authorization_allowed: None,
- }),
- ..item.data
- })
- }
- }
- }
-}
-
fn str_or_i32<'de, D>(deserializer: D) -> Result<String, D::Error>
where
D: Deserializer<'de>,
@@ -444,7 +384,7 @@ pub enum PaymentMethod {
// Capture
#[derive(Default, Debug, Clone, Serialize, PartialEq)]
pub struct BamboraPaymentsCaptureRequest {
- amount: Option<f64>,
+ amount: f64,
payment_method: PaymentMethod,
}
@@ -456,12 +396,269 @@ impl TryFrom<BamboraRouterData<&types::PaymentsCaptureRouterData>>
item: BamboraRouterData<&types::PaymentsCaptureRouterData>,
) -> Result<Self, Self::Error> {
Ok(Self {
- amount: Some(item.amount),
+ amount: item.amount,
payment_method: PaymentMethod::Card,
})
}
}
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BamboraResponse,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BamboraResponse,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ match item.response {
+ BamboraResponse::NormalTransaction(pg_response) => Ok(Self {
+ status: if pg_response.approved.as_str() == "1" {
+ match item.data.request.is_auto_capture()? {
+ true => enums::AttemptStatus::Charged,
+ false => enums::AttemptStatus::Authorized,
+ }
+ } else {
+ match item.data.request.is_auto_capture()? {
+ true => enums::AttemptStatus::Failure,
+ false => enums::AttemptStatus::AuthorizationFailed,
+ }
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ pg_response.id.to_string(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(pg_response.order_number.to_string()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ }),
+
+ BamboraResponse::ThreeDsResponse(response) => {
+ let value = url::form_urlencoded::parse(response.contents.as_bytes())
+ .map(|(key, val)| [key, val].concat())
+ .collect();
+ let redirection_data = Some(services::RedirectForm::Html { html_data: value });
+ Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending,
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::NoResponseId,
+ redirection_data,
+ mandate_reference: None,
+ connector_metadata: Some(
+ serde_json::to_value(BamboraMeta {
+ three_d_session_data: response.three_d_session_data.expose(),
+ })
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?,
+ ),
+ network_txn_id: None,
+ connector_response_reference_id: Some(
+ item.data.connector_request_reference_id.to_string(),
+ ),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ }
+ }
+ }
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: if item.response.approved.as_str() == "1" {
+ match item.data.request.is_auto_capture()? {
+ true => enums::AttemptStatus::Charged,
+ false => enums::AttemptStatus::Authorized,
+ }
+ } else {
+ match item.data.request.is_auto_capture()? {
+ true => enums::AttemptStatus::Failure,
+ false => enums::AttemptStatus::AuthorizationFailed,
+ }
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.id.to_string(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.order_number.to_string()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::PaymentsSyncData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::PaymentsSyncData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::PaymentsSyncData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: match item.data.request.is_auto_capture()? {
+ true => {
+ if item.response.approved.as_str() == "1" {
+ enums::AttemptStatus::Charged
+ } else {
+ enums::AttemptStatus::Failure
+ }
+ }
+ false => {
+ if item.response.approved.as_str() == "1" {
+ enums::AttemptStatus::Authorized
+ } else {
+ enums::AttemptStatus::AuthorizationFailed
+ }
+ }
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.id.to_string(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.order_number.to_string()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::PaymentsCaptureData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::PaymentsCaptureData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::PaymentsCaptureData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: if item.response.approved.as_str() == "1" {
+ enums::AttemptStatus::Charged
+ } else {
+ enums::AttemptStatus::Failure
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.id.to_string(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.order_number.to_string()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::PaymentsCancelData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::PaymentsCancelData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ BamboraPaymentsResponse,
+ types::PaymentsCancelData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: if item.response.approved.as_str() == "1" {
+ enums::AttemptStatus::Voided
+ } else {
+ enums::AttemptStatus::VoidFailed
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.id.to_string(),
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: Some(item.response.order_number.to_string()),
+ incremental_authorization_allowed: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
// REFUND :
// Type definition for RefundRequest
#[derive(Default, Debug, Serialize)]
@@ -537,10 +734,10 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
fn try_from(
item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
- let refund_status = match item.response.approved.as_str() {
- "0" => enums::RefundStatus::Failure,
- "1" => enums::RefundStatus::Success,
- &_ => Err(errors::ConnectorError::ResponseDeserializationFailed)?,
+ let refund_status = if item.response.approved.as_str() == "1" {
+ enums::RefundStatus::Success
+ } else {
+ enums::RefundStatus::Failure
};
Ok(Self {
response: Ok(types::RefundsResponseData {
@@ -559,10 +756,10 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
fn try_from(
item: types::RefundsResponseRouterData<api::RSync, RefundResponse>,
) -> Result<Self, Self::Error> {
- let refund_status = match item.response.approved.as_str() {
- "0" => enums::RefundStatus::Failure,
- "1" => enums::RefundStatus::Success,
- &_ => Err(errors::ConnectorError::ResponseDeserializationFailed)?,
+ let refund_status = if item.response.approved.as_str() == "1" {
+ enums::RefundStatus::Success
+ } else {
+ enums::RefundStatus::Failure
};
Ok(Self {
response: Ok(types::RefundsResponseData {
|
fix
|
[BAMBORA] Audit Fixes for Bambora (#4604)
|
95de3a579d073060dd0e4eca382650042bfd6737
|
2023-07-17 15:16:40
|
Sai Harsha Vardhan
|
feat(router): add attempt_count field in attempt update record of payment_intent (#1725)
| false
|
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 19ffe516fd8..2a20c2681bf 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -134,8 +134,9 @@ pub enum PaymentIntentUpdate {
order_details: Option<Vec<pii::SecretSerdeValue>>,
metadata: Option<pii::SecretSerdeValue>,
},
- PaymentAttemptUpdate {
+ PaymentAttemptAndAttemptCountUpdate {
active_attempt_id: String,
+ attempt_count: i16,
},
StatusAndAttemptUpdate {
status: storage_enums::IntentStatus,
@@ -299,8 +300,12 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
modified_at: Some(common_utils::date_time::now()),
..Default::default()
},
- PaymentIntentUpdate::PaymentAttemptUpdate { active_attempt_id } => Self {
+ PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {
+ active_attempt_id,
+ attempt_count,
+ } => Self {
active_attempt_id: Some(active_attempt_id),
+ attempt_count: Some(attempt_count),
..Default::default()
},
PaymentIntentUpdate::StatusAndAttemptUpdate {
|
feat
|
add attempt_count field in attempt update record of payment_intent (#1725)
|
2807622ba671f77892a0fde42febbcffcb6c2238
|
2024-10-25 18:29:44
|
Kiran Kumar
|
refactor(connector): added amount conversion framework for klarna and change type of amount to MinorUnit for OrderDetailsWithAmount (#4979)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 9a406e9c733..8ee962b0bba 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -10977,9 +10977,7 @@
"minimum": 0
},
"amount": {
- "type": "integer",
- "format": "int64",
- "description": "the amount per quantity of product"
+ "$ref": "#/components/schemas/MinorUnit"
},
"requires_shipping": {
"type": "boolean",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 4b0f33da3e7..2f6f4fdf0bc 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -14219,9 +14219,7 @@
"minimum": 0
},
"amount": {
- "type": "integer",
- "format": "int64",
- "description": "the amount per quantity of product"
+ "$ref": "#/components/schemas/MinorUnit"
},
"requires_shipping": {
"type": "boolean",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 61c7911170a..4ab0158d01b 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5080,7 +5080,7 @@ pub struct OrderDetailsWithAmount {
#[schema(example = 1)]
pub quantity: u16,
/// the amount per quantity of product
- pub amount: i64,
+ pub amount: MinorUnit,
// Does the order includes shipping
pub requires_shipping: Option<bool>,
/// The image URL of the product
diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs
index 6a048e53147..ce2be525989 100644
--- a/crates/common_utils/src/types.rs
+++ b/crates/common_utils/src/types.rs
@@ -7,7 +7,8 @@ pub mod authentication;
use std::{
borrow::Cow,
fmt::Display,
- ops::{Add, Sub},
+ iter::Sum,
+ ops::{Add, Mul, Sub},
primitive::i64,
str::FromStr,
};
@@ -483,6 +484,20 @@ impl Sub for MinorUnit {
}
}
+impl Mul<u16> for MinorUnit {
+ type Output = Self;
+
+ fn mul(self, a2: u16) -> Self::Output {
+ Self(self.0 * i64::from(a2))
+ }
+}
+
+impl Sum for MinorUnit {
+ fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
+ iter.fold(Self(0), |a, b| a + b)
+ }
+}
+
/// Connector specific types to send
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq)]
diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
index 56559b75abc..c2466799cdf 100644
--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs
+++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
@@ -190,11 +190,22 @@ impl ConnectorIntegration<CalculateTax, PaymentsTaxCalculationData, TaxCalculati
let shipping = utils::convert_amount(
self.amount_converter,
- req.request.shipping_cost.unwrap_or(MinorUnit::new(0)),
+ req.request.shipping_cost.unwrap_or(MinorUnit::zero()),
req.request.currency,
)?;
- let connector_router_data = taxjar::TaxjarRouterData::from((amount, shipping, req));
+ let order_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request
+ .order_details
+ .as_ref()
+ .map(|details| details.iter().map(|item| item.amount).sum())
+ .unwrap_or(MinorUnit::zero()),
+ req.request.currency,
+ )?;
+
+ let connector_router_data =
+ taxjar::TaxjarRouterData::from((amount, order_amount, shipping, req));
let connector_req = taxjar::TaxjarPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs b/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs
index 1bdc2d2049c..617f6d47487 100644
--- a/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/taxjar/transformers.rs
@@ -7,7 +7,7 @@ use hyperswitch_domain_models::{
router_response_types::TaxCalculationResponseData,
types,
};
-use hyperswitch_interfaces::{api, errors};
+use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -18,14 +18,18 @@ use crate::{
pub struct TaxjarRouterData<T> {
pub amount: FloatMajorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub order_amount: FloatMajorUnit,
pub shipping: FloatMajorUnit,
pub router_data: T,
}
-impl<T> From<(FloatMajorUnit, FloatMajorUnit, T)> for TaxjarRouterData<T> {
- fn from((amount, shipping, item): (FloatMajorUnit, FloatMajorUnit, T)) -> Self {
+impl<T> From<(FloatMajorUnit, FloatMajorUnit, FloatMajorUnit, T)> for TaxjarRouterData<T> {
+ fn from(
+ (amount, order_amount, shipping, item): (FloatMajorUnit, FloatMajorUnit, FloatMajorUnit, T),
+ ) -> Self {
Self {
amount,
+ order_amount,
shipping,
router_data: item,
}
@@ -49,7 +53,7 @@ pub struct LineItem {
id: Option<String>,
quantity: Option<u16>,
product_tax_code: Option<String>,
- unit_price: Option<f64>,
+ unit_price: Option<FloatMajorUnit>,
}
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
@@ -69,8 +73,6 @@ impl TryFrom<&TaxjarRouterData<&types::PaymentsTaxCalculationRouterData>>
item: &TaxjarRouterData<&types::PaymentsTaxCalculationRouterData>,
) -> Result<Self, Self::Error> {
let request = &item.router_data.request;
- let currency = item.router_data.request.currency;
- let currency_unit = &api::CurrencyUnit::Base;
let shipping = &item
.router_data
.request
@@ -87,16 +89,11 @@ impl TryFrom<&TaxjarRouterData<&types::PaymentsTaxCalculationRouterData>>
order_details
.iter()
.map(|line_item| {
- let unit_price = utils::get_amount_as_f64(
- currency_unit,
- line_item.amount,
- currency,
- )?;
Ok(LineItem {
id: line_item.product_id.clone(),
quantity: Some(line_item.quantity),
product_tax_code: line_item.product_tax_code.clone(),
- unit_price: Some(unit_price),
+ unit_price: Some(item.order_amount),
})
})
.collect();
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index d4a18a15182..166e7130483 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -624,11 +624,14 @@ fn get_item_object(
name: data.product_name.clone(),
quantity: data.quantity,
price: utils::to_currency_base_unit_with_zero_decimal_check(
- data.amount,
+ data.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.
item.request.currency,
)?,
line_amount_total: (f64::from(data.quantity)
- * utils::to_currency_base_unit_asf64(data.amount, item.request.currency)?)
+ * utils::to_currency_base_unit_asf64(
+ data.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.
+ item.request.currency,
+ )?)
.to_string(),
})
})
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 21c9c34409a..bc75fd29c02 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1770,8 +1770,8 @@ fn get_line_items(item: &AdyenRouterData<&types::PaymentsAuthorizeRouterData>) -
.iter()
.enumerate()
.map(|(i, data)| LineItem {
- amount_including_tax: Some(MinorUnit::new(data.amount)),
- amount_excluding_tax: Some(MinorUnit::new(data.amount)),
+ amount_including_tax: Some(data.amount),
+ amount_excluding_tax: Some(data.amount),
description: Some(data.product_name.clone()),
id: Some(format!("Items #{i}")),
tax_amount: None,
diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs
index 0c362d26edf..07bc6bd014c 100644
--- a/crates/router/src/connector/klarna.rs
+++ b/crates/router/src/connector/klarna.rs
@@ -1,9 +1,11 @@
pub mod transformers;
-use std::fmt::Debug;
use api_models::enums;
use base64::Engine;
-use common_utils::request::RequestContent;
+use common_utils::{
+ request::RequestContent,
+ types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
+};
use error_stack::{report, ResultExt};
use masking::PeekInterface;
use router_env::logger;
@@ -29,8 +31,18 @@ use crate::{
utils::BytesExt,
};
-#[derive(Debug, Clone)]
-pub struct Klarna;
+#[derive(Clone)]
+pub struct Klarna {
+ amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
+}
+
+impl Klarna {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &MinorUnitForConnector,
+ }
+ }
+}
impl ConnectorCommon for Klarna {
fn id(&self) -> &'static str {
@@ -215,12 +227,12 @@ impl
req: &types::PaymentsSessionRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = klarna::KlarnaRouterData::try_from((
- &self.get_currency_unit(),
+ let amount = connector_utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
req.request.currency,
- req.request.amount,
- req,
- ))?;
+ )?;
+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));
let connector_req = klarna::KlarnaSessionRequest::try_from(&connector_router_data)?;
// encode only for for urlencoded things.
@@ -342,12 +354,12 @@ impl
req: &types::PaymentsCaptureRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = klarna::KlarnaRouterData::try_from((
- &self.get_currency_unit(),
+ let amount = connector_utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount_to_capture,
req.request.currency,
- req.request.amount_to_capture,
- req,
- ))?;
+ )?;
+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));
let connector_req = klarna::KlarnaCaptureRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -670,12 +682,12 @@ impl
req: &types::PaymentsAuthorizeRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = klarna::KlarnaRouterData::try_from((
- &self.get_currency_unit(),
+ let amount = connector_utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
req.request.currency,
- req.request.amount,
- req,
- ))?;
+ )?;
+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));
let connector_req = klarna::KlarnaPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
@@ -847,12 +859,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
req: &types::RefundsRouterData<api::Execute>,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_router_data = klarna::KlarnaRouterData::try_from((
- &self.get_currency_unit(),
+ let amount = connector_utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
req.request.currency,
- req.request.refund_amount,
- req,
- ))?;
+ )?;
+ let connector_router_data = klarna::KlarnaRouterData::from((amount, req));
let connector_req = klarna::KlarnaRefundRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rs
index ea83e20d99d..62a5cef0bca 100644
--- a/crates/router/src/connector/klarna/transformers.rs
+++ b/crates/router/src/connector/klarna/transformers.rs
@@ -1,5 +1,5 @@
use api_models::payments;
-use common_utils::pii;
+use common_utils::{pii, types::MinorUnit};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::router_data::KlarnaSdkResponse;
use masking::{ExposeInterface, Secret};
@@ -15,25 +15,16 @@ use crate::{
#[derive(Debug, Serialize)]
pub struct KlarnaRouterData<T> {
- amount: i64,
+ amount: MinorUnit,
router_data: T,
}
-impl<T> TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for KlarnaRouterData<T> {
- type Error = error_stack::Report<errors::ConnectorError>;
-
- fn try_from(
- (_currency_unit, _currency, amount, router_data): (
- &api::CurrencyUnit,
- enums::Currency,
- i64,
- T,
- ),
- ) -> Result<Self, Self::Error> {
- Ok(Self {
+impl<T> From<(MinorUnit, T)> for KlarnaRouterData<T> {
+ fn from((amount, router_data): (MinorUnit, T)) -> Self {
+ Self {
amount,
router_data,
- })
+ }
}
}
@@ -74,7 +65,7 @@ impl TryFrom<&Option<pii::SecretSerdeValue>> for KlarnaConnectorMetadataObject {
pub struct KlarnaPaymentsRequest {
auto_capture: bool,
order_lines: Vec<OrderLines>,
- order_amount: i64,
+ order_amount: MinorUnit,
purchase_country: enums::CountryAlpha2,
purchase_currency: enums::Currency,
merchant_reference1: Option<String>,
@@ -110,7 +101,7 @@ pub struct KlarnaSessionRequest {
intent: KlarnaSessionIntent,
purchase_country: enums::CountryAlpha2,
purchase_currency: enums::Currency,
- order_amount: i64,
+ order_amount: MinorUnit,
order_lines: Vec<OrderLines>,
shipping_address: Option<KlarnaShippingAddress>,
}
@@ -157,7 +148,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsSessionRouterData>> for KlarnaSes
name: data.product_name.clone(),
quantity: data.quantity,
unit_price: data.amount,
- total_amount: i64::from(data.quantity) * (data.amount),
+ total_amount: data.amount * data.quantity,
})
.collect(),
shipping_address: get_address_info(item.router_data.get_optional_shipping())
@@ -210,7 +201,7 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsAuthorizeRouterData>> for KlarnaP
name: data.product_name.clone(),
quantity: data.quantity,
unit_price: data.amount,
- total_amount: i64::from(data.quantity) * (data.amount),
+ total_amount: data.amount * data.quantity,
})
.collect(),
merchant_reference1: Some(item.router_data.connector_request_reference_id.clone()),
@@ -294,8 +285,8 @@ impl TryFrom<types::PaymentsResponseRouterData<KlarnaPaymentsResponse>>
pub struct OrderLines {
name: String,
quantity: u16,
- unit_price: i64,
- total_amount: i64,
+ unit_price: MinorUnit,
+ total_amount: MinorUnit,
}
#[derive(Debug, Serialize)]
@@ -412,7 +403,7 @@ impl<F, T>
#[derive(Debug, Serialize)]
pub struct KlarnaCaptureRequest {
- captured_amount: i64,
+ captured_amount: MinorUnit,
reference: Option<String>,
}
@@ -490,7 +481,7 @@ impl<F>
#[derive(Default, Debug, Serialize)]
pub struct KlarnaRefundRequest {
- refunded_amount: i64,
+ refunded_amount: MinorUnit,
reference: Option<String>,
}
diff --git a/crates/router/src/connector/riskified/transformers/api.rs b/crates/router/src/connector/riskified/transformers/api.rs
index 2e0ac3b0047..d2d38855daf 100644
--- a/crates/router/src/connector/riskified/transformers/api.rs
+++ b/crates/router/src/connector/riskified/transformers/api.rs
@@ -163,7 +163,7 @@ impl TryFrom<&frm_types::FrmCheckoutRouterData> for RiskifiedPaymentsCheckoutReq
.get_order_details()?
.iter()
.map(|order_detail| LineItem {
- price: order_detail.amount,
+ price: order_detail.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.
quantity: i32::from(order_detail.quantity),
title: order_detail.product_name.clone(),
product_type: order_detail.product_type.clone(),
diff --git a/crates/router/src/connector/signifyd/transformers/api.rs b/crates/router/src/connector/signifyd/transformers/api.rs
index 6aeda8f8d47..eed0e9937b2 100644
--- a/crates/router/src/connector/signifyd/transformers/api.rs
+++ b/crates/router/src/connector/signifyd/transformers/api.rs
@@ -145,7 +145,7 @@ impl TryFrom<&frm_types::FrmSaleRouterData> for SignifydPaymentsSaleRequest {
.iter()
.map(|order_detail| Products {
item_name: order_detail.product_name.clone(),
- item_price: order_detail.amount,
+ item_price: order_detail.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.
item_quantity: i32::from(order_detail.quantity),
item_id: order_detail.product_id.clone(),
item_category: order_detail.category.clone(),
@@ -382,7 +382,7 @@ impl TryFrom<&frm_types::FrmCheckoutRouterData> for SignifydPaymentsCheckoutRequ
.iter()
.map(|order_detail| Products {
item_name: order_detail.product_name.clone(),
- item_price: order_detail.amount,
+ item_price: order_detail.amount.get_amount_as_i64(), // This should be changed to MinorUnit when we implement amount conversion for this connector. Additionally, the function get_amount_as_i64() should be avoided in the future.
item_quantity: i32::from(order_detail.quantity),
item_id: order_detail.product_id.clone(),
item_category: order_detail.category.clone(),
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index ebc522b30ad..09a2457197c 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -11,7 +11,7 @@ use common_utils::{
DEFAULT_PRODUCT_IMG, DEFAULT_SDK_LAYOUT, DEFAULT_SESSION_EXPIRY,
},
ext_traits::{AsyncExt, OptionExt, ValueExt},
- types::{AmountConvertor, MinorUnit, StringMajorUnitForCore},
+ types::{AmountConvertor, StringMajorUnitForCore},
};
use error_stack::{report, ResultExt};
use futures::future;
@@ -547,7 +547,7 @@ fn validate_order_details(
.clone_from(&order.product_img_link)
};
order_details_amount_string.amount = required_conversion_type
- .convert(MinorUnit::new(order.amount), currency)
+ .convert(order.amount, currency)
.change_context(errors::ApiErrorResponse::AmountConversionFailed {
amount_type: "StringMajorUnit",
})?;
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 0de7683097b..1f67e8066c9 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -5445,13 +5445,13 @@ pub async fn get_unified_translation(
}
pub fn validate_order_details_amount(
order_details: Vec<api_models::payments::OrderDetailsWithAmount>,
- amount: i64,
+ amount: MinorUnit,
should_validate: bool,
) -> Result<(), errors::ApiErrorResponse> {
if should_validate {
- let total_order_details_amount: i64 = order_details
+ let total_order_details_amount: MinorUnit = order_details
.iter()
- .map(|order| order.amount * i64::from(order.quantity))
+ .map(|order| order.amount * order.quantity)
.sum();
if total_order_details_amount != amount {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 69cf19b09bb..3a66094081e 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -98,7 +98,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
- payment_intent.amount.get_amount_as_i64(),
+ payment_intent.amount,
false,
)?;
}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 3bccce2783a..696bd1468e4 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -338,7 +338,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
- payment_intent.amount.get_amount_as_i64(),
+ payment_intent.amount,
false,
)?;
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 757370f0c95..0b530d4d054 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -82,7 +82,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
- payment_intent.amount.get_amount_as_i64(),
+ payment_intent.amount,
false,
)?;
}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 0ba89053031..fe217445eea 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1974,7 +1974,7 @@ pub fn voucher_next_steps_check(
}
pub fn change_order_details_to_new_type(
- order_amount: i64,
+ order_amount: MinorUnit,
order_details: api_models::payments::OrderDetails,
) -> Option<Vec<api_models::payments::OrderDetailsWithAmount>> {
Some(vec![api_models::payments::OrderDetailsWithAmount {
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 198d400b854..b85ae5bfab2 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -430,7 +430,9 @@ impl ConnectorData {
enums::Connector::Itaubank => {
Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new())))
}
- enums::Connector::Klarna => Ok(ConnectorEnum::Old(Box::new(&connector::Klarna))),
+ enums::Connector::Klarna => {
+ Ok(ConnectorEnum::Old(Box::new(connector::Klarna::new())))
+ }
enums::Connector::Mollie => {
Ok(ConnectorEnum::Old(Box::new(connector::Mollie::new())))
}
diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs
index e85c57df622..3b4cf5195f5 100644
--- a/crates/router/tests/connectors/payme.rs
+++ b/crates/router/tests/connectors/payme.rs
@@ -1,7 +1,7 @@
use std::str::FromStr;
use api_models::payments::{Address, AddressDetails, OrderDetailsWithAmount};
-use common_utils::pii::Email;
+use common_utils::{pii::Email, types::MinorUnit};
use masking::Secret;
use router::types::{self, domain, storage::enums, PaymentAddress};
@@ -80,7 +80,7 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "iphone 13".to_string(),
quantity: 1,
- amount: 1000,
+ amount: MinorUnit::new(1000),
product_img_link: None,
requires_shipping: None,
product_id: None,
@@ -381,7 +381,7 @@ async fn should_fail_payment_for_incorrect_cvc() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "iphone 13".to_string(),
quantity: 1,
- amount: 100,
+ amount: MinorUnit::new(100),
product_img_link: None,
requires_shipping: None,
product_id: None,
@@ -421,7 +421,7 @@ async fn should_fail_payment_for_invalid_exp_month() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "iphone 13".to_string(),
quantity: 1,
- amount: 100,
+ amount: MinorUnit::new(100),
product_img_link: None,
requires_shipping: None,
product_id: None,
@@ -461,7 +461,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "iphone 13".to_string(),
quantity: 1,
- amount: 100,
+ amount: MinorUnit::new(100),
product_img_link: None,
requires_shipping: None,
product_id: None,
diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rs
index 20948a90c6d..da83bdc7d41 100644
--- a/crates/router/tests/connectors/zen.rs
+++ b/crates/router/tests/connectors/zen.rs
@@ -325,7 +325,7 @@ async fn should_fail_payment_for_incorrect_card_number() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "test".to_string(),
quantity: 1,
- amount: 1000,
+ amount: MinorUnit::new(1000),
product_img_link: None,
requires_shipping: None,
product_id: None,
@@ -368,7 +368,7 @@ async fn should_fail_payment_for_incorrect_cvc() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "test".to_string(),
quantity: 1,
- amount: 1000,
+ amount: MinorUnit::new(1000),
product_img_link: None,
requires_shipping: None,
product_id: None,
@@ -411,7 +411,7 @@ async fn should_fail_payment_for_invalid_exp_month() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "test".to_string(),
quantity: 1,
- amount: 1000,
+ amount: MinorUnit::new(1000),
product_img_link: None,
requires_shipping: None,
product_id: None,
@@ -454,7 +454,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "test".to_string(),
quantity: 1,
- amount: 1000,
+ amount: MinorUnit::new(1000),
product_img_link: None,
requires_shipping: None,
product_id: None,
|
refactor
|
added amount conversion framework for klarna and change type of amount to MinorUnit for OrderDetailsWithAmount (#4979)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.